Sapphire User MCP Server
Sapphire User MCP Server
一个基于 Python 的 Model Context Protocol (MCP) 服务器,用于将 Sapphire Wellness App 的用户画像数据提供给 AI 助手——包括健康警报、个性化推荐和合作伙伴服务订阅。
公开的工具
工具 | 描述 |
| 由指标阈值触发的健康警报(生命体征异常、活动量过低等) |
| 按相关度评分排序的个性化合作伙伴服务推荐 |
| 包含完整服务详情(有效订阅的) |
Related MCP server: Sapphire Wellness MCP Server
架构
Agent Container
│ HTTP SSE
▼
sapphire-user-mcp:10003
│
├──httpx──▶ User Profile API:8091
│
└──httpx──▶ Partner Service API:8085传输方式 — HTTP SSE:多容器部署所必需(stdio 只在 agent 将 MCP Server 作为子进程启动时才有效)
上游 API — 所有工具均调用 HTTP 上的 REST API,不做直连数据库
框架 — FastMCP,使用 Pydantic v2 response models
项目结构
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前提条件
Python 3.11+
一个正在运行的 Sapphire User Particle API(默认:
http://localhost:8091)一个正在运行的 Sapphire Partner Service API(默认:
http://localhost:8085)
快速开始
本地开发
# 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容器化(Docker)
# Build the image
docker build -t sapphire-user-mcp .
# Run the container
docker run -p 10003:10003 --env-file .env sapphire-user-mcpMCP Server 将在 http://localhost:10003/sse 上可用。
如需连接你的 agent 容器,请设置:
MCP_SERVER_URL=http://sapphire-user-mcp:10003/sse配置
所有配置均从环境变量(或 .env 文件)读取:
变量 | 默认值 | 描述 |
|
| MCP Server 绑定地址 |
|
| MCP Server 绑定端口 |
|
| Sapphire User Profile API 基础 URL |
|
| Sapphire Partner 基础 URL |
工具参考
所有工具都接受单个 user_email 参数。
参数 | 类型 | 描述 |
|
| 用户的邮箱地址(例如 |
get_user_alerts
从 User Profile API 获取该用户的健康警报。每条警报包含:
severity — 警报的紧急级别(例如
critical、warning)category — 触发警报的指标类别
alertMessage — 警报的人类可读描述
metricName / metricType — 触发阈值的具体指标
get_user_commendations
返回的个性化推荐服务按相关度评分排序。每条推荐包含:
relevanceScore — 服务与用户健康画像匹配程度的整数评分
partnerService — 服务名称、类别、类型和描述
generatedAt — 生成推荐的时间戳
get_user_subscriptions
获取用户当前的活跃服务订阅,并为每条订阅补充来自 Partner Service API 的完整服务详情。包含:
partnerServiceId — 注册服务的标识符
isActive — 订阅当前是否处于活动状态
associationContext — 合同结束日期及其他上下文元数据
service_details — 完整服务规格、价格、可用性和合同信息
检查工具
使用 MCP Inspector 浏览工具 schema 并发送测试调用:
npx @modelcontextprotocol/inspector http://localhost:8001/sse连接到 Claude Desktop
在 claude_desktop_config.json 中添加:
{
"mcpServers": {
"sapphire-user": {
"url": "http://localhost:8001/sse"
}
}
}然后向 Claude 提问:“<sup... training...> 是否有健康警报?” 它将使用所提供的邮箱调用 get_user_alerts。
扩展
添加新工具:
创建
sapphire_user/models/<name>.py—— 定义 Pydantic response model创建
sapphire_user/tools/<name>.py—— 定义@mcp.tool()并调用相应的 API在
server.py中注册
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceExposes user profile data from the Sapphire Wellness App via MCP tools for health alerts, personalised recommendations, and partner service subscriptions.
- FlicenseNot gradedqualityCmaintenanceExposes health metrics from the Sapphire Wellness App to AI assistants via MCP, enabling queries on activity, blood pressure, glucose, heart rate, sleep, and SpO2 data.
- FlicenseNot gradedqualityCmaintenanceExposes health metrics from the Sapphire Wellness App to AI assistants, enabling natural language queries for activity, blood pressure, glucose, heart rate, sleep, and SpO2 data.
- FlicenseNot gradedqualityCmaintenanceEnables AI assistants to access Sapphire Wellness user data, including health alerts, personalized recommendations, and partner service subscriptions.
Related MCP Connectors
Garmin data in Claude & ChatGPT via the Garmin Health API. OAuth sign-in, no password sharing.
Connect e-commerce and marketing data to AI assistants via MCP.
Connect your Oura Ring account securely in minutes. Enable authorized access to your sleep, activi…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/IBMC-WORK-REDESIGN-FDE-COHORT-SB/sapphire-user-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server