Medicos MCP
MCP server backend for a hospital medicine reminder app, offering tools for Firebase integration, OCR/parsing, medical intelligence, scheduling, notifications, adherence tracking, and governance with ArmorIQ intent enforcement.
README
Medicos MCP Backend
Python MCP server backend for the Hospital Medicine Reminder app.
Overview
- Protocol: Model Context Protocol (MCP), Python implementation
- Responsibilities:
- Expose controlled tools for Firebase, OCR/parsing, medical intelligence, scheduling, notifications, adherence, and governance.
- Enforce ArmorIQ intent checks and auditing for all sensitive operations.
- Persist all application data in Firebase (Firestore + Storage) and send notifications via FCM.
High-Level Layout
mcp_server/main.py– MCP server entrypoint and tool registration.config.py– Environment-driven configuration (Firebase, ArmorIQ, LLM, etc.).firebase_client.py– Firebase Admin SDK initialization and helpers.armor_iq_client.py– ArmorIQ REST client forpolicy.check_intentandaudit.log.llm_client.py– Wrapper for LLM provider(s) used by parsing/medical/scheduling tools.models/– Pydantic models for tool inputs/outputs and shared context.tools/– Implementation of MCP tools, grouped by namespace.
Runtime Expectations
- Python 3.10+ recommended.
- MCP client (e.g. orchestrator agent) connects to this server over stdio or another supported transport.
- The server is designed to run on your VPS, separate from the Flutter app and hospital dashboard.
Environment Variables
The server is configured via environment variables (all optional defaults documented in config.py):
MEDICOS_ENV–devorprod(default:dev).MEDICOS_FIREBASE_PROJECT_ID– Firebase project ID.MEDICOS_FIREBASE_CREDENTIALS_FILE– Path to Firebase service account JSON (if not using ADC).MEDICOS_ARMORIQ_API_KEY– API key for ArmorIQ (SDK handles endpoints internally based onMEDICOS_ENV).MEDICOS_LLM_PROVIDER– LLM provider identifier (e.g.openai,anthropic).MEDICOS_LLM_API_KEY– API key for the chosen LLM provider.
You can also use a local .env file in the repository root during development; see notes in config.py.
Getting Started
Option 1: Virtual Environment (Development)
Setup:
./setup.sh # Creates venv and installs dependencies
source .venv/bin/activate
Or manually:
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
Configure Environment:
-
Copy
env.exampleto.envand fill in your values:cp env.example .env # Edit .env with your actual values -
Place your Firebase service account JSON in
./credentials/firebase-service-account.json
Run the Server:
python -m mcp_server.main
Option 2: Docker Compose (Production/VPS)
Prerequisites:
- Docker and Docker Compose installed
- Firebase service account JSON file
Setup:
-
Create credentials directory and add Firebase service account:
mkdir -p credentials cp /path/to/your/firebase-service-account.json credentials/ -
Create
.envfile:cp env.example .env # Edit .env with your actual values -
Build and run:
docker-compose build docker-compose up -d docker-compose logs -f mcp-server
Stop the container:
docker-compose down
Docker Configuration:
- The container runs as a non-root user (
mcpuser) - Firebase credentials are mounted read-only from
./credentials/ - Environment variables can be set in
.envordocker-compose.yml - The server runs over stdio (for MCP clients that support it)
Transport Modes
The MCP server supports two transport modes:
1. Stdio Transport (Default)
For direct process-to-process communication (e.g., Cursor, Claude Desktop):
{
"mcpServers": {
"medicos": {
"command": "python",
"args": ["-m", "mcp_server.main"],
"env": {
"MEDICOS_FIREBASE_PROJECT_ID": "...",
"MEDICOS_TRANSPORT": "stdio"
}
}
}
}
2. HTTP Transport (Reverse Proxy)
For deployment behind a reverse proxy (e.g., mcp.p1ng.me):
-
Set environment variable:
MEDICOS_TRANSPORT=http MEDICOS_SERVER_PORT=8000 -
Run the server:
python -m mcp_server.main # Server listens on http://0.0.0.0:8000 -
Configure reverse proxy (using Caddy, nginx, or similar):
- Point
mcp.p1ng.meto your VPS - Proxy
/mcp/streamand/mcp/messagetohttp://localhost:8000 - Set up SSL/TLS certificates
- Point
-
Connect clients to:
https://mcp.p1ng.me/mcp/stream
Troubleshooting
- Import errors: Make sure dependencies are installed (
pip install -e .) - Firebase errors: Verify service account JSON path and permissions
- ArmorIQ errors: Check base URL and API key
- LLM errors: Verify API key and provider name
- Docker issues: Ensure credentials directory exists and contains valid JSON
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。