Skip to main content
Glama

benchling-tools

A CLI for coding agents and humans, directly mirrored as an MCP server for chat agents.

CI License: Apache 2.0 Python 3.11+

Unofficial; not affiliated with or endorsed by Benchling, Inc. Benchling is a trademark of Benchling, Inc.

An electronic lab notebook is a scientific record, so letting an AI agent write to one directly is hard to trust. benchling-tools is a JSON-first command-line tool for a Benchling tenant that coding agents and people run directly. Each CLI command is also a tool on a local Model Context Protocol (MCP) server, so chat agents get the same commands, arguments, and replies. It uses the public Benchling API only and never automates the browser. It covers six change families: template-based entry creation, document text, unstructured tables, entry fields, assay results, and containers. Every change is first previewed as an immutable, checksummed plan, and a separate, explicit step applies it. You can keep several environments, each saved with benchling-tools auth login with its client secret in the OS keychain. Both interfaces return one versioned JSON envelope and stable exit codes.

No public Python API. benchling-tools has no public Python API. Its Python modules are internal and may change in any release. To script Benchling from Python, use the official Benchling SDK. A public Python API may be added if there is enough interest; open a GitHub issue to say you want one.

Demo

Scripted playback of the offline fixture demo: a read, a preview, one apply, a stale plan, a replay, and a read-only MCP server

A scripted playback of the offline fixture demo (no credentials, no network). The demo page has the full transcript and the asciinema cast.

Related MCP server: ipynb-mcp

Install

Python 3.11 or newer and uv are required. The distribution and the command are both named benchling-tools, published on PyPI. Install it with uv tool install, or run it without installing with uvx benchling-tools.

uv tool install benchling-tools
benchling-tools --help

From a checkout, use uv tool install ., or uv run benchling-tools after uv sync (add --extra dev for the test and lint tools); uv sync does not put benchling-tools on PATH.

Log in

Create the Benchling app and grant it project access first; see the setup guide. Then run benchling-tools auth login in your own terminal. The client secret is read from a hidden prompt, or from stdin with --secret-stdin, and is never accepted as an argument. It goes to the OS keychain; there is no plaintext fallback.

benchling-tools auth login --env dev
# Tenant URL: https://your-tenant.benchling.com
# Client ID: your-app-client-id
# Client secret (not echoed):
benchling-tools auth status
benchling-tools doctor --env dev

The toolkit acts as the app, with the app's permissions and audit identity, not the signed-in browser user. Login without a terminal, environment names, auth status --check, and auth logout are in the reference.

Headless Linux

Linux servers and agent machines often have no unlocked Secret Service on the session bus, and benchling-tools will not write the client secret to a plaintext file. Install gnome-keyring and dbus, unlock a keyring, and run the login in that session. A long-lived bus for MCP, later shells, and cron is needed too. The commands are in the reference.

CLI examples

There is no default environment: pass --env NAME (or -e) on every API command. Every command prints a versioned JSON envelope; diagnostics go to stderr.

benchling-tools entry resolve EXP-0001 --env dev
benchling-tools entry inspect etr_abc123 --env dev
benchling-tools entry list --project src_example --modified-after 2026-01-01 --env dev
benchling-tools results tables etr_abc123 --env dev
benchling-tools results tables etr_abc123 --name-prefix "Panel Testing" --where "Processing run=RUN_ID" --env dev
benchling-tools results diff --left EXP-1 --right EXP-2 --key Well --resolve-barcodes --env dev
benchling-tools export --kind table --part docpart_table1 --format csv --output measurements.csv --env dev

benchling-tools changes plan --entry etr_abc123 --family table --spec examples/table-set-cells.json --env dev
benchling-tools changes apply PLAN_ID --env dev
benchling-tools changes status PLAN_ID --env dev
benchling-tools changes status --task TASK_ID --wait --env dev

Every command, the six change families, spec shapes, result uploads and attachments, pending results, and the canned examples are in the CLI and MCP reference.

Command

Purpose

users list

List visible users by handle, email, name, ID, or organization.

users get

Read a visible user by ID or exact handle.

entry list

List entries with server-side filters, including creator and author, optionally ordered with --sort.

entry inspect

Summarize an entry's sections, tables, text boxes (text_boxes) and lookup tables (lookup_tables). Read-only.

part get

Read one document part, such as a text box or a lookup table with its rows, without a full entry snapshot. Read-only.

container find

