AgentCare (FHIR EMR) MCP server

Integrates with FHIR-enabled EMR systems to provide healthcare tools for patient data retrieval, medical research integration, and AI-assisted clinical analysis.
Back to servers
Provider
Kartha
Release date
Feb 17, 2025
Language
TypeScript
Stats
57 stars

Agent Care is a Model Context Protocol (MCP) server that facilitates integration between AI assistants and Electronic Medical Record (EMR) systems like Cerner and Epic. It provides healthcare tools for interacting with FHIR data, accessing medical resources, and performing clinical analyses through Claude Desktop or Goose Desktop.

Installation

Prerequisites

  • Node.js installed on your system
  • Client credentials for your EMR system (Cerner or Epic)
  • API keys for medical research services (optional)

Setup Steps

  1. Clone the repository:

    git clone [agentcare-mcp-github path]
    cd agentcare-mcp
    
  2. Install dependencies:

    npm install
    
  3. Build the project:

    npm run build
    
  4. Create environment configuration for your EMR system.

Configuration for Cerner

Create a .env file with the following configuration:

OAUTH_CLIENT_ID="YOUR_CLIENT_ID"
OAUTH_CLIENT_SECRET="YOUR_CLIENT_SECRET"
OAUTH_TOKEN_HOST="https://authorization.cerner.com"
OAUTH_AUTHORIZE_PATH="/tenants/ec2458f2-1e24-41c8-b71b-0e701af7583d/protocols/oauth2/profiles/smart-v1/personas/provider/authorize"
OAUTH_AUTHORIZATION_METHOD="header"
OAUTH_TOKEN_PATH="/tenants/ec2458f2-1e24-41c8-b71b-0e701af7583d/hosts/api.cernermillennium.com/protocols/oauth2/profiles/smart-v1/token"
OAUTH_AUDIENCE="https://fhir-ehr.cerner.com/r4/ec2458f2-1e24-41c8-b71b-0e701af7583d"
OAUTH_CALLBACK_URL="http://localhost:3456/oauth/callback"
OAUTH_SCOPES="user/Patient.read user/Condition.read user/Observation.read user/MedicationRequest.read user/AllergyIntolerance.read user/Procedure.read user/CarePlan.read user/CareTeam.read user/Encounter.read user/Immunization.read"
OAUTH_CALLBACK_PORT="3456"
FHIR_BASE_URL="https://fhir-ehr.cerner.com/r4/ec2458f2-1e24-41c8-b71b-0e701af7583d"
PUBMED_API_KEY="your_pubmed_api_key"
CLINICAL_TRIALS_API_KEY="your_trials_api_key"
FDA_API_KEY="your_fda_api_key"

Configuration for Epic

Create a .env file with the following configuration:

OAUTH_CLIENT_ID="YOUR_CLIENT_ID"
OAUTH_CLIENT_SECRET=""
OAUTH_TOKEN_HOST="https://fhir.epic.com"
OAUTH_AUTHORIZE_PATH="/interconnect-fhir-oauth/oauth2/authorize"
OAUTH_AUTHORIZATION_METHOD="body"
OAUTH_TOKEN_PATH="/interconnect-fhir-oauth/oauth2/token"
OAUTH_AUDIENCE="https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4"
OAUTH_CALLBACK_URL="http://localhost:3456/oauth/callback"
OAUTH_SCOPES="user/Patient.read user/Observation.read user/MedicationRequest.read user/Condition.read user/AllergyIntolerance.read user/Procedure.read user/CarePlan.read user/CareTeam.read user/Encounter.read user/Immunization.read"
OAUTH_CALLBACK_PORT="3456"
FHIR_BASE_URL="https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4"
PUBMED_API_KEY="your_pubmed_api_key"
CLINICAL_TRIALS_API_KEY="your_trials_api_key"
FDA_API_KEY="your_fda_api_key"

Using with Claude Desktop

To use Agent Care with Claude Desktop, modify the Claude Desktop configuration file:

Location of Configuration File

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Configuration Example

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/your-username/Desktop"
      ]
    },
    "agent-care": {
      "command": "node",
      "args": [
        "/Users/your-username/path-to-agent-care/agent-care-mcp/build/index.js"
      ],
      "env": {
        "OAUTH_CLIENT_ID": "YOUR_CLIENT_ID",
        "OAUTH_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
        "OAUTH_TOKEN_HOST": "YOUR_TOKEN_HOST",
        "OAUTH_TOKEN_PATH": "YOUR_TOKEN_PATH",
        "OAUTH_AUTHORIZE_PATH": "YOUR_AUTHORIZE_PATH",
        "OAUTH_AUTHORIZATION_METHOD": "YOUR_AUTH_METHOD",
        "OAUTH_AUDIENCE": "YOUR_AUDIENCE",
        "OAUTH_CALLBACK_URL": "YOUR_CALLBACK_URL",
        "OAUTH_SCOPES": "YOUR_SCOPES",
        "OAUTH_CALLBACK_PORT": "YOUR_PORT",
        "FHIR_BASE_URL": "YOUR_FHIR_URL",
        "PUBMED_API_KEY": "YOUR_PUBMED_KEY",
        "CLINICAL_TRIALS_API_KEY": "YOUR_TRIALS_KEY",
        "FDA_API_KEY": "YOUR_FDA_KEY"
      }
    }
  }
}

Using with MCP Inspector

You can test the MCP server using the MCP Inspector tool:

npm install -g @modelcontextprotocol/inspector
mcp-inspector build/index.js

Then open http://localhost:5173 in your browser.

Using with Goose Desktop

Goose Desktop is an alternative to Claude Desktop that works with MCP servers and can be configured to use various AI models. Configure Goose Desktop to use Agent Care by adding it as an extension and specifying the path to the built server:

/Users/your-username/path-to-agent-care/agent-care-mcp/build/index.js

Available Tools

FHIR Tools

  • find_patient - Search for patients
  • get_patient_observations - Retrieve vital signs
  • get_patient_conditions - Get active conditions
  • get_patient_medications - Get current medications
  • get_patient_encounters - Get clinical encounters
  • get_patient_allergies - Get allergies and intolerances
  • get_vital_signs - Get vital signs
  • get_lab_results - Get laboratory results
  • clinical_query - Execute custom FHIR queries

Medical Research Tools

  • search-pubmed - Search PubMed articles
  • search-trials - Find relevant clinical trials
  • drug-interactions - Check drug-drug interactions

Troubleshooting

If you encounter port conflicts with port 3456 (used for OAuth callbacks), you can terminate the conflicting process:

kill -9 $(lsof -t -i:3456)

Test Credentials

For sandbox/development environments:

  • Cerner: Username: portal Password: portal
  • Epic: Username: FHIRTWO Password: EpicFhir11!

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later