epic-ehr-mcp-server-db
by pcjx8
Overview
Production-ready Model Context Protocol (MCP) server for Electronic Health Records with OAuth 2.0 authentication.
Installation
python server.py --websocketEnvironment Variables
- DATABASE_URL
- JWT_SECRET_KEY
- SERVER_HOST
- SERVER_PORT
- LOG_LEVEL
- SSE_PORT
Security Notes
The system implements OAuth 2.0 with JWT tokens and SHA-256 hashed secrets, along with role-based and scope-based access control, which are good practices. However, it has several critical security vulnerabilities and anti-patterns: 1) A default `JWT_SECRET_KEY` (`'your-secret-key-change-in-production'`) is used if `JWT_SECRET_KEY` is not set via environment variables. This is a major security risk for production. 2) The `server.py` explicitly includes a bypass for token validation (`'No access token provided, bypassing authentication for demo/testing'`) if no `access_token` is present, which is highly inappropriate for an EHR system in production. 3) The `sse_server.py` uses `CORS(allow_origins=['*'])`, which opens up the API to cross-origin attacks. 4) The `oauth_clients_credentials.json` file is expected to exist in the working directory (and is used by test scripts) containing plaintext client secrets, a significant credential management risk. 5) Sensitive data (request bodies, headers) are logged by a middleware in `sse_server.py`, potentially exposing PII or secrets. These issues make the system unsafe for a production EHR environment without substantial hardening.
Similar Servers
example-remote-server
A reference server demonstrating all Model Context Protocol (MCP) features and OAuth 2.0 authentication patterns.
sagemcp
A scalable platform for hosting Multi-tenant Model Context Protocol (MCP) servers with multi-tenant support, OAuth integration, and connector plugins for various services.
mcp-web-client
A web-based client for the Model Context Protocol (MCP), enabling users to connect to multiple MCP servers, browse tools/resources/prompts, and interact via an AI-powered chat interface.
mcp-compose
This server provides a robust example of OAuth2 authentication for MCP (Model Context Protocol) servers, using GitHub as the identity provider. It demonstrates secure multi-server management, protocol translation, and integration with AI agents for tool invocation.