Add PEAC to an MCP Server
Attach a signed interaction record to every MCP tool response. Records travel in the _meta field, invisible to model context.
Install
pnpm add @peac/protocol @peac/crypto
Issue a record from a tool handler
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
import { issueWire02 } from '@peac/protocol'
import { generateKeypair } from '@peac/crypto'
import { z } from 'zod'
const { privateKey } = await generateKeypair()
const server = new McpServer({ name: 'my-server', version: '1.0.0' })
server.tool('lookup', { query: z.string() }, async ({ query }) => {
const { jws } = await issueWire02({
iss: 'https://my-server.example.com',
kind: 'evidence',
type: 'org.peacprotocol/access',
pillars: ['access'],
privateKey,
kid: 'peac-2026-03',
})
return {
content: [{ type: 'text', text: 'result' }],
_meta: {
'org.peacprotocol/receipt_jws': jws,
},
}
})The @peac/mcp-server package provides a ready-to-run MCP server with built-in receipt issuance and policy configuration.