MCP (Model Context Protocol) server for Benchling platform integration
This server implements the Model Context Protocol (MCP) for Benchling, providing a standardized interface for accessing laboratory data management and research workflows. MCP enables AI assistants and agents to interact with Benchling's comprehensive biological data platform through structured interfaces.
The Benchling MCP server provides access to:
- Entries: Laboratory notebook entries and experimental records
- Sequences: DNA, RNA, and protein sequences with annotations
- Projects: Project organization and collaboration data
- Search: Comprehensive search across all Benchling entities
MCP is a protocol that bridges the gap between AI systems and specialized domain knowledge. It enables:
- Structured Access: Direct connection to Benchling's laboratory data
- Natural Language Queries: Simplified interaction with complex biological datasets
- Type Safety: Strong typing and validation through FastMCP
- AI Integration: Seamless integration with AI assistants and agents
You'll need:
- A Benchling account with API access
- Benchling API key
- Your Benchling domain (e.g., "yourcompany.benchling.com")
Set the following environment variables:
export BENCHLING_API_KEY="your_api_key_here"
export BENCHLING_DOMAIN="yourcompany.benchling.com"This server provides the following tools for interacting with Benchling:
benchling_get_entries(folder_id?, project_id?, limit?)- Get laboratory notebook entriesbenchling_get_sequences(sequence_type?, folder_id?, limit?)- Get DNA/RNA/protein sequencesbenchling_get_projects(limit?)- Get projects and their metadatabenchling_search(query, entity_types?, limit?)- Search across Benchling entities
resource://benchling_api-info- Benchling API documentation and usage guidelines
# Download and install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Verify installation
uv --version
uvx --versionYou can run the benchling-mcp server directly using uvx:
# Set environment variables
export BENCHLING_API_KEY="your_api_key_here"
export BENCHLING_DOMAIN="yourcompany.benchling.com"
# Run the server in streamable HTTP mode (default)
uvx benchling-mcpOther uvx modes (STDIO, HTTP, SSE)
# Or explicitly specify stdio mode
uvx benchling-mcp stdio# Run the server in streamable HTTP mode on default (3001) port
uvx benchling-mcp server
# Run on a specific port
uvx benchling-mcp server --port 8000# Run the server in SSE mode
uvx benchling-mcp sseFor AI clients, create configuration files based on your preferred mode:
{
"mcpServers": {
"benchling-mcp": {
"command": "uvx",
"args": ["benchling-mcp", "stdio"],
"env": {
"BENCHLING_API_KEY": "your_api_key_here",
"BENCHLING_DOMAIN": "yourcompany.benchling.com"
}
}
}
}{
"mcpServers": {
"benchling-mcp": {
"command": "uvx",
"args": ["benchling-mcp", "server"],
"env": {
"BENCHLING_API_KEY": "your_api_key_here",
"BENCHLING_DOMAIN": "yourcompany.benchling.com"
}
}
}
}# Clone the repository
git clone https://github.com/your-org/benchling-mcp.git
cd benchling-mcp
# Install dependencies
uv sync
# Set environment variables
export BENCHLING_API_KEY="your_api_key_here"
export BENCHLING_DOMAIN="yourcompany.benchling.com"# Start the MCP server locally (HTTP mode)
uv run server
# Or start in STDIO mode
uv run stdio
# Or start in SSE mode
uv run sse# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=benchling_mcp
# Run specific test file
uv run pytest test/test_benchling_mcp.py# Get recent entries from a specific project
entries = await mcp.get_entries(project_id="proj_12345", limit=10)
# Get entries from a specific folder
entries = await mcp.get_entries(folder_id="lib_67890")# Get DNA sequences
dna_sequences = await mcp.get_sequences(sequence_type="dna", limit=20)
# Get protein sequences from a folder
proteins = await mcp.get_sequences(
sequence_type="aa",
folder_id="lib_proteins",
limit=50
)# Search for entries containing "CRISPR"
results = await mcp.search(
query="CRISPR",
entity_types=["entries"],
limit=25
)
# Search for sequences with specific names
results = await mcp.search(
query="GFP",
entity_types=["dna_sequences", "aa_sequences"]
)The server uses Benchling's API key authentication. The API key should be provided via the BENCHLING_API_KEY environment variable.
Benchling has rate limits on API calls. The server implements appropriate delays and error handling for rate limit responses.
All API calls are wrapped with proper error handling and logging using the eliot library.
Simply point your AI client (like Cursor, Windsurf, ClaudeDesktop, VS Code with Copilot, or others) to use the appropriate configuration file.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run the test suite
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
This project includes automated testing via GitHub Actions that runs both unit tests and real integration tests against the Benchling API.
To enable the full integration tests in CI/CD, you need to add the following secrets to your GitHub repository:
- Go to your GitHub repository
- Navigate to Settings → Secrets and variables → Actions
- Add the following repository secrets:
| Secret Name | Description | Example |
|---|---|---|
BENCHLING_API_KEY |
Your Benchling API key | sk_BWKVnUFsCDDO966aCCVJN6oAdfnee |
BENCHLING_DOMAIN |
Your Benchling domain | benchling.com |
The GitHub Actions workflow (.github/workflows/test.yml) will:
- Always run: Unit tests that don't require API access
- Only if secrets are available:
- Real integration tests using actual Benchling API
- Run the example script to ensure it works end-to-end
- Clean up: Remove any downloaded files after tests
- Upload artifacts: Save logs if tests fail for debugging
You can manually trigger the workflow from the GitHub Actions tab using the "Run workflow" button.
test/test_benchling_mcp.py- Unit tests with mocked dependenciestest/test_benchling_mcp_real.py- Integration tests using real Benchling API- Both test files include comprehensive assertions based on actual run_example.py output
The real integration tests serve as both:
- Living documentation with concrete examples of API responses
- Regression tests ensuring the MCP server works with actual Benchling data