durvester/Veradigm-EHR-MCP-server
If you are the rightful owner of Veradigm-EHR-MCP-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Veradigm Unity MCP Server is a remote Model Context Protocol server that provides intelligent access to the Veradigm Unity API for healthcare data integration.
Veradigm Unity MCP Server
A remote MCP (Model Context Protocol) server using Streamable HTTP transport that provides intelligent access to Veradigm Unity API for healthcare data integration.
Features
- Remote HTTP Server: Accessible over HTTP using Streamable HTTP transport (not stdio)
- Intelligent Authentication: User-based authentication with Unity API credentials
- Automatic Token Management: Handles Unity token acquisition and renewal (20-minute expiration)
- High-Level Clinical Tools: Meaningful tools that orchestrate multiple Unity API calls
- Comprehensive Patient Summaries: Aggregates demographics, allergies, problems, medications, vitals, and encounters
- Smart Patient Search: Search by name, MRN, DOB, or phone number
- Secure PHI Handling: No PHI logged, secure credential management
- Session Management: Per-session Unity client instances for multi-user support
Prerequisites
- Node.js 18+
- TypeScript
- Access to Veradigm Unity API endpoint
- Unity API service credentials
- Valid EHR/PM user credentials
Installation
-
Clone this repository
-
Install dependencies:
npm install -
Copy
.env.exampleto.envand configure:cp .env.example .env -
Edit
.envwith your Unity API configuration:UNITY_SERVER_URL: Your Unity server URLUNITY_APP_NAME: Your registered Unity application nameUNITY_APP_USERNAME: Service account username for GetTokenUNITY_APP_PASSWORD: Service account password for GetToken (use quotes if it contains special characters like #)UNITY_EHR_USERNAME: Your EHR user credentialsUNITY_EHR_PASSWORD: Your EHR user password
-
Build the TypeScript code:
npm run build
Usage
Starting the Server
The MCP server runs as an HTTP server (not stdio):
npm start
Or in development mode with auto-reload:
npm run dev
The server will start on http://localhost:3000 by default. You can change the port using the PORT environment variable:
PORT=8080 npm start
Connecting from MCP Clients
The server uses Streamable HTTP transport and can be accessed at:
http://localhost:3000/mcp
MCP Inspector (for testing)
npx @modelcontextprotocol/inspector http://localhost:3000/mcp
Claude Code
claude mcp add --transport http veradigm-unity http://localhost:3000/mcp
VS Code
code --add-mcp "{\"name\":\"veradigm-unity\",\"type\":\"http\",\"url\":\"http://localhost:3000/mcp\"}"
Cursor
Click this deeplink to add the server:
cursor://anysphere.cursor-deeplink/mcp/install?name=veradigm-unity&config=eyJ1cmwiOiJodHRwOi8vbG9jYWxob3N0OjMwMDAvbWNwIn0=
Claude Desktop (if using HTTP support)
Add to your Claude Desktop configuration (claude_desktop_config.json):
{
"mcpServers": {
"veradigm-unity": {
"type": "http",
"url": "http://localhost:3000/mcp"
}
}
}
Note: As of now, Claude Desktop primarily supports stdio transport. Use MCP Inspector or other clients that support Streamable HTTP.
Authentication Flow
Environment-Based Authentication:
The server authenticates with the Veradigm Unity API using credentials configured in your .env file:
- Application Authentication: The server uses
UNITY_APP_USERNAMEandUNITY_APP_PASSWORDto obtain a security token from the Unity API (GetToken) - User Authentication: The server then authenticates the EHR user using
UNITY_EHR_USERNAMEandUNITY_EHR_PASSWORD(GetUserAuthentication) - Session Management: The authenticated session is maintained with automatic token refresh
- Automatic Startup: Authentication happens automatically when the server starts - no manual authentication steps required
Security Notes:
- Store your
.envfile securely - it contains sensitive credentials - Never commit your
.envfile to version control (it's in .gitignore) - Tokens expire after 20 minutes of inactivity and are automatically refreshed
- The server maintains a single authenticated session for all MCP connections
Available Tools
get_patient_summary
Fetch LLM-optimized patient summary with clinical relationships, timeline, and narrative format.
-
Parameters:
patientId(required): Patient ID to retrieve summary forformat(optional): Response format -structured(JSON only),narrative(markdown summary), orboth(default)
-
Returns: Comprehensive patient summary with:
- Consistent camelCase Fields:
patientId,firstName,allergyId,problemId, etc. - Clinical Relationships: Links between data (e.g., diabetes problem → metformin medication)
- Chronological Timeline: Temporal sequence of clinical events
- Data Quality Metadata: Sources queried, success/failure tracking, warnings
- Optional Narrative: Markdown-formatted clinical summary
- Structured Data: Normalized JSON with demographics, allergies, problems, medications, vitals, encounters
- Consistent camelCase Fields:
-
Example Response Structure:
{ "patient": { "patientId": "123", "firstName": "John", "lastName": "Doe", ... }, "allergies": [...], "problems": [...], "medications": [...], "recentVitals": {...}, "recentEncounters": [...], "relationships": [ { "type": "problem_to_medication", "fromType": "problem", "fromId": "diabetes-id", "toType": "medication", "toId": "metformin-id", "description": "Metformin prescribed for Type 2 Diabetes" } ], "timeline": [ { "date": "2025-11-01", "category": "problem", "event": "Diagnosed with Type 2 Diabetes" }, { "date": "2025-11-05", "category": "medication", "event": "Started Metformin 500mg BID" } ], "metadata": { "dataSourcesQueried": 6, "dataSourcesSuccessful": 6, "dataSourcesFailed": [] }, "narrative": "# Patient Summary: John Doe\n**MRN:** 12345 | **DOB:** 1980-05-15...", }
search_patients
Search for patients using various criteria.
- Parameters:
searchTerm(required): Search string (name, MRN, etc.)searchType(optional): Type of search -name,mrn,dob, orphone(default:name)maxResults(optional): Maximum number of results to return (default: 20)
- Returns: Array of matching patients with demographics
Architecture
Project Structure
src/
├── index.ts # MCP server entry point with tool registrations
├── api/
│ └── unity-client.ts # Unity API client with token management
├── tools/
│ ├── patient-summary.ts # LLM-optimized patient summary with relationships & timeline
│ └── search-patients.ts # Patient search functionality
├── types/
│ ├── unity.types.ts # Unity API type definitions & normalizers
│ └── mcp-response.types.ts # MCP response schemas (camelCase, relationships, timeline)
└── utils/
├── logger.ts # Logging utility (no PHI)
├── error-handler.ts # Error handling and formatting
└── unity-response-parser.ts # Unity API response unwrapping
Key Design Principles
- LLM-Optimized Responses: Consistent camelCase naming, clinical relationships, temporal timelines
- Working Backwards from LLM: Tools designed for AI consumption, not raw API passthrough
- Stateful Session Management: Single authenticated session with automatic token refresh
- Data Quality Transparency: Metadata tracking sources queried, success/failure rates, warnings
- Graceful Degradation: Return partial data when some Unity actions fail, never fail completely
- Dual Format Support: Both narrative (markdown) and structured (JSON) responses
- Parallel Data Fetching: Orchestrates multiple API calls efficiently
- Robust Error Handling: User-friendly error messages with recovery suggestions
- Secure by Default: No PHI in logs, secure credential handling, .env-based configuration
Development
Running Tests
npm test
Linting
npm run lint
Formatting
npm run format
Troubleshooting
Common Issues
-
Authentication Failed
- Verify EHR/PM credentials are correct
- Check if user has Unity API access permissions
- Ensure GetUserAuthentication is called after GetToken
-
Token Expired
- The server automatically renews tokens
- If issues persist, use
logoutand re-authenticate
-
Network Errors
- Verify Unity server URL in
.env - Check network connectivity to Unity server
- Ensure using HTTPS for production
- Verify Unity server URL in
-
Action Not Supported
- Some actions are EHR-only or PM-only
- Check Unity API documentation for system requirements
Security Considerations
- Store
.envfile securely and never commit to version control - Use HTTPS for all Unity API connections in production
- Implement audit logging for compliance
- Follow HIPAA guidelines for PHI handling
- Regular security updates for dependencies
Contributing
Please follow the existing code style and add tests for new features.
License
MIT
Support
For Unity API issues, consult the Veradigm Unity API documentation or contact Veradigm support. For MCP server issues, please open an issue in this repository.