bsp-mcp
将人工智能连接到健康数据-经过验证的同意
由出版 安布罗西奥研究所 · 生物制品协会rotocol.com
______________________________________________________________________
这是什么
bsp-mcp 是生物主权协议的官方模型上下文协议服务器。它允许任何与MCP兼容的AI助手(Claude、GPT或任何其他助手)读取用户的BSP健康记录并与之交互。但它从来不会悄无声息地这样做:每一次数据访问都由用户明确发布的ConsentToken进行门控,并在链上强制进行加密验证。
服务器通过stdio实现MCP工具接口,与 bsp-sdk ExchangeClient,并将同意视为硬运行时约束,而不是UI复选框。如果不存在有效令牌,或者如果请求的意图超出了授权范围,则在接触任何数据之前,调用将被拒绝。
______________________________________________________________________
为什么这很重要
2026年,人工智能健康助理无处不在。问题是,他们中的大多数人通过机构管道访问健康数据,而用户是旁观者——数据从电子健康档案流到平台再到模型,个人永远看不到同意线索,更不用说控制它了。
BSP-MCP逆转了这一点。您的AI进行的每个查询都由您发出的ConsentToken进行门控,其范围与您授权的类别和意图完全一致,并具有您设置的到期时间。AI会看到你允许的东西——仅此而已。当您撤销访问权限时,它会立即停止。整个访问历史都永久记录在Aptos上,任何人都可以审计。
这就是主权健康数据在实践中的样子。
______________________________________________________________________
可用工具
| 工具 | 需要同意 | 它返回什么 |
|---|---|---|
bsp_get_biorecords | 是的-- READ_RECORDS intent | BSP格式的生物测量:值、单位、参考范围、收集时间戳。可按类别、生物标志物代码和日期范围进行过滤。 |
bsp_get_beo_summary | 是的-- READ_RECORDS intent | 用户生物特征概述:存在的类别、记录计数、上次测量日期和数据覆盖水平。 |
bsp_resolve_biomarker | 否——公共分类学 | BSP生物标志物代码的名称、类别、级别和临床背景。 |
bsp_list_categories | 否--公共分类法 | 所有25个BSP分类法类别都有级别过滤器(核心/标准/扩展/设备)。 |
bsp_check_consent | 否--读取会话配置 | 活动同意状态:连接了哪个BEO,授权了哪些意图,令牌ID和到期时间。先运行这个。 |
bsp_verify_consent | 否--公开验证 | 验证特定的ConsentToken是否有效并涵盖给定的意图。退货 { valid, reason }. |
bsp_lock_beo | 是的-- BSP_PRIVATE_KEY | 紧急锁——立即冻结BEO。锁定时不允许进行任何操作。 |
bsp_unlock_beo | 是的-- BSP_PRIVATE_KEY | 解锁之前锁定的BEO。 |
bsp_destroy_beo | 是的-- BSP_PRIVATE_KEY + confirm: true | 不可逆的 --永久删除(LGPD/GDPR)。清空密钥,撤销所有令牌,释放域。 |
bsp_revoke_all_tokens | 是的-- BSP_PRIVATE_KEY | 紧急撤销BEO的所有有效同意令牌。 |
______________________________________________________________________
设置
1.安装
npx bsp-mcp2.在Claude Desktop中配置
添加 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"bsp": {
"command": "npx",
"args": ["-y", "bsp-mcp"],
"env": {
"BSP_BEO_DOMAIN": "yourname.bsp",
"BSP_CONSENT_TOKEN_ID": "tok_...",
"BSP_NETWORK": "mainnet"
}
}
}
}3.发行ConsentToken
在您的AI可以读取任何记录之前,您需要从您的BSP身份对其进行授权:
bsp consent grant \
--beo yourname.bsp \
--intent READ_RECORDS \
--categories BSP-HM,BSP-GL,BSP-LA \
--expires 2026-12-31 \
--output tok_...然后将该令牌ID设置为 BSP_CONSENT_TOKEN_ID 在服务器环境中。
4.验证连接
开始Claude会话并问:
“检查我的BSP同意状态”
克劳德会打电话的 bsp_check_consent 并确认连接了哪个BEO以及它可以访问哪些数据。
______________________________________________________________________
演示对话
User: Analyze my latest blood panel results
Claude: Let me check your BSP consent first.
[bsp_check_consent]
→ BEO: alice.bsp
→ Token: tok_7f3a...c291
→ Network: mainnet
→ Intents: READ_RECORDS
→ Authorized categories: BSP-HM (Hematology), BSP-GL (Genomics Light), BSP-LA (Lab – Advanced)
→ Expires: 2026-12-31
Consent verified. Fetching your hematology records.
[bsp_get_biorecords]
→ BEO: alice.bsp
→ Category: BSP-HM
→ Date range: last 90 days
→ Records returned: 12
Based on your latest blood panel (March 18, 2026):
Hemoglobin 14.2 g/dL ✓ normal (ref: 12.0–16.0)
Hematocrit 42.1 % ✓ normal (ref: 36–48)
WBC 7,200 /μL ✓ normal (ref: 4,500–11,000)
Platelets 238,000 /μL ✓ normal (ref: 150,000–400,000)
MCV 88 fL ✓ normal (ref: 80–100)
Ferritin 22 ng/mL ⚠ low-normal (ref: 20–200; optimal longevity: >50)
Everything is within clinical range. Ferritin at 22 ng/mL is technically normal,
but for longevity optimization the target is typically above 50. Worth discussing
iron supplementation or dietary adjustments with your provider.______________________________________________________________________
安全模型
同意验证的工作原理
这 ConsentGuard 在每次数据访问工具调用之前运行。它检查:
- 已配置BEO域(
BSP_BEO_DOMAIN) - 存在ConsentToken(
BSP_CONSENT_TOKEN_ID) - 令牌的
intents数组包含请求操作所需的意图 - 令牌尚未过期
当 bsp-sdk 步骤3和4在链上根据AccessControl合约进行验证。Aptos上的令牌状态是事实的来源,而不是本地环境。
令牌过期时会发生什么
[bsp_get_biorecords]
⛔ BSP Consent Error [TOKEN_EXPIRED]
The ConsentToken tok_7f3a...c291 expired on 2026-06-01.
The BEO holder must issue a new token to continue.
→ https://biologicalsovereigntyprotocol.com/getting-started/quickstartAI无法继续。未返回任何数据。不存在回退路径。
当令牌被撤销时会发生什么
立即撤销。Aptos上的AccessControl合约将令牌标记为已撤销,下一个访问注册表的工具调用将收到 TOKEN_REVOKED 错误和停止。对话中的撤销处理得当——人工智能确认撤销并停止访问数据。
范围执行
令牌具有作用域。一个令牌 READ_RECORDS 上 BSP-HM,BSP-GL 不能用于阅读 BSP-CV (心血管)数据,即使该类别存在于BEO中。类别级别的强制执行委托给AccessControl合同。
______________________________________________________________________
面向开发者
添加新工具
工具已在中注册 src/index.ts每个工具都遵循以下模式:
// 1. Define the tool in the tools[] array
{
name: 'bsp_my_new_tool',
description: '...',
inputSchema: { type: 'object', properties: { ... } }
}
// 2. Add a case in the CallToolRequestSchema handler
case 'bsp_my_new_tool': {
// For consent-required tools:
const consentError = guard.check('REQUIRED_INTENT')
if (consentError) return consentError
// Your tool logic here
// Use bsp-sdk ExchangeClient to interact with the registry
}工具接口
每个工具都会返回一个 MCPResult:
type MCPResult = {
content: Array
isError?: boolean
}环境变量
| 变量 | 必填 | 描述 |
|---|---|---|
BSP_BEO_DOMAIN | 是 | 用户的BSP身份域(例如。 alice.bsp) |
BSP_CONSENT_TOKEN_ID | 数据访问是 | BEO持有人颁发的令牌ID |
BSP_API_URL | 否 | 覆盖BSP API基本URL(默认值: https://api.biologicalsovereigntyprotocol.com) |
BSP_IEO_API_KEY | 是IEO工具 | API键用于IEO范围的操作(bsp_list_beos, bsp_list_ieos, bsp_submit_biorecord) |
BSP_PRIVATE_KEY | 是用于写入工具 | 十六进制编码的Ed25519私钥——需要 bsp_lock_beo, bsp_unlock_beo, bsp_destroy_beo, bsp_revoke_all_tokens |
BSP_REGISTRY_URL | 否 | 覆盖中继器/注册表端点(默认值: https://api.biologicalsovereigntyprotocol.com) |
BSP_NETWORK | 没有 | mainnet 或 testnet (默认值: mainnet) |
相关套餐
- bsp规范 --完整的BSP规范
- bsp-sdk类型脚本 --TypeScript SDK(
bsp-sdk) - bsp id web --用于管理BEO和发行代币的web应用程序
______________________________________________________________________
工具架构
为每个工具提供详尽的JSON模式。有关具有成功和错误路径的端到端请求/响应示例,请参阅 examples/.
bsp_check_consent
{ "type": "object", "properties": {}, "required": [] }bsp_get_biorecords
{
"type": "object",
"properties": {
"category": { "type": "string", "description": "BSP category code (e.g. BSP-HM)" },
"codes": { "type": "array", "items": { "type": "string" }, "description": "Specific biomarker codes" },
"fromDate": { "type": "string", "format": "date-time" },
"toDate": { "type": "string", "format": "date-time" },
"limit": { "type": "integer", "minimum": 1, "maximum": 500, "default": 50 }
},
"required": []
}bsp_get_beo_summary
{ "type": "object", "properties": {}, "required": [] }bsp_resolve_biomarker
{
"type": "object",
"properties": {
"code": { "type": "string", "description": "Biomarker code (e.g. BSP-HM-HGB)" }
},
"required": ["code"]
}bsp_list_categories
{
"type": "object",
"properties": {
"level": {
"type": "string",
"enum": ["CORE", "STANDARD", "EXTENDED", "DEVICE"]
}
},
"required": []
}bsp_lock_beo / bsp_unlock_beo
{
"type": "object",
"properties": {
"confirm": { "type": "boolean", "description": "Must be true" }
},
"required": ["confirm"]
}bsp_destroy_beo
{
"type": "object",
"properties": {
"confirm": { "type": "boolean", "description": "Must be true — irreversible" },
"reason": { "type": "string", "description": "Optional audit reason" }
},
"required": ["confirm"]
}bsp_revoke_all_tokens
{
"type": "object",
"properties": {
"confirm": { "type": "boolean" }
},
"required": ["confirm"]
}所有工具返回 MCPResult:
type MCPResult = {
content: Array
isError?: boolean
}错误有效载荷总是在括号中包含一个稳定的代码,例如。 [TOKEN_EXPIRED], [SCOPE_VIOLATION], [CONFIRM_REQUIRED].完整目录: bsp-spec/docs/ERROR_CODES.md.
______________________________________________________________________
更新日志
看 CHANGELOG.md.
贡献
______________________________________________________________________
许可证
Apache 2.0-- 安布罗西奥研究所
