
Bolyra
io.github.bolyra由 GitHub 账号 bolyra 发布v0.6.4更新于 Oct 24, 2026
MCP auth middleware: gate tool calls so only authorized agents can act.
概览
为 MCP 服务器加入 Bolyra 零知识证明鉴权的库,使只有获授权的代理才能调用敏感工具。
- 可以做什么
- 包装 MCP 服务器,使每次工具调用都必须携带 Bolyra 证明包(stdio 走请求元数据,HTTP 走 Authorization 头)。
- 校验人类与代理双方的证明、nonce 新鲜度和最低分数后才放行调用。
- 按工具权限策略比对代理的有效位掩码,并支持多跳委托链。
- 提供客户端附加证明、离线校验证明包和检查工具策略的辅助函数。
- 支持开发模式,用模拟证明和固定种子身份在本地测试。
- 适用场景
- 适用于你自己开发或运维的 MCP 服务器,且其工具涉及敏感数据或操作,需要密码学证明人类已授权调用方代理。它是开发库而非现成工具服务器,只有在你编写自己的 MCP 服务器或客户端时才值得引入。
- 运行要求
- 以 npm 包形式与 MCP SDK、Bolyra SDK 一同安装,作为本地进程运行在用户机器上。生产环境需要凭据解析器、电路产物文件、RPC 地址和注册合约地址;开发模式不需要电路产物。
安装
在 SourceWeft 中
- 打开 控制台中的 Bolyra,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
@bolyra/mcp
Gate MCP tool calls so only authorized agents can call sensitive tools.
Quick Start (60 seconds)
That's it. Every tools/call now requires a valid Bolyra proof bundle.
Dev mode (full example)
Dev mode uses mock proofs — no circuit artifacts, no trusted setup, instant startup. Use it to build and test your server before wiring real ZKP verification.
Client side:
How it works
Every tools/call request must carry a proof bundle: a pair of Groth16 proofs (one from the human's circuit, one from the agent's) bound to a shared session nonce.
The server side:
- Extracts the bundle from
params._meta.bolyra(stdio) or theAuthorization: Bolyra <base64>header (HTTP). - Verifies the handshake — both proofs, nonce freshness, score floor.
- Checks the tool's permission policy against the agent's effective bitmask.
- Attaches a
BolyraAuthContextto the request for downstream handlers. - Rejects with an MCP error if any step fails.
Discovery calls (initialize, tools/list) pass through unauthenticated.
Delegation chains (v=2 bundles) narrow scope from root credential to leaf agent across multiple hops. The effective bitmask seen by tool policies is always the leaf's — the most-restricted scope.
API reference
Server — stdio
Wraps an McpServer instance. Must be called before server.connect(transport).
Server — HTTP
Express middleware. Mount before your MCP HTTP handler. Rejects unauthenticated tools/call requests with HTTP 401.
Client helpers
Runs a handshake and returns { headers, meta, bundle }. Pass options.devMode = true to skip real proving and emit a mock bundle.
Like attachBolyraProof but walks a delegation chain and returns a v=2 bundle.
Verification
Verify a bundle directly — useful for custom transports or offline verification.
Check a BolyraAuthContext against a tool's required bitmask.
Dev identities (re-exported from SDK)
Returns fixed-seed { human, agent, operatorKey } — deterministic, no circuit artifacts required. Logs a warning on first call. Never use in production.
Production configuration
Swap devMode: true for a real resolveCredential resolver and point the SDK at your circuit artifacts:
Full config interface:
The HTTP variant adds authScheme?: string (default "Bolyra").
Transport guide
Both produce the same BolyraAuthContext on the server side. Tool handlers don't need to know which transport was used.
Example
See examples/protected-file-server/ for a complete stdio server + client pair using dev mode. Run it with:
来源:integrations/mcp/README.md,提交 5e9de85
工具
0版本历史
1- v0.6.4最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分