使用说明
dora_mcp
MCP(模型上下文协议)服务器 多拉 科学出版物库。通过标准HTTP流传输(用于Copilot Studio和其他web客户端)公开两个工具——搜索和抽象检索。
需求
- Python 3.10+
- 紫外线 包管理器
快速开始
# Install dependencies
uv sync
# Setup environment (optional)
# Linux/macOS: cp .env.example .env
# Windows: copy .env.example .env
# Run the server (defaults to http mode)
uv run dora_mcp
注: 服务器还支持实验
stdio模式。编辑.env要切换到的文件stdio或更改端口。打开 http://localhost:8000 如果以HTTP模式运行,则用于登录页面和Swagger UI。
MCP工具
| 工具 | 说明 |
|---|---|
search_publications |
按关键字或作者姓名搜索DORA |
get_publication_abstract |
按ID或URL获取出版物的摘要 |
search_publications
{
"search_string": "manfred heuberger",
"limit": 10
}
使用简短的关键字或作者姓名(1-3个单词)。搜索标题、摘要、作者和其他具有加权相关性的元数据。 limit 是可选的(默认值为20)。
get_publication_abstract
{ "identifier_or_url": "empa:27842" }
接受完整URL(https://www.dora.lib4ri.ch/empa/item/empa:27842)或者仅仅是发布标识符。
连接AI客户端
微软复制品工作室
- 启用 生成式编排 在您的代理设置中。
- 工具 → 添加工具 → 新工具 → 模型上下文协议
- 服务器URL:
https://your-app-name.fly.dev/mcp--身份验证:无 - 选择 创建那么 添加到代理.
或者导入 api/openapi-copilot-studio.yaml 作为自定义连接器
(添加工具→ 新工具→ 自定义连接器→ 导入OpenAPI文件).
REST API
| 方法 | 路径 | 描述 |
|---|---|---|
| 得到 | / |
登录页面 |
| 得到 | /docs |
Swagger用户界面 |
| 得到 | /health |
健康检查 |
| 得到 | /tools |
列出MCP工具(JSON) |
| 职位 | /api/search |
搜索--正文: {"search_string": "…", "limit": 10} |
| 职位 | /api/abstract |
摘要——正文: {"identifier_or_url": "empa:…"} |
| 获取/发布 | /mcp |
MCP JSON-RPC端点 |
OpenAPI规范在 /api/openapi.yaml (REST)和 /api/openapi-copilot-studio.yaml (复制工作室)。
码头工人
./docker.sh build # build image
./docker.sh start # start container (http://localhost:8000)
./docker.sh stop # stop container
./docker.sh logs # view logs
./docker.sh status # check status
./docker.sh rebuild # rebuild + restart
./docker.sh clean # remove everything
或者直接用docker编写:
docker-compose up -d
编辑 docker-compose.yml 更改端口或环境变量。
Fly.io部署
flyctl launch # first deploy (detects fly.toml automatically)
flyctl deploy # redeploy after changes
flyctl logs # view logs
flyctl status # check status
已部署的应用程序可在以下网址获得 https://your-app-name.fly.dev.
发展
测试
uv run pytest tests/ -v # all tests
uv run pytest tests/test_server.py -v # unit tests
uv run pytest tests/test_docker.py -v # Docker tests (container must be running)
python tests/test_mcp_endpoint.py http://localhost:8000 # live endpoint check
python tests/test_search.py "manfred heuberger" # manual search test
项目布局
src/dora_mcp/
server.py # all server logic (MCP tools, HTTP routes)
templates/
index.html # landing page template
api/
openapi.yaml # Swagger 2.0 REST spec
openapi-copilot-studio.yaml # Copilot Studio spec
tests/
test_server.py # unit tests
test_docker.py # Docker container tests
test_mcp_endpoint.py # live endpoint smoke test
test_search.py # manual search script
可能的扩展
- Claude桌面集成: 虽然没有明确测试,但该服务器理论上应该支持Claude Desktop。您可以尝试使用指向的标准HTTP传输来集成它
/mcp,或通过使用实验stdio模式在你的claude_desktop_config.json:"mcpServers": { "dora": { "command": "uv", "args": ["run", "dora_mcp"], "cwd": "/path/to/dora_mcp", "env": { "MCP_TRANSPORT": "stdio" } } } - 高级元数据: 支持直接在搜索结果中获取更详细的元数据,如DOI、出版年份或卷/期信息。
- 改进的缓存: 为频繁请求的搜索词或摘要实现缓存层(例如Redis)。
许可证
看 许可证.