fhir-mcp服务器medagentbench
](https://badge.fury.io/py/fhir-mcp-server-medagentbench) 
基于Python的MCP(MedAgentBench通信协议)服务器,专为MedAgentBenck环境设计。此服务器 模拟 与FHIR(快速医疗保健互操作性资源)API的交互。
它不是向Contoso服务器发出实际的HTTP请求,而是拦截用于Contoso操作的MCP请求,并返回HTTP请求的文本表示 *会* 已经完成(例如。, GET https://fhir.example.com/Patient/123 或 POST https://fhir.example.com/Observation\n{...}).这允许测试MedAgentBench代理,而不需要实时的kubectl端点。
特性
- 实现MCP处理程序:
- list_resources:列出可用的模拟资源(当前 CapabilityStatement). - read_resource:通过其URI模拟读取一个Contoso资源。 - list_tools:列出可用的Contoso仿真工具。 - call_tool:模拟执行Contoso操作: - search_fhir:模拟搜索Contoso资源。 - read_fhir:模拟通过URI读取特定的Contoso资源。 - create_fhir_resource:模拟创建新的Contoso资源。
- 用途
mcp-serverMCP通信库。 - 使用Poetry配置和打包。
- 包括异步单元测试
pytest和pytest-asyncio.
安装
确保您安装了Python>=3.10和Poetry。
poetry install配置
在运行服务器之前,您必须设置 FHIR_BASE_URL 环境变量。此URL用于构造模拟请求字符串。
export FHIR_BASE_URL="https://your-fhir-server-base.com/fhir"
# Or for local testing:
# export FHIR_BASE_URL="http://localhost:8080/fhir"用法
配置后,使用安装的脚本运行服务器:
fhir-mcp-server-medagentbench服务器将开始通过标准输入/输出监听MCP请求。
发展
设置
克隆存储库并安装依赖项,包括开发工具:
git clone https://github.com/MikeHolcomb/mcp-fhir-python-medagentbench.git
cd mcp-fhir-python-medagentbench
poetry install --with dev装订和格式化
此项目使用 pre-commit 强制执行代码样式(black, isort)并检查问题(flake8, mypy).
# Run all checks on staged files (usually run automatically on commit)
poetry run pre-commit run
# Run all checks on all files
poetry run pre-commit run --all-files
# Or run tools individually
poetry run black .
poetry run isort .
poetry run flake8 src tests
poetry run mypy src测试
测试位于 tests/ 目录和使用 pytest.
poetry run pytest
# Run with coverage report
poetry run pytest --cov=src测试要求 pytest-asyncio 由于MCP处理程序的异步特性。
许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息(如果不存在,可能需要创建LICENSE文件)。
贡献
欢迎投稿!请打开问题或提交拉取请求。
