Biolab MCP Server
[Python Version]
[Go Version]
[MCP]
[License]
[PyPI]
[Docker]
"AI agents querying biological databases leave no audit trail. Six months later, nobody can answer: what exact query returned this result, when, and was that paper peer-reviewed at the time? Biolab solves that."
A local-first scientific evidence workspace with Python and Go clients. It sits between scientists or AI agents and PubMed, Europe PMC, ClinicalTrials.gov, UniProt, Open Targets, and bioRxiv/medRxiv. Every retrieval preserves its source response and returns a retrieval_id; projects, reviewed collections, evidence watches, and claim links build a traceable workflow on top.
New to MCP? It's an open standard that lets an AI assistant — Codex,
ChatGPT, Claude, Cursor, and others — call external tools during a conversation.
Add Biolab and the assistant can retrieve, preserve, organize, monitor, and cite
scientific evidence while keeping every result inspectable later.
Use It Now — No Install
A hosted instance is available at https://srikarjy025-biolab-mcp.hf.space/mcp. Point your client at it and you're done. Hosted capabilities follow the version currently deployed there; run locally for the complete 0.4 workspace in this repository.
Claude Code:
Claude Desktop / Cursor — add this to your MCP config file:
(Add "headers": {"Authorization": "Bearer <your key>"} alongside "url" once you have a key — see the rate-limit note below.)
The 0.4 server exposes unified search, source-specific search, standard search/fetch, retrieval inspection, projects, collections, watches, claims, and reports. Every retrieval is written to a hash-chained audit trail you can inspect later (see Audit Trail Schema below).
For cross-source research, search_evidence searches PubMed, Europe PMC,
ClinicalTrials.gov, UniProt, and Open Targets through one call while preserving
explicit results and errors for each source.
Also listed on the official MCP Registry and Smithery if you'd rather discover/install it from there.
A note on rate limits. The hosted server is shared and stays open — no signup required for casual use — but callers with no API key share one small, low-throughput budget (1 req/s to PubMed) so no single anonymous user can starve everyone else. If you're doing more than a handful of queries, ask for a key (below) and you get your own isolated, higher budget instead.
Getting a key:
Add that header in your client's MCP config (Claude Code: claude mcp add --transport http biolab <url> --header "Authorization: Bearer <key>"). Keys are issued with biolab keys create <label> — see Managing API Keys below if you're running your own instance; otherwise ask the maintainer for one.
Want to run your own copy instead (local dev, your own storage, self-hosting)? Keep reading.
The Problem
A drug discovery team uses an AI agent to research gene targets. The agent queries PubMed 200 times over three days and surfaces a paper claiming gene X is upregulated in pancreatic cancer. A scientist makes a decision based on that. Six months later, during FDA submission:
- What exact query returned that paper?
- What date was it retrieved?
- Was it peer-reviewed at retrieval time, or a preprint published later?
- Did the agent summarize it accurately, or hallucinate details?
Without Biolab, nobody can answer any of those questions. The retrieval is invisible.
What Biolab Does
Biolab is an interception and logging layer, not a retrieval layer. It doesn't interpret evidence, rank it, or summarize it — it records what happened, verbatim, so an agent's claim can always be traced back to an unforgeable original.
The agent gets the paper it asked for. Biolab gets a permanent, queryable, tamper-evident record of exactly what happened.
Sources Supported
All sources share a single audit database (SQLite locally, or Turso — a hosted, SQLite-compatible database — in production) with one source-agnostic schema.
Build It Yourself
You don't need to know Python or Go to get this running locally — just follow these steps in order. All commands are run in a terminal.
Prerequisites
- Python 3.11 or newer — check with
python3 --version. Get it from python.org if you don't have it.
- Git — to download (clone) the code. Check with
git --version.
That's genuinely it for the Python path — no database server to install, no API keys required (PubMed works anonymously, just at a lower rate limit).
1. Get the code
2. Install it
3. Try it
This searches PubMed for real, stores every result in a local biolab.db file (created automatically, no setup needed), and prints back the retrieval_id for each paper — the same ID an AI agent would get back over MCP.
4. Run the test suite (optional, confirms everything works)
Run pytest -m live -v separately when network access and local socket binding
are available. Those tests exercise real PubMed, Europe PMC, ClinicalTrials.gov,
and bioRxiv services; the default command stays deterministic and offline.
5. Run it as an MCP server (what an AI agent actually connects to)
This starts an HTTP server on http://localhost:8000/mcp — point Claude Desktop, Claude Code, or Cursor at that URL exactly like in Use It Now, just with localhost:8000 instead of the hosted URL.
6. Build the Docker image (optional)
If you'd rather not install Python locally at all:
(Storage defaults to an ephemeral file inside the container unless you set TURSO_DATABASE_URL/TURSO_AUTH_TOKEN — see Environment Variables below.)
Prefer a pre-built release?
Usage
CLI (Scientist-Friendly)
The dashboard binds to 127.0.0.1 by default. REST endpoints cover evidence,
projects, collections, watches, claims, and reports. Discover them at
/openapi.json; use /health, /metrics, and /v1/verify for operations.
Run biolab web --require-auth with keys created by biolab keys create, or use
BIOLAB_REQUIRE_AUTH=true on the unified MCP server, before exposing it remotely.
MCP Tools (Agent-Friendly)
BioClaw
A ready-to-copy BioClaw skill is included at
integrations/bioclaw/biolab-evidence. It connects BioClaw's containerized
research assistant to the local REST API and supports cross-source search,
retrieval inspection, and chain verification without extra Python packages.
Codex and ChatGPT
- Start the complete local server with
python -m biolab.server.
- Copy
integrations/codex/config.toml.example into your Codex configuration and
keep tool approval on prompt while developing.
- The portable Agent Plugin bundle is in
plugins/biolab/ (plugin.json,
mcp.json, and its evidence-workspace skill). Change the remote URL in
mcp.json to your HTTPS deployment before publishing or submitting it.
- The MCP server includes standard
search and fetch knowledge tools plus the
richer Biolab tools. Tool annotations disclose read-only, write, external-data,
and idempotency behavior to clients.
ChatGPT/Codex can therefore search and preserve evidence, create project state,
run watches, and trace claims. The assistant proposes relationships; a scientist
must use human_reviewed when a relationship has actually been reviewed.
REST and API gateways
One python -m biolab.server process serves MCP at /mcp, the dashboard at /,
and REST under /v1. The important routes are:
The zero-cost Caddy/Docker example in deploy/gateway/ adds a reverse-proxy
boundary and persistent volume. It binds only to localhost by default. Add a real
domain, HTTPS, backups, and organization-specific authorization before public use.
Python API
Managing API Keys
The server stays open to unauthenticated callers by design — but they all share one small, low-throughput rate-limit budget (see Use It Now). Issuing someone a key gives them their own isolated, higher budget instead. This doesn't gate access — it's purely a fairness mechanism so one caller can't starve everyone else's share of PubMed's real rate limit.
The caller sends the key back as Authorization: Bearer <key>. By default a
missing header uses the anonymous tier while an invalid/revoked key returns 401.
Set BIOLAB_REQUIRE_AUTH=true to reject requests without a key as well.
Environment Variables
All optional — the server runs with sensible defaults if you set none of these.
Audit Trail Schema (v2)
Key properties:
- One row per paper retrieval (not per query)
- Raw response stored verbatim — parsing bugs are recoverable
- Hash-chained, not just hashed: each row's hash covers the previous row's hash too, so deleting or editing any row — even in the database directly — breaks the chain for every row after it. Call
retrieval_log.verify_chain(conn) to check the whole log; it returns exactly which row broke, if any.
- Background write queue serializes all writes through one path, so the chain stays consistent even under concurrent agent calls
Tamper Evidence and Execution Runtime
- Retrieval rows are hash-chained over every audited column (
hash_version 2); legacy v1 rows still verify.
biolab anchor out.json [--chain retrievals|executions] writes an HMAC-signed checkpoint of a chain head (BIOLAB_ANCHOR_KEY). Keep it outside the database host; biolab verify-anchor out.json then detects tail truncation and full rewrites that the chain alone cannot see.
biolab run-tool <tool> -i '{...}' runs a registered tool (sequence_stats; mmseqs2_search when mmseqs is on PATH) and seals an immutable ExecutionRecord with content-addressed artifacts. biolab executions {list,show,verify,replay,artifact} inspects, verifies and replays them. If the record cannot be sealed, no result is returned.
- The Go port (
go-biolab/) writes the same v2 chain and has verify, anchor and verify-anchor; hashes are byte-compatible with Python and pinned by shared test vectors. The Go port does not implement the execution runtime.
Architecture
Design principles:
- Python + Go implementations (same interface, different runtimes)
- Shared core with CLI, MCP, REST, and web delivery surfaces
- Database, not log files — structured queries across time
- Hard-fail, never degrade — paper without
retrieval_id is worse than error
- Offline acceptance tests plus explicit live connector tests
- Single-writer queue, not row-level locking — simplest thing that keeps the hash chain consistent under concurrency
Development
Deployment
Student-cost path: local SQLite, the CLI, dashboard, MCP server, BioClaw
client, and Caddy gateway require no paid service. Free hosted tiers may also work,
but their quotas and persistence policies can change; verify them before relying on
a public deployment.
Roadmap
License
MIT — see LICENSE
Author
Srikar Jy — [email protected]