MAQPNADocs

Use MAQPNA from coding agents (MCP)

Add maqpna mcp serve to Claude Code, Cursor or Codex so a coding agent can look up MAQPNA schemas, scaffold manifests, and validate, lint and test policies offline.

maqpna mcp serve is an MCP server on stdio. It gives a coding agent the offline authoring commands as tools, so it can write a MAQPNA policy or manifest and check it before anything reaches a cluster. Every tool is read-only: it reads the local files you name and prints. Nothing is applied and nothing leaves the machine.

Add it to your agent#

Claude Code:

claude mcp add maqpna -- maqpna mcp serve

Cursor, Windsurf and other clients that read an mcpServers file (.cursor/mcp.json, for example):

{
  "mcpServers": {
    "maqpna": {"command": "maqpna", "args": ["mcp", "serve"]}
  }
}

Codex (~/.codex/config.toml):

[mcp_servers.maqpna]
command = "maqpna"
args = ["mcp", "serve"]

Tools#

Tool Runs Use it to
maqpna_explain maqpna explain TYPE [--recursive] Read a kind's or field's schema, e.g. toolpolicy.spec.rules.when
maqpna_init maqpna init KIND NAME [--from-sample S], or --list Start a manifest from a sample, e.g. toolpolicy-agent-purchases
maqpna_validate maqpna validate -f PATH ... Check manifests: schemas, policies, references
maqpna_policy_lint maqpna policy lint PATH ... Find shadowed rules, duplicates and what the operator would refuse
maqpna_policy_test maqpna -o json policy test --policy ... Get the decision for one tool call: action, rule and reason
maqpna_policy_test_suite maqpna policy test PATH Run maqpna-test.yaml suites and see each case pass or fail

Arguments that look like flags (a leading -) are refused, and - (stdin) is never read, because stdin carries the MCP messages.

A typical loop#

Ask the agent, for example, "write a MAQPNA policy that lets the shopper agent buy from our three vendors and holds anything over 1,000 USD for two finance approvers". It will usually:

  1. call maqpna_explain on toolpolicy.spec.rules to learn the fields;
  2. call maqpna_init with sample: toolpolicy-agent-purchases and edit the result into a file;
  3. call maqpna_validate and maqpna_policy_lint on that file;
  4. call maqpna_policy_test with a few orders and check each decision.

The sample and its suite are explained in Govern agent purchases and payments.

Last updated