Skip to main content
Glama
UniProt MCP Server

UniProt MCP Server

by TakumiY235

UniProt MCP 服务器

一个模型上下文协议 (MCP) 服务器,提供对 UniProt 蛋白质信息的访问。该服务器允许 AI 助手直接从 UniProt 获取蛋白质功能和序列信息。

特征

  • 通过 UniProt 登录号获取蛋白质信息

  • 批量检索多种蛋白质

  • 缓存以提高性能(24 小时 TTL)

  • 错误处理和日志记录

  • 信息包括:

    • 蛋白质名称

    • 功能描述

    • 完整序列

    • 序列长度

    • 生物

Related MCP server: mcp-uniprot

快速入门

  1. 确保安装了 Python 3.10 或更高版本

  2. 克隆此存储库:

    git clone https://github.com/TakumiY235/uniprot-mcp-server.git
    cd uniprot-mcp-server
  3. 安装依赖项:

    # Using uv (recommended)
    uv pip install -r requirements.txt
    
    # Or using pip
    pip install -r requirements.txt

配置

添加到您的 Claude Desktop 配置文件:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "uniprot": {
      "command": "uv",
      "args": ["--directory", "path/to/uniprot-mcp-server", "run", "uniprot-mcp-server"]
    }
  }
}

使用示例

在 Claude Desktop 中配置服务器后,您可以提出以下问题:

Can you get the protein information for UniProt accession number P98160?

对于批量查询:

Can you get and compare the protein information for both P04637 and P02747?

API 参考

工具

  1. get_protein_info

    • 获取单个蛋白质的信息

    • 必需参数: accession (UniProt 登录号)

    • 响应示例:

      {
        "accession": "P12345",
        "protein_name": "Example protein",
        "function": ["Description of protein function"],
        "sequence": "MLTVX...",
        "length": 123,
        "organism": "Homo sapiens"
      }
  2. get_batch_protein_info

    • 获取多种蛋白质的信息

    • 必需参数: accessions (UniProt 登录号数组)

    • 返回蛋白质信息对象数组

发展

设置开发环境

  1. 克隆存储库

  2. 创建虚拟环境:

    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  3. 安装开发依赖项:

    pip install -e ".[dev]"

运行测试

pytest

代码风格

该项目使用:

  • 黑色表示代码格式

  • isort 用于导入排序

  • flake8 用于 linting

  • mypy 用于类型检查

  • 强盗进行安全检查

  • 依赖项漏洞检查的安全性

运行所有检查:

black .
isort .
flake8 .
mypy .
bandit -r src/
safety check

技术细节

  • 使用 MCP Python SDK 构建

  • 使用 httpx 进行异步 HTTP 请求

  • 使用基于 OrderedDict 的缓存实现 24 小时 TTL 的缓存

  • 处理速率限制和重试

  • 提供详细的错误消息

错误处理

服务器处理各种错误情况:

  • 无效的登录号(404 个响应)

  • API 连接问题(网络错误)

  • 速率限制(429 条回复)

  • 格式错误的响应(JSON 解析错误)

  • 缓存管理(TTL 和大小限制)

贡献

欢迎大家贡献代码!欢迎提交 Pull 请求。贡献方式如下:

  1. 分叉存储库

  2. 创建你的功能分支( git checkout -b feature/amazing-feature )

  3. 提交您的更改( git commit -m 'Add some amazing feature' )

  4. 推送到分支( git push origin feature/amazing-feature )

  5. 打开拉取请求

请确保适当更新测试并遵守现有的编码风格。

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

致谢

  • UniProt 提供蛋白质数据 API

  • Anthropic 的模型上下文协议规范

  • 帮助改进此项目的贡献者

Available Tools

2 tools
get_batch_protein_infoB

Get protein information for multiple accession No.

Inputs: accessions (required).

get_protein_infoB

Get protein function and sequence information from UniProt using an accession No.

Inputs: accession (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools have clearly distinct purposes: get_protein_info retrieves detailed function and sequence information for a single protein accession, while get_batch_protein_info handles multiple accessions in batch. There is no overlap or ambiguity in their functions.

    Naming Consistency5/5

    Both tools follow a consistent verb_noun pattern with 'get_' prefix and snake_case naming. The naming clearly indicates the action (get) and target (protein_info), with batch differentiation for the multi-accession tool.

    Tool Count2/5

    With only two tools, the server feels severely under-scoped for a UniProt domain. While the tools cover basic retrieval, there are obvious gaps for operations like searching, filtering, or accessing related data (e.g., taxonomy, structures), making the surface too thin for comprehensive protein information workflows.

    Completeness2/5

    The server is severely incomplete for UniProt functionality. It only provides protein information retrieval (single and batch), missing essential operations like search_by_keyword, get_taxonomy, get_structure, or update tracking. This will cause agent failures when trying to perform typical bioinformatics tasks beyond simple lookups.

    Maintenance

    ActivitySlowing
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Provides seamless access to UniProtKB protein database, enabling queries for protein entries, sequences, Gene Ontology annotations, full-text search, and ID mapping across 200+ database types.
      5
      49 PyPI
      2
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides access to UniProt protein sequence and function knowledge base, enabling search and retrieval of protein entries, proteomes, taxonomy, and feature annotations.
      82 npm
      MIT
    • F
      license
      B
      quality
      D
      maintenance
      Provides programmatic access to AlphaFold protein structure predictions and UniProt data, enabling users to retrieve protein structures, summaries, and annotations through natural language.
      3
      -