This server gives any MCP host (Claude Desktop, Claude Code, Cursor, your own Agent SDK app) one tool: log_action. The model calls it to put a step on the record.
Know what this proves. A tool is something the model chooses to call. That is fine for an agent you instruct to keep a log, but it is not evidence that nothing else happened. For a record the model cannot skip, run the Ovelin MCP gateway instead: it sits in the transport path between the host and your other MCP servers and records every call, and it can block calls by policy. Many teams run both.
Prerequisites
- Node.js 22.6 or later.
- An MCP host.
1. Get an API key
- In Ovelin, open Settings → API keys.
- Under Ingest key, create a key and copy it. It is shown once; Ovelin keeps only a hash.
- Copy the Organization ID from the same page.
Put all three values in your environment, not in code:
export OVELIN_URL="https://your-ovelin-host" # http://localhost:3000 for a local instance
export OVELIN_ORG_ID="your-organization-id"
export OVELIN_API_KEY="agl_live_…"An organization key can report for any agent. For production, give each agent its own key under Settings → API keys → Agent keys: a leaked agent key can then only write as that one agent, and you can revoke it alone.
2. Install
cd examples/node
npm install @modelcontextprotocol/sdk zodYou also need examples/node/ovelin.ts from the Node guide next to the server.
3. Minimal working example
// An MCP server that exposes Ovelin logging as a tool: log_action.
//
// Any MCP host (Claude Desktop, Claude Code, Cursor, an Agent SDK app) can
// start it over stdio. The model calls log_action to put a step on the record.
//
// A tool is something the model chooses to call. For a record the model cannot
// skip, put the Ovelin MCP gateway in the transport path instead (see the guide).
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
import { logEvent } from "./ovelin.ts";
const server = new McpServer({ name: "ovelin", version: "1.0.0" });
server.registerTool(
"log_action",
{
title: "Record an action in Ovelin",
description:
"Record an action you took (or attempted) in the organization's tamper-evident audit trail. " +
"Call it after every action that changes something outside this conversation.",
inputSchema: {
agent: z.string().describe("Your agent name, the same on every call"),
action: z.string().describe("What you did, in snake_case, e.g. refunded_order"),
outcome: z.enum(["success", "failure", "unknown"]).default("success"),
data_accessed: z
.array(z.enum(["customer_pii", "financial_data", "health_data", "internal_documents", "external_apis", "none"]))
.optional()
.describe("Kinds of data the action touched"),
details: z.record(z.string(), z.unknown()).optional().describe("Anything else worth keeping: ids, amounts"),
},
},
async ({ agent, action, outcome, data_accessed, details }) => {
try {
const rec = await logEvent(agent, action, { outcome, dataAccessed: data_accessed, metadata: details });
return { content: [{ type: "text", text: `Recorded as seq ${rec.seq}, seal ${rec.hash.slice(0, 16)}…` }] };
} catch (e) {
return { isError: true, content: [{ type: "text", text: `Not recorded: ${(e as Error).message}` }] };
}
},
);
await server.connect(new StdioServerTransport());Register it with your host. For Claude Desktop or Claude Code (.mcp.json):
{
"mcpServers": {
"ovelin": {
"command": "node",
"args": ["/absolute/path/to/examples/node/mcp-server.ts"],
"env": {
"OVELIN_URL": "https://your-ovelin-host",
"OVELIN_ORG_ID": "your-organization-id",
"OVELIN_API_KEY": "agl_live_…"
}
}
}
}4. Check it before adding it to a host
mcp-client.ts starts the server the way a host does, lists its tools and calls log_action once:
// Starts mcp-server.ts the way an MCP host would, lists its tools and calls
// log_action once. Use it to check the server and your key before adding the
// server to a host.
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
const transport = new StdioClientTransport({
command: process.execPath,
args: ["mcp-server.ts"],
env: process.env as Record<string, string>,
});
const client = new Client({ name: "ovelin-check", version: "1.0.0" });
await client.connect(transport);
const { tools } = await client.listTools();
console.log("tools:", tools.map((t) => t.name).join(", "));
const result = await client.callTool({
name: "log_action",
arguments: {
agent: "support-agent",
action: "refunded_order",
outcome: "success",
data_accessed: ["financial_data"],
details: { order: "8812", amount_eur: 42 },
},
});
console.log(result.isError ? "error:" : "ok:", (result.content as { text: string }[])[0].text);
await client.close();
if (result.isError) process.exit(1);node mcp-client.ts
# tools: log_action
# ok: Recorded as seq 15, seal c57a6903644b0a3d…5. Check it in Ovelin
- Open Activity. The newest rows are the events you just sent, each with a sequence number and a seal.
- Click one. The detail panel shows the payload as received; Recompute seal checks its seal again.
- Open Agents: an agent name Ovelin had not seen before is registered automatically, without an owner. Give it one so someone is accountable for it.
To confirm nothing was altered later, open Integrity. It recomputes every seal and every link between records, and reports Trail intact.
Common errors
| Response | Cause | Fix |
|---|---|---|
401 Invalid API key | The key is wrong, revoked, or belongs to another organization. | Create a key in Settings → API keys and check OVELIN_ORG_ID is the same organization's. |
401 Missing API key (use Authorization: Bearer <key>) | The Authorization header was not sent. | Send Authorization: Bearer $OVELIN_API_KEY. The key never goes in the body. |
422 Payload must include a 'source' field | The JSON has no source. | Add "source": "custom" (or n8n, make_com, openai_api, zapier). |
422 Invalid option: expected one of "success"|"failure"|"unknown" | outcome has another value, such as warning. | Use success, failure or unknown. |
400 Invalid organization id | OVELIN_ORG_ID is not the organization's UUID. | Copy the Organization ID from Settings → API keys. |
429 Rate limit exceeded | More than 600 events a minute for one organization. | Retry after the Retry-After header. To send many events, use the batch endpoint (up to 100 per request). |
| Host shows the server as failed | It printed to stdout, which corrupts the stdio protocol. | Log to console.error only. |
Tool returns Not recorded: … | Ovelin refused the event; the reason follows. | Fix per the rows above. The error is returned to the model rather than thrown, so the agent can carry on. |
The model never calls log_action | Nothing in its instructions asks it to. | Say when to call it in the system prompt, or use the gateway, which needs no cooperation. |
How this guide is tested
Every code block above is copied from examples/node/mcp-server.ts by node scripts/sync-guide-snippets.mjs, and pnpm examples:test runs mcp-client.ts against it against a local Ovelin and checks the events were sealed.

