PubTator-MCP-Server
PubTator MCP 服务器
🔍 基于PubTator3的生物医学文献注释与关系挖掘服务器,通过MCP接口提供便捷的访问。
PubTator MCP 服务器通过模型上下文协议 (MCP) 为 AI 助手提供对 PubTator3 生物医学文献注释系统的访问,允许 AI 模型以编程方式搜索科学文献、获取注释信息并分析实体关系。
🤝 贡献 • 📝 报告问题
✨ 核心功能
🔎 文献注释导出:支持多种格式导出 PubTator 注释结果✅
🚀 实体 ID 查找:通过自由文本查询生物概念的标准标识符✅
📊 关系挖掘:发现实体之间的生物医学关系✅
📄 文献检索:支持通过关键词、实体ID检索文献✅
🧠 批量处理:支持批量导出搜索结果的注释信息✅
Related MCP server: pubmed-search
🚀 快速入门
要求
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 "{}"手动安装
克隆存储库:
git clone https://github.com/JackKuo666/PubTator-MCP-Server.git cd PubTator-MCP-Server安装依赖项:
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 容器,请执行以下操作:
构建 Docker 镜像:
docker build -t pubtator-mcp-server .运行 Docker 容器:
docker run -p 8080:8080 pubtator-mcp-server
这将在 Docker 容器内启动 PubTator MCP 服务器,并将其公开在端口 8080 上。
故障排除
如果您在启动服务器时遇到任何问题:
检查控制台输出的错误消息。
确保安装了所有必需的依赖项(请参阅“要求”部分)。
验证环境变量是否设置正确。
如果服务器启动失败,请尝试以更高的详细程度运行它:
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
)3. 关系查询(find_related_entities)
查找与指定实体相关的其他实体:
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
)5.批量导出(batch_export_from_search)
检索并批量导出文献注释:
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 的服务条款并负责任地使用此工具。
This server cannot be deployed
Maintenance
Related MCP Connectors
PubTator 3 MCP — biomedical entity search, literature search with entity highlighting, and…
Auditable MCP server for PubMed, Europe PMC, ClinicalTrials.gov, and bioRxiv/medRxiv queries
MCP gateway federating 22 biomedical MCP servers behind one endpoint: gnomAD, ClinVar, HPO, VEP.
PubMed MCP — wraps the NCBI E-utilities API (biomedical literature, free, no auth)
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides comprehensive access to NCBI's PubMed database of over 36 million biomedical citations, allowing users to search, retrieve, and analyze literature directly through MCP tools. It supports advanced queries, citation management, full-text retrieval from PubMed Central, and precise discovery using MeSH terms.1615MIT
- AlicenseNot gradedqualityFmaintenanceMCP server for PubMed search and literature summarization52MIT
- AlicenseBqualityDmaintenanceThis MCP server provides 16 intelligent tools for searching, retrieving, and linking biomedical literature from PubMed and PMC. It enables LLM applications to perform complex queries, batch processing, and cross-database linking.168MIT
- AlicenseAqualityDmaintenanceA lightweight MCP server for clinical biomedical literature retrieval, enabling PubMed search, article metadata, full-text access, and evidence summarization through MCP-compatible clients.10MIT