Corridor

integrate

Metering, pricing, and policy — in one wrap()

Corridor instruments your service so every agent call is authorized, priced, and metered against a per-agent identity before your code runs. You bring your service; agents bring their own credential. The SDK is a thin client — pricing and policy live in the engine.

mcp servers

One line

Call wrap() once on your @modelcontextprotocol/sdk server. Every tool invocation is authorized, metered, and priced per-agent before your handler runs — your handlers stay untouched.

any node api

Three calls

Not on MCP? Use the low-level client directly: authorize() before the work, capture() on success, void() on failure. The same engine, sequenced by you.

Quickstart — wrap an MCP server

Three prerequisites, then one call. The package @corridor/mcp is published from this repo today; once it ships to npm the install is the usual pnpm add @corridor/mcp.

Node.js 20.11+

Zero mandatory runtime deps; stdlib crypto only.

A provider secret key

sk_test_ for sandbox, created in the dashboard with authorize + capture scopes.

A published pricing rule

Its resource_id matches the meter you send. For wrap(), the meter defaults to the tool name.

import { CorridorClient, wrap } from "@corridor/mcp";
import type { McpServerLike } from "@corridor/mcp";

const corridor = new CorridorClient({ apiKey: process.env.CORRIDOR_API_KEY });

// One call instruments the whole server. The "as unknown as
// McpServerLike" cast is expected on v0; tools must register with a
// non-empty inputSchema for instrumentation to dispatch correctly.
wrap(server as unknown as McpServerLike, corridor, {
  currency: "usd",
  pricing: {
    tools: { search_corpus: { type: "flat", amount_cents: 10 } },
    default: "deny",
  },
  // Omit in production: the default resolver reads the agent's OAuth sub.
});

See your first metered event

The whole product in one loop — per-agent, observable, metered before the work ran.

1Start your server and have an agent call the tool once.
2Open the provider dashboard → Events.
3Watch one authorize → capture appear, attributed to an agent identity, at the amount you priced.

Go deeper

The full integration guide covers the low-level client, the typed error hierarchy, observability hooks, and every v0 gotcha. The clickable demo is a working MCP server you can drive end to end.