Back to Home
pcjx8 icon

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

Run Command
python server.py --websocket

Environment 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

Stats

Interest Score0
Security Score5
Cost ClassLow
Avg Tokens300
Stars0
Forks0
Last Update2025-12-04

Tags

EHRMCPOAuth2.0WebSocketPythonSQLAlchemy