Find containers by exact name, by the entities or registry IDs they hold, or inside a location, box or plate, or check many barcodes in one call and list the invalid, missing, and empty ones. Read-only.

container get --location

Read a container and its location path, from its well, box or plate up to the top location. Read-only.

results capacity

Report each results table's used rows, known pending results, planned rows, and remaining room under Benchling's 1,000-row limit. Read-only.

results verify

Diff a result upload plan, or with --payload the bulk-create body an SDK client sent, against the records Benchling holds. Read-only.

For example, resolve a handle with benchling-tools users get HANDLE --env dev, then use the returned ID with benchling-tools entry list --creator USER_ID --folder lib_example --env dev. Handles may also be passed directly to --creator or --author. To get the newest entry a user created, run benchling-tools entry list --creator USER_ID --sort created-desc --limit 1 --env dev.

For result uploads, preview defaults a missing projectId to the entry's project and refuses the plan if none is available. An explicit projectId: null requests creator-only access, but some tenants reject it. Apply checks every batch before uploading attachments; if a result creation fails after an upload, the error identifies unlinked blobs.

Preview also refuses a result upload that would push any results table past Benchling's 1,000-row table limit, with details.reason table_capacity_exceeded, before any file is staged. Run benchling-tools results capacity ENTRY --spec FILE --env dev to see the same numbers first. 500 records per table in one plan is this toolkit's own batch size; Benchling documents 4,000 results per bulk-create request.

To check a push the toolkit did not make, pass the JSON body an SDK client sent to POST /assay-results:bulk-create: benchling-tools results verify --payload body.json --created-after 2026-11-19T00:00:00Z --env dev (or --id ID for each created result, V2 or V3). It reports matched, mismatched, missing, and extra rows and pending versus accepted, the same report as results verify PLAN_ID. --entry ENTRY drops accepted records of other entries but keeps pending ones, which have no entry until accepted. Nothing is saved.

MCP server

One server serves every environment saved with auth login. The client config carries no secrets; the server reads the same environments.json file and OS keychain as the CLI.

{
  "mcpServers": {
    "benchling-tools": {
      "command": "uvx",
      "args": ["benchling-tools", "mcp", "serve"]
    }
  }
}

Each CLI command is one tool named after its command path (benchling-tools entry get is entry_get), with the same arguments, defaults, and envelope. Commands that need a terminal or change local credentials have no tool. On Linux, add DBUS_SESSION_BUS_ADDRESS to the config's env block. The naming rule, the Linux config, and tool details are in the reference.

Safety model

  • Read-only by default. changes plan only reads Benchling and writes an immutable local plan. Nothing changes remotely until changes apply, which re-checks the plan's version preconditions, refuses stale or already-used plans, never retries a write, and records each stage in a local journal.

  • Result upload fields. Upload specs accept schema system names, field-definition IDs, or display names. Display names are translated to system names in the plan and payload; ambiguous names are reported as row problems with candidate fields.

  • Write guards on MCP. The MCP server refuses changes_apply unless it was started with --allow-writes ENV for that environment. Reads, export, and changes_plan stay available.

  • Protected environments. An environment marked with auth protect refuses a write unless its name is typed twice: --env prod --confirm-env prod on the CLI, or confirm_env equal to env on MCP.

The full safety model, design tradeoffs, exit codes, and known limitations are in the reference. The threat model covers what these controls do not protect against.

Documentation

Citation

If you use this software, please cite it. GitHub's "Cite this repository" button uses CITATION.cff for jmamodeo/benchling-tools.

Contributing, security, license

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI agents to perform safe, semantic edits on Markdown and DOCX documents through a normalized model with staging, diff review, and stale-edit protection.
      13
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to safely read, edit, and execute local Jupyter notebooks without running a separate service. Edits are guarded by compare-and-swap hashes and execution resumes or replays kernel state, so long-running cells aren't needlessly re-run.
      6
      20 npm
      4
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Gives AI agents access to a persistent document workspace, letting them search, read, and update notes, guides, and project documentation across a full catalog of tools, prompts, and resources. It connects either to the hosted Cloud endpoint over Streamable HTTP with OAuth or API-key auth, or to a self-hosted instance through a stdio bridge.
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Gives AI agents and MCP clients token-authenticated read/write access to a Notion workspace, letting them search, create and edit pages, query databases, comment, and upload files in plain language. Writes are batched with atomic rollback and idempotency keys, pages round-trip as markdown, and it runs headless in CI or cron jobs.
      5,360 npm
      MIT