fhir-mcp-server-medagentbench
An implementation of Model Context Protocol server for use with MedAgentBench (FHIR request generation)
mike-holcomb
README
fhir-mcp-server-medagentbench
A Python-based MCP (MedAgentBench Communications Protocol) server designed for the MedAgentBench environment. This server simulates interactions with a FHIR (Fast Healthcare Interoperability Resources) API.
Instead of making actual HTTP requests to a FHIR server, it intercepts MCP requests for FHIR operations and returns a textual representation of the HTTP request that would have been made (e.g., GET https://fhir.example.com/Patient/123
or POST https://fhir.example.com/Observation\n{...}
). This allows testing MedAgentBench agents without needing a live FHIR endpoint.
Features
- Implements MCP handlers:
list_resources
: Lists available simulated resources (currentlyCapabilityStatement
).read_resource
: Simulates reading a FHIR resource by its URI.list_tools
: Lists available FHIR simulation tools.call_tool
: Simulates executing FHIR operations:search_fhir
: Simulates searching for FHIR resources.read_fhir
: Simulates reading a specific FHIR resource by URI.create_fhir_resource
: Simulates creating a new FHIR resource.
- Uses
mcp-server
library for MCP communication. - Configured and packaged using Poetry.
- Includes asynchronous unit tests with
pytest
andpytest-asyncio
.
Installation
Ensure you have Python >= 3.10 and Poetry installed.
poetry install
Configuration
Before running the server, you must set the FHIR_BASE_URL
environment variable. This URL is used to construct the simulated request strings.
export FHIR_BASE_URL="https://your-fhir-server-base.com/fhir"
# Or for local testing:
# export FHIR_BASE_URL="http://localhost:8080/fhir"
Usage
Once configured, run the server using the installed script:
fhir-mcp-server-medagentbench
The server will start listening for MCP requests over standard input/output.
Development
Setup
Clone the repository and install dependencies, including development tools:
git clone https://github.com/MikeHolcomb/mcp-fhir-python-medagentbench.git
cd mcp-fhir-python-medagentbench
poetry install --with dev
Linting and Formatting
This project uses pre-commit
to enforce code style (black
, isort
) and check for issues (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
Testing
Tests are located in the tests/
directory and use pytest
.
poetry run pytest
# Run with coverage report
poetry run pytest --cov=src
Tests require pytest-asyncio
due to the asynchronous nature of the MCP handlers.
License
This project is licensed under the MIT License - see the LICENSE file for details (though a LICENSE file might need to be created if not present).
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
MCP Package Docs Server
Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.
Claude Code MCP
An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.
@kazuph/mcp-taskmanager
Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.
Linear MCP Server
Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.
mermaid-mcp-server
A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.
Jira-Context-MCP
MCP server to provide Jira Tickets information to AI coding agents like Cursor

Linear MCP Server
A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Sequential Thinking MCP Server
This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.