becwright

Guides

MCP & JSON output

Machine-readable results for AI agents via check --json and the MCP server.

Who is this page for? People wiring becwright into an AI tool or a script. If you just want becwright to guard your commits, you don’t need any of this — the normal install already does that. Read on only if you want an AI agent (or some other program) to read becwright’s results.

becwright exposes its results in machine-readable form two ways: a JSON output for scripts, and an MCP server for AI agents. (MCP — Model Context Protocol — is a standard plug for giving AI tools extra abilities.)

becwright check --json

Same as becwright check, but prints a JSON summary instead of colored text and is consumable without parsing. Exit code is unchanged (1 if a blocking rule failed, else 0).

{
  "rule_count": 3,
  "checked_files": 1,
  "blocked": true,
  "results": [
    {
      "id": "no-debugger-js",
      "severity": "blocking",
      "passed": false,
      "intent": "Do not leave 'debugger;' in JavaScript/TypeScript code.",
      "why_it_matters": "A forgotten 'debugger' halts execution ...",
      "output": "app.js:1\n      > function f(){ debugger; }"
    }
  ]
}

This needs no extra dependency and works from the standalone binary too.

MCP server

becwright mcp runs a Model Context Protocol server over stdio, so any MCP-capable agent (Claude, Cursor, Windsurf, …) gets becwright as structured tools.

It requires the optional mcp extra:

pipx install "becwright[mcp]"     # or: pip install "becwright[mcp]"

Tools

ToolArgumentsReturns
checkall_files (bool), path (optional repo dir)the same summary as check --json
list_checksthe built-in checks as {name, description}

Client configuration

Point your agent’s MCP config at the command:

{
  "mcpServers": {
    "becwright": {
      "command": "becwright",
      "args": ["mcp"]
    }
  }
}

The MCP server ships only with the Python package (it is not in the npm binary). For CLI/hook usage without Python, keep using the npm install.