benchling-tools
A CLI for coding agents and humans, directly mirrored as an MCP server for chat agents.
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
A scripted playback of the offline fixture demo (no credentials, no network). The demo page has the full transcript and the asciinema cast.
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 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
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.
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 planonly reads Benchling and writes an immutable local plan. Nothing changes remotely untilchanges 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. - Write guards on MCP. The MCP server refuses
changes_applyunless it was started with--allow-writes ENVfor that environment. Reads,export, andchanges_planstay available. - Protected environments. An environment marked with
auth protectrefuses a write unless its name is typed twice:--env prod --confirm-env prodon the CLI, orconfirm_envequal toenvon 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
- SKILL.md: the agent guide, also installed with the package (
benchling-tools skill show) - CLI and MCP reference: every command and tool, configuration, safety model, exit codes, and known limitations
- Setup guide, API limitations, and research record
- Threat model: credentials, stale or replayed plans, write scoping, and agent misuse, including the limits of those controls
- ARCHITECTURE.md: the plan, apply, and journal sequence and the module map
- CHANGELOG.md
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
- Contributing guide, including tests and the opt-in sandbox exercise, and Code of Conduct
- Security policy
- Licensed under the Apache License 2.0; see NOTICE. Releases up to and including 0.4.1 were published under the MIT License and remain available under it.
Metadata
Release files for benchling-tools 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| benchling_tools-0.7.0.tar.gz | 271.5 kB | With provenance | Details for benchling_tools-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| benchling_tools-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for benchling_tools-0.7.0-py3-none-any.whl |
Total release size: 447.1 kB
Release files / benchling_tools-0.7.0.tar.gz
| Download URL | benchling_tools-0.7.0.tar.gz |
|---|---|
| Size | 271.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e242cc3e1a6212fae1b3ea4f9e9173498cda1c8bbc16e1c948226c679b73786c
|
|
BLAKE2b-256 checksum How to use checksums |
6fafa46dcdb172dc8d82510474ceeb6056d721d8e2a17edd892357d57db01fb3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logRelease files / benchling_tools-0.7.0-py3-none-any.whl
| Download URL | benchling_tools-0.7.0-py3-none-any.whl |
|---|---|
| Size | 175.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5f6593424f95e7ab55234fa51ead72924fb75b579be5e763fd5979ce63d8901b
|
|
BLAKE2b-256 checksum How to use checksums |
96a6b5712deccaad4a36a1b6fad9948979a0edde8503fb103b751a134158e23c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logSecurity for benchling-tools 0.7.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for benchling_tools-0.7.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.