MCP

Tools for the agent that buys.

The tools stop exactly where the API stops: a reserved act never resolves in-band. The tool call returns waiting_on_signer, and the Matter moves again only when the Signer’s outcome comes back through the Gig seam.

Setup

The published package runs a stdio MCP server with zero dependencies. Point any MCP client at it.

run the server
$ npx -y api.lawyer mcp serve
client config
{  "mcpServers": {    "api.lawyer": {      "command": "npx",      "args": ["-y", "api.lawyer", "mcp", "serve"]    }  }}

Tools

Three tools carry the demand loop; three more read the surface. A reserved act never resolves in-band: the call returns waiting_on_signer.

healthzread

Liveness of the api.lawyer surface. Keyless.

getread

GET any api.lawyer path (the data tier is keyless — e.g. /matters, /pricing, /openapi.json).

list_mattersread

List matters. Returns an AXP outcome envelope (type: OK | EMPTY | BLOCKED).

get_matterdemand loop

Fetch a Matter, its Asset, and the append-only journal — GET /matters/:id.

arguments
{ "matterId": "m_1" }
advance_matterdemand loop

One propose → gate → commit turn — POST /matters/:id/advance. Returns the escalation when the next act is reserved.

arguments
{ "matterId": "m_1" }
file_provisionaldemand loop

One-shot order on the patent rail: mints a Matter via POST /orders and advances it until it waits on a Signer or terminates.

arguments
{ "title": "string", "inventor": "string", "listFeeUsd": 99 }

Run from source

src/mcp.ts is a stdio MCP server named api.lawyer. It speaks HTTP to this service (API_LAWYER_URL, default localhost:4902) and exposes the demand loop as tools — so a consumer-side agent can file, watch, and advance a Matter without ever crossing the authority membrane.

run the server
$ npx tsx packages/api/src/mcp.ts
client config
{  "mcpServers": {    "api-lawyer": {      "command": "npx",      "args": ["tsx", "packages/api/src/mcp.ts"],      "env": { "API_LAWYER_URL": "http://localhost:4902" }    }  }}