writ

v0.2.8
io.github.withwrit/writ Checked 1 day ago Published 6 days ago

Policy checks for AI agent writes (ALLOW/DENY/STEP_UP) with a tamper-evident audit log.

The Writ gate as an MCP server. Give any MCP-compatible agent point-of-action control: the agent calls Writ before a consequential write, gets back ALLOW, DENY, or STEP_UP, and every outcome creates an audit receipt. Requires Python 3.9+. Installs the writ-mcp command (stdio transport). Claude Desktop (claude_desktop_config.json):

Summary extracted from the README.

writ-mcp

The Writ gate as an MCP server. Give any MCP-compatible agent point-of-action control: the agent calls Writ before a consequential write, gets back ALLOW, DENY, or STEP_UP, and every outcome creates an audit receipt.

Install

pip install writ-mcp

Requires Python 3.9+. Installs the writ-mcp command (stdio transport).

Configure

export WRIT_API_KEY="writ_..."        # required; get one free: POST /v1/keys with an email
export WRIT_SPONSOR_TOKEN="..."       # only for sponsor tools (grant, revoke, reinstate)
# export WRIT_BASE_URL="..."          # default: https://api.withwrit.com

Add to your agent

Claude Code:

claude mcp add writ --env WRIT_API_KEY="$WRIT_API_KEY" -- writ-mcp

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "writ": {
      "command": "writ-mcp",
      "env": { "WRIT_API_KEY": "writ_..." }
    }
  }
}

Any MCP client (generic stdio config):

{
  "command": "writ-mcp",
  "env": {
    "WRIT_API_KEY": "writ_...",
    "WRIT_SPONSOR_TOKEN": "writ_sp_..."
  }
}

Hermes (NousResearch/hermes-agent) catalog entry — once published, this package is installable from the optional-mcps catalog:

hermes mcp install writ

The check-before-write loop

The tool descriptions teach the agent this flow, but the short version:

  1. writ_check(sponsor_id, agent_id, verb, target, purpose) — before the write.
  2. ALLOW → you get a 90-second authToken bound to that exact write.
  3. writ_verify_token(auth_token, verb, target, purpose) — immediately before executing, to prove the authorization still matches what you're doing.
  4. DENY → do not proceed. STEP_UP → a human sponsor approves (via writ_grant or the dashboard), then check again.
  5. writ_lease(auth_token, system_id, method, path, body) - convert the ALLOW token into a single-use lease bound to the exact upstream request.
  6. writ_execute(lease_id, method, path, body) - run the gated write with the same method/path/body; the gate forwards it with the vaulted credential and returns the upstream response verbatim.

Tools

Tool Who What
writ_check agent Decision + 90s purpose-bound token
writ_verify_token agent Point-of-action token verification
writ_lease agent Convert an ALLOW token into a single-use gated-execution lease
writ_execute agent Run one gated upstream request with a lease or ALLOW token
writ_grant sponsor Approve a STEP_UP (one-time grant)
writ_revoke / writ_reinstate sponsor Kill switch on/off for a principal
writ_receipts agent Audit trail of decisions
writ_verify_receipts agent Verify the audit-log hash chain
writ_policy agent Tenant verb policy
writ_policies agent List the tenant default plus every environment and principal override
writ_policy_env agent Read or set one environment's sparse override (plus effectivePolicy and policyProvenance)
writ_policy_principal agent Read or set one principal's sparse override; inherit unsets a verb; tombstoned or disabled principals fail closed
writ_sandbox anyone Free 90-second demo grant, no key needed
writ_github_installations admin List connected GitHub App installations
writ_github_set_threshold admin Set the check-run fail threshold per install
writ_github_toggle_pr_comments admin Enable/disable the PR-comment bot
writ_manifests agent List repos with risk profiles or fetch one manifest
writ_scan anyone Scan a local directory for consequential writes (Python, TS/JS, Go), no gate call and no API key. Prerequisite: the pywrit scanner installed in the same Python environment (pip install "pywrit[polyglot]"). Findings capped at max_findings (default 25)
writ_explain_receipt agent Explain a receipt in plain language
writ_tenant_notify admin Get or update step-up notification settings
writ_principals admin List the tenant's principals
writ_verbs admin List the tenant's verb vocabulary
writ_keys admin List API key metadata
writ_me admin Who the API key belongs to: tenant, key email and plan, policy summary, monthly receipt usage
writ_badge_token agent Mint a public README badge token
writ_badge_revoke agent Revoke a badge token; its badge image URL 404s
writ_tenant_invite admin Mint/rotate the tenant's one live team invite code (writ_inv_...)
writ_join_tenant anyone Join a tenant with an invite code; issues an API key, no key needed first

Try it with no key: writ_sandbox → writ_check with verb="demo_write".

Source

Public repo: withwrit/pywrit (mcp/ directory). License: MIT.

Directory listings: Glama · MCP Registry io.github.withwrit/writ.