home / mcp / epic patient api mcp server
Provides a file-based Epic patient data MCP server with LLMed search and 15 data-query tools.
Configuration
View docs{
"mcpServers": {
"akiani-mock-epic-mcp": {
"command": "uv",
"args": [
"run",
"python",
"-m",
"epic_mcp.server"
],
"env": {
"LLM_PROVIDER": "openrouter",
"GEMINI_API_KEY": "YOUR_GEMINI_API_KEY",
"OPENROUTER_MODEL": "anthropic/claude-3.5-sonnet",
"OPENROUTER_API_KEY": "YOUR_OPENROUTER_API_KEY"
}
}
}
}This MCP server provides a file-based Epic patient data backend with a set of querying tools and an LLMed search feature. It lets you list patient data summaries first and fetch full details by ID, enabling efficient data discovery and retrieval while keeping data transfer minimal.
You interact with the Epic Patient API MCP Server through an MCP client. Start by listing available items to get IDs and metadata, then fetch full details for specific items as needed. Use the two-tier approach to minimize data transfer and latency.
Common usage patterns include: first listing generated summaries for a patient’s data, then requesting detailed information for particular items such as an allergy, medication, or lab result. You can also use natural language search to find items across the patient data. If you need an actual file attachment from notes, use the note attachment tool.
Prerequisites you need on your machine are Python and a command runner provided by the environment. You should also have access to a shell or terminal to run the commands.
Install the MCP server package in editable mode using the project’s setup command.
Configure the LLM you want to use in a local environment file. You can use Gemini by default or switch to OpenRouter if you prefer. Create or edit the environment file to include the keys shown below.
Run the server locally to start serving requests on the MCP endpoint.
LLM configuration is flexible. If you choose Gemini, set GEMINI_API_KEY to your Gemini API key. If you choose OpenRouter, set LLM_PROVIDER=openrouter, OPENROUTER_API_KEY to your OpenRouter API key, and OPENROUTER_MODEL to the model you want to use (for example, anthropic/claude-3.5-sonnet). The default option uses Gemini unless you override it.
The server stores patient data in YAML files under the patients/ directory. This makes it easy to inspect and modify individual patient records in a lightweight, file-based store.
Two-tier access minimizes data transfer by first listing summaries (IDs and metadata) and then fetching full details for selected items by ID. You can use this approach for all supported data types, including allergies, medications, conditions, and more.
Here is a snapshot of a sample patient and their available IDs you could fetch details for: patient_001, patient_002, patient_003. Detailed data can then be retrieved per item as needed.
You can list a patient’s data summaries, request detailed information for a specific item by ID, retrieve note attachments, and perform natural language searches across patient data. This enables efficient data discovery and retrieval when working with Epic patient datasets.
Return IDs, dates, and metadata summaries for patient allergies without full details.
Return IDs, dates, and metadata summaries for medications without full details.
Return IDs, dates, and metadata summaries for medical conditions.
Return IDs, dates, and metadata summaries for clinical notes.
Return IDs, dates, and metadata summaries for lab results.
Return IDs, dates, and metadata summaries for vitals.
Return IDs, dates, and metadata summaries for procedures.
Return full allergy data for a given allergy ID.
Return full medication data for a given medication ID.
Return full condition data for a given condition ID.
Return full clinical note data for a given note ID.
Return full lab result data for a given lab result ID.
Return full vital data for a given vital ID.
Return full procedure data for a given procedure ID.
Retrieve an attachment from a note by its ID.
Perform natural language search across patient data using an LLM.