Skip to Content
atrib protocol docs

Frameworks and runtimes

Where to add signing, on the server, in the agent, or around a server you do not own.

Tool calls are signed at the tool boundary, on the side of the server. Pick the package that fits what you control.

You controlUseWhat it does
The MCP server@atrib/mcpSigns each tool call the server handles. See Quick start.
Neither, only the config@atrib/mcp-wrapSigns each call through a server you do not own. See below.
The agent's code@atrib/agentCarries context on outbound calls and signs fallback transaction records. See below.

@atrib/agent runs beside one of the other two. It does not sign ordinary tool calls itself: it sends the atrib context out with each call, reads the signed record a server returns, marks a hop that returned none as a gap, and signs a transaction record when a payment completes and the server signed none.

Agent frameworks

@atrib/agent has one interceptor and a helper for each framework. Make the interceptor once. merchantDomain and serverUrls are optional: at session start the interceptor fetches the merchant's and each tool server's attribution policy from /.well-known/atrib-policy.json.

import { atrib } from '@atrib/agent'

const interceptor = atrib({
  creatorKey: process.env.ATRIB_PRIVATE_KEY!,
  merchantDomain: 'https://merchant.example.com',
  serverUrls: ['https://search.example.com'],
})

Then hand it to the helper for your framework:

FrameworkHelper
MCP TypeScript SDK clientwrapMcpClient(client, interceptor, { serverUrl })
Claude Agent SDK, in-process toolsWrap the McpServer with @atrib/mcp's atrib()
Claude Agent SDK, third-party MCPcreateAtribProxy({ name, upstream, atrib }) from @atrib/mcp
Cloudflare AgentsattributeCloudflareAgentMcp(agent, { interceptor, serverUrls })
Vercel AI SDK MCPattributeVercelAiSdkMcp(mcpClient, { interceptor, serverUrl })
LangChain JS MCPattributeLangchainMcp(multiClient, { interceptor, serverUrls })

The two Claude Agent SDK rows sign on the server side with @atrib/mcp and take no interceptor. @atrib/agent does not depend on any of these frameworks. Install the one you use alongside it. Mastra has a working proof but no helper yet, and the OpenAI Agents SDK is planned. Each helper has a runnable example in packages/integration/examples.

Wrap a server you do not own

@atrib/mcp-wrap runs any MCP server behind a signing boundary. Write a config file that names the upstream:

filesystem.json
{
  "name": "filesystem",
  "upstream": {
    "type": "stdio",
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
  },
  "serverUrl": "mcp://filesystem.local"
}

Then point your MCP host at atrib-wrap instead of the server's own command, with the config file's absolute path as the argument. A relative path breaks when the host starts the server from another folder.

MCP host config
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@atrib/mcp-wrap", "/absolute/path/to/filesystem.json"],
      "env": { "ATRIB_PRIVATE_KEY": "<your private key>" }
    }
  }
}

The agent loop and the tool schemas stay the same, and the wrapper never changes the upstream result. After each successful call it signs one record that commits to the tool's name as a hash and to the arguments and result as salted hashes. A tool set to injectReceiptId: true in the config's tools map gets a pair instead, unless the config sets evidenceMode: 'minimal' or its own disclosure: a request record signed before the call, whose receipt id is passed to the upstream, and an outcome record linked to it.

The wrapper derives each record's content_id from <serverUrl>/<agent> and the tool name. agent defaults to claude-code, so the example uses mcp://filesystem.local/claude-code. The key comes from ATRIB_PRIVATE_KEY, a key file, the macOS Keychain, 1Password or a signer socket, and the wrapper refuses to start when none of them gives one, so a missing key shows up at once.

Agent runtimes

Claude Code, Codex, Cursor and other runtimes own more than tool calls: sessions, hooks, approvals and subagents. For those, combine the pieces: @atrib/mcp-wrap for MCP tools, atrib-attest-cli for hook events, @atrib/openinference for OpenInference spans, and @atrib/runtime-log for bounded windows of a run log.