
Bolyra
io.github.bolyraPublished by GitHub account bolyrav0.6.4Updated Oct 24, 2026
MCP auth middleware: gate tool calls so only authorized agents can act.
Overview
A library that adds Bolyra zero-knowledge proof authentication to MCP servers, so only authorized agents can call sensitive tools.
- What you can do
- Wrap an MCP server so every tool call must carry a Bolyra proof bundle (stdio via request metadata, HTTP via an Authorization header).
- Verify human and agent proofs, nonce freshness and a minimum score before a call proceeds.
- Enforce per-tool permission policies against the agent's effective bitmask, including delegated chains.
- Expose helpers to attach proofs on the client side, verify bundles offline and check tool policies.
- Run in dev mode with mock proofs and fixed-seed identities for local testing.
- When to use it
- Use it when you build or operate an MCP server whose tools touch sensitive data or actions and you want cryptographic proof that a human authorized the calling agent. It is a developer library, not a ready-made tool server, so it is worth adding only if you are writing your own MCP server or client.
- Requirements
- Installed as an npm package alongside the MCP SDK and the Bolyra SDK; runs as a local process on the user's machine. Production use needs a credential resolver, circuit artifacts on disk, an RPC URL and a registry contract address. Dev mode needs no circuit artifacts.
Installation
In SourceWeft
- Open Bolyra in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
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:
Source: integrations/mcp/README.md at commit 5e9de85
Tools
0Version history
1- v0.6.4LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts