biomed-mcp
Provides tools to search PubMed and retrieve abstracts with authors, journal, DOI, MeSH terms, keywords, and PubMed/PMC links via NCBI E-utilities.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@biomed-mcp Search PubMed for recent GLP-1 receptor agonist trials in obesity"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
biomed-mcp
An MCP server that gives LLM agents safe, typed, citable tools over public biomedical data: PubMed, ClinicalTrials.gov, UniProt and openFDA.
Not medical advice. biomed-mcp is a research and engineering tool. Its outputs are excerpts of public databases, which can be incomplete or out of date, and must not be used for diagnosis, treatment or other clinical decisions. See the disclaimer.
Why
LLM agents are increasingly asked biomedical questions: what a trial measures, what a protein does, what a drug label warns about, what the literature says. Answered from model memory alone, those answers can be stale, unverifiable or simply invented. Agents need grounded data with citations a human can check.
biomed-mcp exposes a small set of read-only tools over authoritative public sources through the Model Context Protocol, so any MCP client (Claude Desktop, Claude Code, IDE agents, custom agents) can:
search and read the primary record instead of guessing;
get compact, structured results (typed JSON with an output schema) that fit in a context window;
cite every claim, because every record carries a canonical URL;
recover from mistakes, because bad input and upstream failures come back as plain-language tool errors rather than crashes.
Related MCP server: Biomedical APIs MCP Server
Tools
Tool | Source | Returns |
| PubMed (NCBI E-utilities) | PMID, title, first authors, journal, date, DOI/PMCID, PubMed URL; total hit count and query translation |
| PubMed | Abstract (structured sections kept), authors, journal, DOI, MeSH terms, keywords, PubMed + PMC links |
| ClinicalTrials.gov API v2 | NCT ID, title, status, phases, conditions, interventions, sponsor, enrollment, key dates, registry URL |
| ClinicalTrials.gov API v2 | Summary, design, eligibility criteria, primary/secondary outcomes, collaborators, sites and countries (no contact details) |
| UniProtKB REST | Accession, entry name, protein and gene names, organism, length, UniProt URL |
| UniProtKB REST | Names and synonyms, gene, organism, mass, curated function (with PubMed citations), sequence (optionally truncated), FASTA URL |
| openFDA drug labels | Boxed warning, indications, dosage, contraindications, warnings; manufacturer, pharmacologic class, label date, DailyMed URL |
All tools are annotated readOnlyHint: true and publish JSON Schemas for both inputs (with ranges, enums and descriptions) and outputs.
Quickstart
You need uv. Nothing else: uv fetches a suitable Python (3.11+) and the dependencies.
Run straight from GitHub (no clone):
uvx --from git+https://github.com/tuigoku1212/biomed-mcp biomed-mcpThe server speaks MCP over stdio, so on its own it simply waits for a client. Normally your MCP client launches it for you, as configured below.
From a local clone:
git clone https://github.com/tuigoku1212/biomed-mcp.git
cd biomed-mcp
uv sync # create .venv and install dependencies
uv run biomed-mcp # start the stdio server
uv run python examples/direct_calls.py # call the tools directly, no MCP client needed
uv run pytest # offline test suiteTo poke at the tools interactively, the MCP Inspector works well: npx @modelcontextprotocol/inspector uv run biomed-mcp.
Claude Desktop
Add the server to claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\) and restart Claude Desktop:
{
"mcpServers": {
"biomed": {
"command": "uvx",
"args": ["--from", "git+https://github.com/tuigoku1212/biomed-mcp", "biomed-mcp"],
"env": {
"NCBI_EMAIL": "you@example.org"
}
}
}
}If Claude Desktop cannot find uvx, use its absolute path (which uvx). To run a local clone instead, use "command": "uv" with "args": ["--directory", "/path/to/biomed-mcp", "run", "biomed-mcp"].
Claude Code
claude mcp add biomed -- uvx --from git+https://github.com/tuigoku1212/biomed-mcp biomed-mcpPass environment variables with -e, for example claude mcp add biomed -e NCBI_EMAIL=you@example.org -- uvx --from git+https://github.com/tuigoku1212/biomed-mcp biomed-mcp.
Configuration
All settings are optional environment variables.
Variable | Effect |
| Sent to NCBI with every E-utilities request, as NCBI asks. Strongly recommended. |
| Raises the NCBI rate limit from 3 to 10 requests/second (free with an NCBI account; see API keys). |
| Raises openFDA's anonymous daily quota (get a key). |
ClinicalTrials.gov and UniProt need no credentials.
Example
An agent conversation (illustrative: the flow is real, but the IDs and numbers below are placeholders, not actual records):
User: What does the recent literature say about cytokine release syndrome with BCMA-directed CAR-T, and are any trials recruiting?
Agent calls
search_pubmed(query="BCMA CAR-T cytokine release syndrome", since_year=2022, sort="date", max_results=5)and receives five summaries, each with a PMID, journal, date andhttps://pubmed.ncbi.nlm.nih.gov/<PMID>/URL.Agent calls
get_pubmed_abstract(pmid="<PMID>")for the two most relevant hits and reads the BACKGROUND / METHODS / RESULTS / CONCLUSIONS sections before summarising.Agent calls
search_clinical_trials(condition="multiple myeloma", intervention="BCMA CAR-T", status=["RECRUITING", "NOT_YET_RECRUITING"])and receivestotal_count: <N>plus the first studies, each with phase, sponsor andhttps://clinicaltrials.gov/study/<NCT ID>.Agent answers with a short synthesis in which every statement carries a numbered citation, followed by the sources:
[1] https://pubmed.ncbi.nlm.nih.gov/<PMID>/·[2] …·[3] https://clinicaltrials.gov/study/<NCT ID>
A real tool result, from get_protein(accession="P01308", max_sequence_length=24) (function text shortened here):
{
"accession": "P01308",
"entry_name": "INS_HUMAN",
"reviewed": true,
"protein_name": "Insulin",
"gene": "INS",
"organism": "Homo sapiens",
"taxon_id": 9606,
"length": 110,
"url": "https://www.uniprot.org/uniprotkb/P01308/entry",
"source": "UniProt",
"alternative_names": [],
"gene_synonyms": [],
"mass_da": 11981,
"function": "Hormone secreted by pancreatic islet beta cells, that is the principal anabolic regulator of glucose, lipid, and protein metabolism … (PubMed:32291281) …",
"sequence": "MALWMRLLPLLALLALWGPDPAAA",
"sequence_truncated": true,
"fasta_url": "https://rest.uniprot.org/uniprotkb/P01308.fasta"
}Architecture
flowchart LR
client["MCP client<br/>Claude Desktop · Claude Code · agents"] -- "JSON-RPC over stdio" --> server["server.py<br/>FastMCP · tool registry · error guard"]
server --> pubmed["pubmed.py"]
server --> trials["clinicaltrials.py"]
server --> uniprot["uniprot.py"]
server --> openfda["openfda.py"]
pubmed -. "≤ 3 req/s (10 with key)" .-> limiter["ratelimit.py"]
pubmed & trials & uniprot & openfda --> http["_http.py<br/>timeouts · retries · error mapping"]
http --> apis[("NCBI E-utilities · ClinicalTrials.gov v2<br/>UniProt REST · openFDA")]src/biomed_mcp/
├── server.py # thin: registers the tool functions with FastMCP, runs stdio
├── pubmed.py # esearch + esummary, efetch (XML) for abstracts
├── clinicaltrials.py # /api/v2/studies search and single-study lookup
├── uniprot.py # /uniprotkb/search and /uniprotkb/{accession}
├── openfda.py # /drug/label.json lookup and best-label ranking
├── _http.py # shared client factory, retries, HTTP status → error mapping
├── ratelimit.py # asyncio rate limiter used for NCBI
├── _text.py # whitespace cleanup and truncation helpers
└── errors.py # BiomedError → InvalidInputError / NotFoundError / UpstreamErrorEach data source is one self-contained module of plain async functions. A function's signature (with Annotated pydantic constraints) becomes the tool's input schema, its docstring becomes the tool description, and its pydantic return model becomes the output schema. server.py only registers them, so the same functions are usable directly from Python (see examples/direct_calls.py).
Design notes
Rate limiting. NCBI allows 3 requests/second without an API key and 10 with one. A process-wide limiter hands out evenly spaced time slots (no locks, safe under concurrent tool calls), and the rate switches automatically when
NCBI_API_KEYis set. Every request identifies the client withtool=biomed-mcpand, if configured,email.Retries and timeouts. Each source has its own timeout (15 to 20 s, 5 s to connect). HTTP 429 and 5xx responses are retried at most twice with exponential backoff, honouring
Retry-After. Everything else fails fast.Compact output. Searches return summaries; detail tools return one record. Long text (abstracts, eligibility criteria, label sections, function annotations) is truncated at a word boundary with an explicit
… [truncated, N more characters]marker, and lists are capped (authors, outcomes, sites). Where the API supports it, only the needed fields are requested (UniProtfields, ClinicalTrials.govfields), which also keeps responses small.Citations. Every record includes a canonical
url(PubMed, ClinicalTrials.gov, UniProt, DailyMed); searches add asearch_urlthat reproduces the query on the source website, and PubMed records include DOI and a PubMed Central link when free full text exists.Error handling. Expected failures raise typed
BiomedErrors whose messages are written for the model: which source failed, why, and what to try next (for example, "'EGFR' is not a UniProtKB accession … Use search_proteins to look up a protein or gene name"). MCP clients receive them asisError: truetool results. Unexpected exceptions are logged and returned as a clear internal-error message instead of a stack trace.Input validation. The same
Annotatedconstraints are enforced whether a tool is called through MCP (FastMCP's argument model) or directly from Python (pydantic.validate_call), and they are published in the input schema so the model can see them up front. Identifiers are checked against their official formats (PMID, NCT ID, UniProt accession) before any request is made, and drug names are allow-listed so they cannot inject openFDA query syntax.Safety and privacy. All tools are read-only. XML is parsed with
defusedxml. Trial records are returned without investigator or site contact details. Error messages never echo request URLs, and the HTTP client's URL logging is silenced, so API keys sent as query parameters do not end up in transcripts or client logs.Simplicity over cleverness. Each tool call uses a short-lived HTTP client: no shared state to manage across event loops, and the cost is negligible at agent call rates. Caching and connection pooling are on the roadmap.
Development
uv sync # install runtime + dev dependencies
uv run ruff check . # lint
uv run ruff format --check . # formatting
uv run pytest # offline tests (HTTP mocked with respx)
uv run pytest --live -m live # optional smoke test against the real APIsThe test suite runs fully offline. Fixtures in tests/fixtures/ are trimmed real responses from ClinicalTrials.gov, UniProt and openFDA (contact details removed); the PubMed fixtures reproduce the documented E-utilities formats with synthetic records. CI runs lint, format and tests on Python 3.11, 3.12 and 3.13.
Roadmap
Europe PMC: full-text search and retrieval for open-access articles
ChEMBL: compounds, bioactivity, mechanisms of action and targets
RCSB PDB: structure search and entry metadata
Response caching (TTL, optional on-disk) and pooled connections
Streamable HTTP transport for remote / multi-user deployment
openFDA adverse events (FAERS) and recalls
Pagination for search tools
Migrate to MCP Python SDK v2 (
MCPServer)Publish to PyPI
Contributing
Issues and pull requests are welcome. To add a data source:
Create one module under
src/biomed_mcp/with async functions whoseAnnotatedsignatures and docstrings read well as tool schemas and descriptions, and pydantic return models that include aurlfor citation.Route HTTP through
_http.getso timeouts, retries and error messages stay consistent.Add trimmed fixtures captured from real responses to
tests/fixtures/, with offline tests for parsing, validation and error paths.Register the functions in
server.TOOLSand document them in the tools table above.
Please run uv run ruff check . && uv run ruff format --check . && uv run pytest before opening a pull request, and add an entry to CHANGELOG.md.
License
MIT © 2026 tuigoku1212
Disclaimer
biomed-mcp is provided for research and educational use only. It is not a medical device and does not provide medical advice. Tool outputs are automated, possibly truncated excerpts of third-party databases that may be incomplete, outdated or wrong, and they can be misread by both people and language models. Always verify information against the primary source and consult qualified healthcare professionals for medical decisions.
This project is not affiliated with or endorsed by the U.S. National Library of Medicine, NCBI, ClinicalTrials.gov, the UniProt Consortium or the U.S. Food and Drug Administration. Use of each data source is subject to its own terms; see NCBI, ClinicalTrials.gov, UniProt and openFDA.
Available Tools
7 toolsget_clinical_trialGet clinical trialARead-onlyIdempotent
Get the key details of one ClinicalTrials.gov study by its NCT ID.
Returns the summary fields plus official title, brief summary, design (allocation, masking, purpose), eligibility criteria, primary and secondary outcomes, collaborators, results availability and up to 10 study sites with countries. Long text is truncated; the registry URL has the complete record.
Inputs: nct_id (required). Returns: Result of :func:`get_clinical_trial`.
get_drug_labelGet FDA drug labelARead-onlyIdempotent
Get FDA prescribing-label sections for a drug from openFDA.
Looks the name up across brand, generic and active-substance names and picks the best label
(exact name match, single-ingredient products and the most recent version are preferred).
Returns boxed warning, indications and usage, dosage and administration, contraindications
and warnings, each truncated to max_section_chars, plus manufacturer, pharmacologic class
and a DailyMed URL to cite. Labels are regulatory text, not treatment advice.
Inputs: drug_name (required), max_section_chars. Returns: Result of :func:`get_drug_label`.
get_proteinGet UniProt proteinARead-onlyIdempotent
Get one UniProtKB protein entry by accession: names, gene, organism, function, sequence.
Returns the recommended and alternative protein names, gene name and synonyms, organism,
length, mass, the curated function summary (with PubMed citations) and the sequence
(truncated to max_sequence_length; check sequence_truncated). Find accessions with
search_proteins.
Inputs: accession (required), include_sequence, max_sequence_length. Returns: Result of :func:`get_protein`.
get_pubmed_abstractGet PubMed abstractARead-onlyIdempotent
Fetch the title, abstract and key metadata of one PubMed article by its PMID.
Use after search_pubmed to read what a paper actually reports. Returns the abstract (with
structured-abstract section labels; very long abstracts are truncated), authors, journal,
date, DOI, MeSH terms and keywords, the PubMed URL to cite, and a PubMed Central link when
free full text exists.
Inputs: pmid (required). Returns: Result of :func:`get_pubmed_abstract`.
search_clinical_trialsSearch ClinicalTrials.govARead-onlyIdempotent
Search ClinicalTrials.gov for registered clinical studies.
Filter by condition, intervention and recruitment status (e.g. RECRUITING). At least one of
condition, intervention or term is required. Returns compact summaries: NCT ID, title,
status, phases, conditions, interventions, lead sponsor, enrollment and key dates, each with a
registry URL to cite. Call get_clinical_trial for eligibility criteria, outcomes and sites.
Inputs: term, status, condition, max_results, +1 more. Returns: Result of :func:`search_clinical_trials`.
search_proteinsSearch UniProt proteinsARead-onlyIdempotent
Search UniProtKB for proteins by name, gene, keyword or function.
Returns accession, entry name, protein and gene names, organism and sequence length for each
hit, with a UniProt URL to cite. Restricting to an organism (e.g. 'Homo sapiens') and to
reviewed Swiss-Prot entries gives far cleaner results. Use get_protein with an accession
for the function summary and sequence.
Inputs: query (required), organism, max_results, reviewed_only. Returns: Result of :func:`search_proteins`.
search_pubmedSearch PubMedARead-onlyIdempotent
Search PubMed for biomedical literature and return compact, citable article summaries.
Use this to find papers about a disease, drug, gene, target, method or author. Each result
has the PMID, title, first authors, journal, publication date, DOI/PMCID and a PubMed URL to
cite. Summaries do not include abstracts: call get_pubmed_abstract with a PMID before
making claims about what a paper found.
Inputs: query (required), sort, since_year, max_results. Returns: Result of :func:`search_pubmed`.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool targets a distinct resource and action, with clear search/get pairings across proteins, PubMed, and clinical trials plus a standalone drug label lookup. Descriptions explicitly direct agents from search tools to the corresponding get tool, removing overlap.
All seven tools follow a consistent snake_case verb_noun pattern: search_pubmed, get_pubmed_abstract, search_proteins, get_protein, search_clinical_trials, get_clinical_trial, get_drug_label. The convention is predictable throughout.
Seven tools is well-scoped for a biomedical data server spanning literature, proteins, trials, and drug labels. Each tool has a clear role and none appear redundant.
The search/get pattern provides solid lifecycle coverage for PubMed, UniProt, and ClinicalTrials.gov, with no obvious dead ends for those workflows. The main gap is drug-related coverage: only get_drug_label exists, with no drug search, adverse-event, or interaction lookup tools.
Maintenance
Related MCP Connectors
Search 36M+ PubMed biomedical articles and ClinicalTrials.gov studies.
Search biomedical papers, inspect publication records, and traverse citation or semantic graphs.
Linked life-science search: 43M+ papers, 1.2M+ trials, drugs, genes, FDA/EMA approvals, patents.
Search and organize data over millions of full-text papers, trials, FDA documents, and patents
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables LLMs to search FDA drug labels and adverse event data via the OpenFDA API, supporting natural language queries for drug safety information.2MIT
- FlicenseBqualityDmaintenanceEnables AI agents to query free biomedical and pharmaceutical APIs for clinical trials, drug data, molecular structures, adverse events, and research literature.14-
- AlicenseAqualityCmaintenanceEnables agents to search a public PubMed-derived corpus by natural language or identifiers and to retrieve publication details while traversing bounded citation and semantic literature graphs.7Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to resolve genes, diseases, chemicals, variants and species to normalized ids, search ~36M PubMed abstracts and PMC full texts by free text or entity, and retrieve the machine-extracted relations between them with the supporting sentences and PMIDs. Supports auditing individual relations with full evidence passages and pulling per-article entity annotations with character offsets.55 npmMIT