uniprot-mcp

uniprot-mcp

MCP server that exposes the UniProt REST API to LLM clients, enabling search and retrieval of protein data via tools like search_uniprotkb, get_entry, and map_ids.

Category
访问服务器

README

uniprot-mcp

CI PyPI Python MCP Badge

GitHub repo: fzlzjerry/uniprot-mcp · PyPI package & command: uniprotkb-mcp (the Python import package is uniprot_mcp).

A production-quality MCP server that exposes the UniProt REST API to LLM clients (Claude Code, Claude Desktop, …) over stdio. Built with FastMCP and managed with uv.

Tools return compact, token-efficient summaries by default and full payloads only on request, with robust error handling and an embedded UniProt query cheat-sheet so the model writes valid queries.

Quick start

Published on PyPI — no clone, no install needed:

uvx uniprotkb-mcp

Then point your MCP client at it (full config below):

{
  "mcpServers": {
    "uniprot": {
      "command": "uvx",
      "args": ["uniprotkb-mcp"],
      "env": { "UNIPROT_MCP_CONTACT": "you@example.org" }
    }
  }
}

Tools

Tool What it does
search_uniprotkb Search UniProtKB with native query syntax. reviewed / organism_id filters are added for you. Summary, FASTA, or TSV output.
get_entry One entry as a curated digest (function, names, organism, length, subcellular location, family/domains, key features, PTMs, keywords, PDB/AlphaFold/Ensembl/RefSeq/InterPro/GO cross-refs) or json/fasta/txt/gff.
get_fasta Raw FASTA for one accession or a batch.
map_ids Convert ids across databases via UniProt's async ID-mapping (e.g. RefSeq_ProteinUniProtKB, UniProtKB_AC-IDPDB). Returns mapped pairs and unmapped ids; validates the db pair against the live config.
get_taxonomy Resolve an organism name or taxon id → taxon id, names, rank, lineage. Turn "human" into organism_id:9606.
search_uniref Search UniRef100/90/50 sequence-similarity clusters.
search_proteomes Search proteomes (whole-organism protein sets); reference-proteome filter.

Plus an MCP resource resource://uniprot/query-cheatsheet documenting the UniProtKB query syntax (gene:, organism_id:, reviewed:true, length:[X TO Y], keyword:, ec:, boolean AND/OR/NOT, …).

Requirements

  • Python ≥ 3.10 (the repo pins 3.13 via .python-version)
  • uv

Install

git clone https://github.com/fzlzjerry/uniprot-mcp
cd uniprot-mcp
uv sync                 # creates .venv and installs fastmcp + httpx

Run

# stdio server (what MCP clients launch):
uv run uniprotkb-mcp

UniProt asks API clients to identify themselves with a contact address. Set one via the UNIPROT_MCP_CONTACT environment variable (it goes into the User-Agent); otherwise a placeholder is used.

UNIPROT_MCP_CONTACT="you@example.org" uv run uniprotkb-mcp

Run with uvx (no clone / no sync)

uvx (a.k.a. uv tool run) fetches, builds, and runs the console script in a throwaway environment — nothing to install first. Pick whichever source you have:

# From PyPI (published):
uvx uniprotkb-mcp

# From a Git repo (note: repo is uniprot-mcp, command is uniprotkb-mcp):
uvx --from git+https://github.com/fzlzjerry/uniprot-mcp uniprotkb-mcp

# From a local checkout (this directory):
uvx --from /ABSOLUTE/PATH/TO/uniprot-mcp uniprotkb-mcp

# From a built wheel:
uvx --from ./dist/uniprotkb_mcp-0.1.0-py3-none-any.whl uniprotkb-mcp

Pin a version with uvx uniprotkb-mcp@0.1.0, or force a refresh of the cached build with uvx --refresh --from <source> uniprotkb-mcp.

Register with Claude Desktop

Edit claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json, Windows: %APPDATA%\Claude\claude_desktop_config.json) and add:

{
  "mcpServers": {
    "uniprot": {
      "command": "uvx",
      "args": ["uniprotkb-mcp"],
      "env": { "UNIPROT_MCP_CONTACT": "you@example.org" }
    }
  }
}

This runs the published package straight from PyPI. To run unreleased code instead, add a source: "args": ["--from", "git+https://github.com/fzlzjerry/uniprot-mcp", "uniprotkb-mcp"] (git) or "args": ["--from", "/ABSOLUTE/PATH/TO/uniprot-mcp", "uniprotkb-mcp"] (local checkout). Make sure uvx is on the PATH Claude Desktop sees (it ships with uv; give the absolute path to uvx if needed, e.g. ~/.local/bin/uvx). Restart Claude Desktop and the uniprot tools appear.

Prefer a cloned checkout instead of uvx? Use "command": "uv", "args": ["run", "--directory", "/ABSOLUTE/PATH/TO/uniprot-mcp", "uniprotkb-mcp"].

Register with Claude Code

Project-scoped via a .mcp.json in your project root (same shape):

{
  "mcpServers": {
    "uniprot": {
      "command": "uvx",
      "args": ["uniprotkb-mcp"],
      "env": { "UNIPROT_MCP_CONTACT": "you@example.org" }
    }
  }
}

Or from the CLI:

# via uvx (published / git / local source):
claude mcp add uniprot -e UNIPROT_MCP_CONTACT=you@example.org -- uvx uniprotkb-mcp

# via a local checkout with uv:
claude mcp add uniprot -e UNIPROT_MCP_CONTACT=you@example.org \
  -- uv run --directory /ABSOLUTE/PATH/TO/uniprot-mcp uniprotkb-mcp

Smoke test

Exercises every tool against the live API and prints the output:

UNIPROT_MCP_CONTACT="you@example.org" uv run python -m tests.smoke

Development

Developing, testing, CI, and the release process (CI-driven PyPI Trusted Publishing — no token) are documented in CONTRIBUTING.md. TL;DR: uv sync, then uv run python -m tests.check_structure (offline) and uv run python -m tests.smoke (live API).

Design notes

  • Single shared httpx.AsyncClient with a descriptive User-Agent including your contact.
  • Retry/backoff on 429 (honoring Retry-After) and 5xx; 400 surfaces UniProt's own error message; no raw tracebacks reach the client (errors are raised as ToolError).
  • Pagination via the Link header / x-total-results; result sizes are capped (≤ 500) and the total is always reported so you can narrow or page.
  • ID mapping follows the real async flow: POST /idmapping/run → poll /idmapping/status/{job} (a 303 + Location signals completion) → fetch results, automatically choosing the enriched UniProtKB results endpoint vs. the simple-pair endpoint based on the target database.

Project layout

src/uniprot_mcp/
  server.py       # FastMCP instance, the 7 tools, cheat-sheet resource, main()
  client.py       # shared AsyncClient, retry/backoff, error mapping, header parsing
  idmapping.py    # async run/poll/results flow with target-aware routing
  config.py       # cached idmapping db config + from/to validation
  formatting.py   # JSON -> compact summary digests
  cheatsheet.py   # UniProt query cheat-sheet
tests/smoke.py    # live-API smoke test

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选