Skip to main content
Glama

PubTator-MCP-Server

MIT License
6
  • Linux
  • Apple

PubTator MCP 服务器

🔍 基于PubTator3的生物医学文献注释与关系挖掘服务器,通过MCP接口提供便捷的访问。

PubTator MCP 服务器通过模型上下文协议 (MCP) 为 AI 助手提供对 PubTator3 生物医学文献注释系统的访问,允许 AI 模型以编程方式搜索科学文献、获取注释信息并分析实体关系。

🤝 贡献 • 📝 报告问题

✨ 核心功能

  • 🔎 文献注释导出:支持多种格式导出 PubTator 注释结果✅
  • 🚀 实体 ID 查找:通过自由文本查询生物概念的标准标识符✅
  • 📊 关系挖掘:发现实体之间的生物医学关系✅
  • 📄 文献检索:支持通过关键词、实体ID检索文献✅
  • 🧠 批量处理:支持批量导出搜索结果的注释信息✅

🚀 快速入门

要求

  • Python 3.10+
  • FastMCP 库

安装

通过史密斯里

使用Smithery自动安装 PubTator Server:

克劳德
npx -y @smithery/cli@latest install @JackKuo666/pubtator-mcp-server --client claude --config "{}"
光标

粘贴到设置 → 光标设置 → MCP → 添加新服务器:

  • Mac/Linux
npx -y @smithery/cli@latest run @JackKuo666/pubtator-mcp-server --client cursor --config "{}"
风帆冲浪
npx -y @smithery/cli@latest install @JackKuo666/pubtator-mcp-server --client windsurf --config "{}"
克莱恩
npx -y @smithery/cli@latest install @JackKuo666/pubtator-mcp-server --client cline --config "{}"
手动安装
  1. 克隆存储库:
    git clone https://github.com/JackKuo666/PubTator-MCP-Server.git cd PubTator-MCP-Server
  2. 安装依赖项:
    pip install -r requirements.txt

📊 使用方法

直接运行服务器

启动 MCP 服务器:

python pubtator_server.py

该服务器现在支持 stdio 和 TCP 传输。默认情况下,它使用 TCP 传输。您可以配置以下环境变量:

  • MCP_TRANSPORT :设置为“tcp”表示 TCP 传输,或设置为“stdio”表示 stdio 传输(默认为“tcp”)
  • MCP_HOST :要绑定的主机(默认为“0.0.0.0”)
  • MCP_PORT :监听的端口(默认为 8080)

使用自定义设置启动服务器的示例:

MCP_TRANSPORT=tcp MCP_HOST=127.0.0.1 MCP_PORT=8888 python pubtator_server.py

该服务器实现了延迟初始化和适当的错误处理。它将优雅地处理关闭信号(SIGINT 和 SIGTERM),并记录启动或运行期间发生的任何错误。

使用 Docker

我们提供了 Dockerfile 以便于部署。要使用 Docker 容器,请执行以下操作:

  1. 构建 Docker 镜像:
    docker build -t pubtator-mcp-server .
  2. 运行 Docker 容器:
    docker run -p 8080:8080 pubtator-mcp-server

这将在 Docker 容器内启动 PubTator MCP 服务器,并将其公开在端口 8080 上。

故障排除

如果您在启动服务器时遇到任何问题:

  1. 检查控制台输出的错误消息。
  2. 确保安装了所有必需的依赖项(请参阅“要求”部分)。
  3. 验证环境变量是否设置正确。
  4. 如果服务器启动失败,请尝试以更高的详细程度运行它:
python -v pubtator_server.py

这将提供更详细的日志信息,以帮助识别任何问题的根源。

使用 Docker 时,您可以使用以下命令检查日志:

docker logs <container_id>

配置

Claude桌面配置

添加到claude_desktop_config.json

(Mac 操作系统)

{ "mcpServers": { "pubtator": { "command": "python", "args": ["-m", "pubtator-mcp-server"] } } }

(视窗)

{ "mcpServers": { "pubtator": { "command": "C:\\Users\\YOUR\\PATH\\miniconda3\\envs\\mcp_server\\python.exe", "args": [ "D:\\code\\YOUR\\PATH\\PubTator-MCP-Server\\pubtator_server.py" ], "env": {}, "disabled": false, "autoApprove": [] } } }
CLine配置
{ "mcpServers": { "pubtator": { "command": "bash", "args": [ "-c", "source /home/YOUR/PATH/mcp-server-pubtator/.venv/bin/activate && python /home/YOUR/PATH/pubtator_server.py" ], "env": { "MCP_TRANSPORT": "stdio" }, "disabled": false, "autoApprove": [] } } }

