UniProt MCP Server
mcp-name: io.github.josefdc/uniprot-mcp
The UniProt MCP server exposes curated UniProtKB data as Model Context Protocol (MCP) resources, tools, and prompts. It allows MCP-compatible agents to fetch protein entries, sequences, Gene Ontology annotations, and identifier mappings from the UniProt REST API through a consistent, typed interface.
Features
- Protocols: Supports both stdio (development) and streamable HTTP (remote deployments with proper CORS headers).
- Resources:
uniprot://uniprotkb/{accession}provides raw entry JSON;uniprot://help/searchdocuments query syntax. - Tools: Structured outputs for
fetch_entry,get_sequence,search_uniprot, andmap_ids(with progress notifications). - Prompts: Built-in prompt for summarising a UniProt accession.
- Retries & resilience: Tenacity-based retries for 429/5xx responses, progress reporting for long-running mapping tasks, and defensive parsing of UniProt payloads.
Installation
pip install uniprot-mcp
Quickstart
Stdio server (development / MCP Inspector)
uniprot-mcp
This launches the stdio transport (the same entry point MCP Inspector uses).
Streamable HTTP server
uniprot-mcp-http --host 0.0.0.0 --port 8000
The server exposes a health check at /healthz and the MCP endpoint at /mcp.
Browser clients can read the Mcp-Session-Id response header because the
server is configured with permissive CORS defaults.
If prometheus-client is installed (included by default), metrics are served at /metrics.
Available MCP primitives
Resources
uniprot://uniprotkb/{accession}– returns raw UniProtKB entry JSON.uniprot://help/search– simple usage guide forsearch_uniprot.
Tools
| Tool | Description |
|---|---|
fetch_entry(accession, fields=None) |
Fetch a UniProtKB entry and return a typed payload (Entry). Versioned entries require fetch_entry_flatfile. |
get_sequence(accession) |
Fetch minimal sequence metadata (Sequence). |
search_uniprot(query, size=10, reviewed_only=False, fields=None, sort=None, include_isoform=False) |
Search UniProtKB and return a list of hits (SearchHit). |
map_ids(from_db, to_db, ids) |
Submit/poll UniProt ID mapping jobs with progress reporting (MappingResult). |
fetch_entry_flatfile(accession, version, format="txt") |
Return a historical flatfile (txt or fasta) for a UniProt entry version. |
Prompts
- Summarize Protein – prompts an agent to summarise a UniProt accession, optionally including organism, GO annotations, and notable features.
Environment variables and CLI flags
| Variable | Default | Description |
|---|---|---|
UNIPROT_ENABLE_FIELDS |
unset | When set, the server requests minimal field subsets from UniProt (reduces payload size). |
MCP_HTTP_HOST |
0.0.0.0 |
Bind host for uniprot-mcp-http (can also use --host). |
MCP_HTTP_PORT |
8000 |
Bind port for uniprot-mcp-http (or --port). |
MCP_HTTP_LOG_LEVEL |
info |
Log level for uvicorn (or --log-level). |
MCP_HTTP_RELOAD |
0 |
Enable auto-reload for uniprot-mcp-http when set to 1/true (or pass --reload). |
UNIPROT_LOG_LEVEL |
info |
Application log level (debug, info, warning, error). |
UNIPROT_LOG_FORMAT |
plain |
Log output format (plain or json). |
UNIPROT_MAX_CONCURRENCY |
8 |
Maximum concurrent outbound UniProt requests. |
MCP_CORS_ALLOW_ORIGINS |
* |
Override CORS origins (comma-separated) for HTTP transport. |
MCP_CORS_ALLOW_METHODS |
GET,POST,DELETE |
Allowed methods for CORS preflight. |
MCP_CORS_ALLOW_HEADERS |
* |
Allowed request headers for CORS. |
Every HTTP response includes X-Request-Id. Forward this header in client requests to correlate logs across transports.
Development
The project is managed with uv.
# Install dependencies
uv sync --group dev
# Lint & format check
uv tool run ruff check .
uv tool run ruff format --check .
# Type check
uv tool run mypy src
# Run tests (with coverage)
uv run pytest --maxfail=1 --cov=uniprot_mcp --cov-report=term-missing
# Launch stdio server for local inspection
uv run uniprot-mcp
# Launch HTTP server with auto-reload
uv run python -m uvicorn uniprot_mcp.http_app:app --reload
Publishing & MCP Registry
- Build artifacts:
uv build - Publish to PyPI:
uv publish --token $PYPI_TOKEN - Prepare/validate
server.json(seedocs/registry.mdfor the schema link). - Use
mcp-publisherto publish the server metadata, optionally linking a remote HTTP deployment.
Support & Compatibility
- Python 3.11 and 3.12 are tested in CI.
- External dependencies are pinned via
uv.lock. - Issues and feature requests: GitHub Issues
License
Distributed under the MIT License. See LICENSE for details.
Release files for uniprot-mcp 0.1.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 | |
|---|---|---|---|
| uniprot_mcp-0.1.0.tar.gz | 21.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| uniprot_mcp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.2 kB
Release files / uniprot_mcp-0.1.0.tar.gz
| Download URL | uniprot_mcp-0.1.0.tar.gz |
|---|---|
| Size | 21.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1907ba966d68b3fbc2423b90a942adac815ed0669ea4a45b7f075e1001309f0a
|
|
BLAKE2b-256 checksum How to use checksums |
dce1cf833f07c068476ed2a101ba4f93ff4f2501837fc91ca69843e80c86eb55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.22
|
Release files / uniprot_mcp-0.1.0-py3-none-any.whl
| Download URL | uniprot_mcp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 22.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
894be4f31961fdbd8e0f1ef7b70d496041688aef4a83fd1fe2ce77fbe7192bb8
|
|
BLAKE2b-256 checksum How to use checksums |
e99aea66257e567527c5e63db1e67e34f794c31665fdb38b4817b0a9ce67f321
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.22
|