Sapphire User MCP Server
MCP server that exposes user profile data from the Sapphire Wellness App, including health alerts, personalized recommendations, and partner service subscriptions via HTTP SSE.
README
Sapphire User MCP Server
A Python Model Context Protocol (MCP) server that exposes user profile data from the Sapphire Wellness App to AI assistants — including health alerts, personalised recommendations, and partner service subscriptions.
Tools Exposed
| Tool | Description |
|---|---|
get_user_alerts |
Health alerts triggered by metric thresholds (abnormal vitals, low activity, etc.) |
get_user_recommendations |
Personalised partner service recommendations ranked by relevance score |
get_user_subscriptions |
Active partner service subscriptions with full service details |
Architecture
Agent Container
│ HTTP SSE
▼
sapphire-user-mcp:10003
│
├──httpx──▶ User Profile API:8091
│
└──httpx──▶ Partner Service API:8085
- Transport: HTTP SSE — required for multi-container deployments (stdio only works when the agent spawns the MCP server as a child process)
- Upstream APIs: All tools call REST APIs over HTTP — no direct database access
- Framework: FastMCP with Pydantic v2 response models
Project Structure
SAPPHIRE-USER-MCP/
├── sapphire_user/
│ ├── server.py # FastMCP app + SSE entry point
│ ├── config.py # Settings (API URLs, HOST, PORT via env)
│ ├── models/ # Pydantic response models
│ │ ├── alerts.py
│ │ ├── recommendations.py
│ │ ├── partner_service.py
│ │ └── subscriptions.py
│ └── tools/ # MCP tool definitions
│ ├── alerts.py
│ ├── recommendations.py
│ └── subscriptions.py
├── pyproject.toml
├── Dockerfile
└── .env.example
Prerequisites
- Python 3.11+
- A running Sapphire User Profile API (default:
http://localhost:8091) - A running Sapphire Partner Service API (default:
http://localhost:8085)
Quick Start
Local Development
# 1. Create and activate a virtual environment
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activate
# 2. Install dependencies
pip install -e .
# 3. Configure environment
cp .env.example .env
# Edit .env — set USER_PROFILE_API_BASE_URL and PARTNER_SERVICE_API_BASE_URL
# 4. Run the server
python -m sapphire_user.server
# Server starts at http://0.0.0.0:8001
Containerised (Docker)
# Build the image
docker build -t sapphire-user-mcp .
# Run the container
docker run -p 10003:10003 --env-file .env sapphire-user-mcp
The MCP server will be available at http://localhost:10003/sse.
To connect your agent container, set:
MCP_SERVER_URL=http://sapphire-user-mcp:10003/sse
Configuration
All settings are read from environment variables (or a .env file):
| Variable | Default | Description |
|---|---|---|
HOST |
0.0.0.0 |
MCP server bind address |
PORT |
8001 |
MCP server bind port |
USER_PROFILE_API_BASE_URL |
http://localhost:8091 |
Sapphire User Profile API base URL |
PARTNER_SERVICE_API_BASE_URL |
http://localhost:8085 |
Sapphire Partner Service API base URL |
Tool Reference
All tools accept a single user_email parameter.
| Parameter | Type | Description |
|---|---|---|
user_email |
str |
The user's email address (e.g. sarah.chen@sapphirewellness.com) |
get_user_alerts
Fetches health alerts for the user from the User Profile API. Each alert includes:
- severity — alert urgency level (e.g.
critical,warning) - category — metric category that triggered the alert
- alertMessage — human-readable description of the alert
- metricName / metricType — the specific metric that breached a threshold
get_user_recommendations
Returns personalised partner service recommendations ranked by relevance score. Each recommendation includes:
- relevanceScore — integer ranking of how well the service matches the user's health profile
- partnerService — service name, category, type, and description
- generatedAt — timestamp when the recommendation was computed
get_user_subscriptions
Fetches the user's active partner service subscriptions and enriches each with full service details from the Partner Service API. Each subscription includes:
- partnerServiceId — the enrolled service identifier
- isActive — whether the subscription is currently active
- associationContext — contract end date and other contextual metadata
- service_details — full service spec, pricing, availability, and contract information
Inspecting Tools
Use the MCP Inspector to explore tool schemas and make test calls:
npx @modelcontextprotocol/inspector http://localhost:8001/sse
Connecting to Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"sapphire-user": {
"url": "http://localhost:8001/sse"
}
}
}
Then ask Claude: "What health alerts does sarah.chen@sapphirewellness.com have?" and it will call get_user_alerts with the provided email.
Extending
Adding a new tool:
- Create
sapphire_user/models/<name>.py— Pydantic response model - Create
sapphire_user/tools/<name>.py—@mcp.tool()definition calling the appropriate API - Register in
server.py
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。