要使用 TCP 传输,请按如下方式修改配置:

{ "mcpServers": { "pubtator": { "command": "bash", "args": [ "-c", "source /home/YOUR/PATH/mcp-server-pubtator/.venv/bin/activate && python /home/YOUR/PATH/pubtator_server.py" ], "env": { "MCP_TRANSPORT": "tcp", "MCP_HOST": "127.0.0.1", "MCP_PORT": "8888" }, "disabled": false, "autoApprove": [] } } }

🛠 API 功能

PubTator MCP 服务器提供以下核心功能:

1. 导出出版物(export_publications)

导出指定 PMID 文献的 PubTator 注释结果:

result = await export_publications( ids=["32133824", "34170578"], id_type="pmid", format="biocjson", # Supported: pubtator, biocxml, biocjson full_text=False # Whether to include full text )

2. 实体ID查找(find_entity_id)

通过自由文本查询生物学概念的标准标识符:

result = await find_entity_id( query="COVID-19", concept="disease", # Optional: gene, disease, chemical, species, mutation limit=5 # Optional: limit number of results )

查找与指定实体相关的其他实体:

result = await find_related_entities( entity_id="@DISEASE_COVID_19", relation_type="treat", # Optional: treat, cause, interact, etc. target_entity_type="chemical", # Optional: gene, disease, chemical max_results=5 # Optional: limit number of results )

4.文献检索(search_pubtator)

搜索 PubTator 数据库:

results = await search_pubtator( query="COVID-19", max_pages=1 # Optional: maximum number of pages to retrieve )

检索并批量导出文献注释:

results = await batch_export_from_search( query="COVID-19", format="biocjson", max_pages=1, full_text=False, batch_size=5 )

注意:实际的函数调用可能因您的实现而异。这些示例基于我们最近的测试,可能需要进行调整以匹配您的具体 API。

⚠️ 使用限制

  • API请求速率限制:每秒最多3个请求
  • 批量导出时,使用合理的batch_size,避免请求超时
  • 对于关系查询,实体 ID 必须以“@”开头,例如“@DISEASE_COVID-19”

📄 许可证

该项目已获得 MIT 许可。

⚠️ 免责声明

此工具仅供研究之用。请遵守 PubTator 的服务条款并负责任地使用此工具。

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

🔍 基于PubTator3的生物医学文献注释与关系挖掘服务器,通过MCP接口提供便捷的访问。

  1. ✨ 核心功能
    1. 🚀 快速入门
      1. 要求
      2. 安装
    2. 📊 使用方法
      1. 直接运行服务器
      2. 使用 Docker
      3. 故障排除
      4. 配置
    3. 🛠 API 功能
      1. 1. 导出出版物(export_publications)
      2. 2. 实体ID查找(find_entity_id)
      3. 3. 关系查询(find_related_entities)
      4. 4.文献检索(search_pubtator)
      5. 5.批量导出(batch_export_from_search)
    4. ⚠️ 使用限制
      1. 📄 许可证
        1. ⚠️ 免责声明

          Related MCP Servers

          • -
            security
            A
            license
            -
            quality
            Server to search PubMed (PubMed is a free, online database that allows users to search for biomedical and life sciences literature). I have created on a day MCP came out but was on vacation, I saw someone post similar server in your DB, but figured to post mine.
            Last updated -
            1
            30
            Python
            MIT License
            • Apple
          • -
            security
            F
            license
            -
            quality
            An MCP server implementation that enables searching and retrieving research articles from PubMed with specific focus on open access content filtering and full-text link retrieval.
            Last updated -
            4
            3
            JavaScript
          • A
            security
            A
            license
            A
            quality
            Provides LLMs with structured access to critical biomedical databases including PubTator3 (PubMed/PMC), ClinicalTrials.gov, and MyVariant.info through the Model Context Protocol.
            Last updated -
            14
            237
            Python
            MIT License
            • Apple
            • Linux
          • A
            security
            A
            license
            A
            quality
            A comprehensive Model Context Protocol server that enables advanced PubMed literature search, citation formatting, and research analysis through natural language interactions.
            Last updated -
            12
            6
            Python
            MIT License

          View all related MCP servers

          MCP directory API

          We provide all the information about MCP servers via our MCP API.

          curl -X GET 'https://glama.ai/api/mcp/v1/servers/JackKuo666/PubTator-MCP-Server'

          If you have feedback or need assistance with the MCP directory API, please join our Discord server