# Writ MCP server

> Enforces policy checks for AI agent writes with ALLOW, DENY, or STEP_UP decisions and a tamper-evident audit log.

- Repository: https://github.com/withwrit/pywrit
- Page: https://hostedmcp.org/servers/withwrit/writ
- Transport: stdio
- Stars: 2
- License: MIT
- Latest version: 0.2.2

## Install

### Claude Code

```sh
claude mcp add --env WRIT_API_KEY=<YOUR_WRIT_API_KEY> --env WRIT_SPONSOR_TOKEN=<YOUR_WRIT_SPONSOR_TOKEN> writ -- uvx writ-mcp
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "writ": {
      "command": "uvx",
      "args": [
        "writ-mcp"
      ],
      "env": {
        "WRIT_API_KEY": "<YOUR_WRIT_API_KEY>",
        "WRIT_SPONSOR_TOKEN": "<YOUR_WRIT_SPONSOR_TOKEN>"
      }
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "writ": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "writ-mcp"
      ],
      "env": {
        "WRIT_API_KEY": "<YOUR_WRIT_API_KEY>",
        "WRIT_SPONSOR_TOKEN": "<YOUR_WRIT_SPONSOR_TOKEN>"
      }
    }
  }
}
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "writ": {
      "command": "uvx",
      "args": [
        "writ-mcp"
      ],
      "env": {
        "WRIT_API_KEY": "<YOUR_WRIT_API_KEY>",
        "WRIT_SPONSOR_TOKEN": "<YOUR_WRIT_SPONSOR_TOKEN>"
      }
    }
  }
}
```

### Codex (`~/.codex/config.toml`)

```toml
[mcp_servers.writ]
command = "uvx"
args = ["writ-mcp"]

[mcp_servers.writ.env]
WRIT_API_KEY = "<YOUR_WRIT_API_KEY>"
WRIT_SPONSOR_TOKEN = "<YOUR_WRIT_SPONSOR_TOKEN>"
```

### Gemini CLI (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "writ": {
      "command": "uvx",
      "args": [
        "writ-mcp"
      ],
      "env": {
        "WRIT_API_KEY": "<YOUR_WRIT_API_KEY>",
        "WRIT_SPONSOR_TOKEN": "<YOUR_WRIT_SPONSOR_TOKEN>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `WRIT_API_KEY` | yes | yes | Writ API key (get one free at https://withwrit.com) |
| `WRIT_SPONSOR_TOKEN` | no | yes | Writ sponsor token, only required for sponsor tools (grant, revoke, reinstate) |
| `WRIT_BASE_URL` | no | no | Optional custom Writ API base URL (default: https://api.withwrit.com) |

## Tools (17)

- `writ_check`
- `writ_verify_token`
- `writ_lease`
- `writ_execute`
- `writ_grant`
- `writ_receipts`
- `writ_policy`
- `writ_sandbox`
- `writ_github_installations`
- `writ_github_set_threshold`
- `writ_github_toggle_pr_comments`
- `writ_manifests`
- `writ_explain_receipt`
- `writ_tenant_notify`
- `writ_principals`
- `writ_verbs`
- `writ_keys`

## FAQ

### What are the possible outcomes of a write check?

The agent receives an ALLOW, DENY, or STEP_UP decision.

### How can I test Writ without an API key?

You can use the writ_sandbox tool for a free 90-second demo grant.

### What happens during a STEP_UP decision?

A human sponsor must approve the action via writ_grant or the dashboard before the agent can proceed.
