Skip to main content
Glama

XWatch

XWatch is an open-source security check for coding agents. Before you push or deploy, it looks at what changed in your local git repo, works out which of your declared security candidates the change reaches, assesses them and returns findings your agent can act on. It runs on your own laptop or CI, inside your coding agent as an MCP server (stdio) or as an A2A agent (loopback HTTP), with your own AI key. Nothing is hosted.

Install

Requirements: Node.js 22.6 or newer and git 2.40 or newer.

npx -y @xtarwall/xwatch mcp          # run it without installing
npm install -g @xtarwall/xwatch      # or install the `xwatch` command
xwatch --help

Or use the one-line installer shown at https://xtarwall.com/watch/.

From a clone of this repository: run npm install once, then node --experimental-strip-types bin/dh.ts mcp (TypeScript runs through Node's type stripping). npm run build writes the compiled JavaScript to dist/.

Related MCP server: secretscan-mcp

Add it to your coding agent

Every agent runs the same command, xwatch mcp (or npx -y @xtarwall/xwatch mcp without a global install). DH_MCP_ALLOWED_ROOTS limits which folders may be scanned; set it to where your code lives.

Claude Code:

claude mcp add xwatch --scope user -e DH_MCP_ALLOWED_ROOTS="$HOME/code" -- npx -y @xtarwall/xwatch mcp

Codex:

codex mcp add xwatch --env DH_MCP_ALLOWED_ROOTS="$HOME/code" -- npx -y @xtarwall/xwatch mcp

Cursor (~/.cursor/mcp.json, or .cursor/mcp.json in a project), and any other MCP client that takes a JSON config:

{
  "mcpServers": {
    "xwatch": {
      "command": "npx",
      "args": ["-y", "@xtarwall/xwatch", "mcp"],
      "env": { "DH_MCP_ALLOWED_ROOTS": "/path/to/your/code" }
    }
  }
}

Configs written for 0.1.x that run xtarwall-watch mcp keep working: the alias runs the same program.

The four tools

MCP tool

A2A skill

What it does

xtarwall_scan_changes

scan_changes

Lists staged, unstaged and untracked changes in a local repo (against HEAD or the merge-base of baseRef), finds which configured candidates the change reaches, assesses them and returns four-state findings plus the signed-ledger check. Arguments: repoPath (absolute local path), baseRef?, paths?, active?.

xtarwall_get_findings

get_findings

The last scan's findings, redacted: no PoC, no target, no evidence; only a 16-hex-character prefix of the proof digest.

xtarwall_explain_finding

explain_finding

One finding (id like f1): what its state means, the CWE, what to do next.

xtarwall_status

status

Model mode and vendor, which model key variables are set (names only, never a value), the run budget, candidates, grants, whether active tests are allowed, the ledger.

Findings have four states: Confirmed (a test actually reproduced it, with proof), Suspected, No issue and Not assessed. Only Confirmed is an alert.

Nothing is executed against anything unless all of these hold:

  1. the agent calls xtarwall_scan_changes with active: true;

  2. you set DH_MCP_ACTIVE_CONSENT to exactly the value of DH_TARGET (your confirmation that written authorization for that one target is signed and the owner has a backup; see CONSENT.md);

  3. DH_GRANTS holds a live active scope grant for that target.

Otherwise every grant is capped at passive: the result is Suspected or Not assessed. Active tests run only against the ephemeral copy that your candidate's provisioner names. Tool arguments can narrow a scan but cannot grant scope: target, grants, candidates and keys come only from the environment you set.

Repo access is confined: repoPath must be an absolute local path in a git work tree (URLs and git@host: remotes are refused), symlinks that leave the repo are dropped, and DH_MCP_ALLOWED_ROOTS narrows which folders may be scanned. Git runs without a shell, with hooks, fsmonitor, filters, textconv and global config off, and a timeout.

Your own AI key

XWatch calls the model provider you choose, with your key, from your machine. Supported providers:

Provider

Key variable (or <NAME>_FILE with an absolute path to a key file, preferred)

Model id example

Anthropic

ANTHROPIC_API_KEY

claude-haiku-5-5

OpenAI

OPENAI_API_KEY

openai:gpt-5-nano

Google Gemini

GEMINI_API_KEY

gemini-3.5-flash-lite

Groq

GROQ_API_KEY

groq:openai/gpt-oss-20b

  • XTARWALL_MODEL_CHEAP and XTARWALL_MODEL_FRONTIER pick the model for each tier as [vendor:]model. Left unset, XWatch uses the defaults of the first provider that has a key (Anthropic, OpenAI, Google, then Groq).

  • A paid call also needs DH_RUN_BUDGET_CENTS (whole cents per run). Without it every paid call is refused before the provider is called, so nothing is spent.

  • Models are priced from a dated table. For a model the table does not know, set XTARWALL_MODEL_CHEAP_PRICE / XTARWALL_MODEL_FRONTIER_PRICE to "<in $/1M>,<out $/1M>"; without a price an unknown model is refused.

  • A vendor-neutral DH_MODEL_API_KEY (or XTARWALL_MODEL_KEY_FILE) is used only when every tier names the same vendor, so a key is never sent to another vendor's host. There is no base-URL variable: hosts are fixed.

  • With no key set, every model call goes to an offline mock and costs nothing.

xtarwall_status shows which vendor and models are in use and which key variables are set, never their values.

Environment

Variable

Meaning

DH_CANDIDATES

Absolute path to a module that export defaults your candidate list (needs DH_TARGET). For the shape, see the test fixture. Without it a scan is a change summary only.

DH_TARGET

The scope target your grants name. Shown only as a sha256 prefix.

DH_GRANTS

Absolute path to a JSON array of {orgId, target, tier, expiresAt} scope grants.

DH_MCP_ACTIVE_CONSENT

Set to the exact DH_TARGET to allow active tests on it.

DH_RUN_BUDGET_CENTS

Run budget in whole cents (unset = no paid model call).

DH_ORG_ID, DH_APPLICATION_ID

Ledger ids (defaults local, local-repo).

DH_KEY_DIR

Absolute key directory for a persistent ledger signing key.

DH_MCP_LEDGER_DIR

Absolute directory (outside the repo) to also write each run's sealed chain.

DH_MCP_ALLOWED_ROOTS

:-separated absolute folders that may be scanned.

A .ts module in DH_CANDIDATES is loaded by your own Node, so it needs a Node that strips types for files outside node_modules (22.18+ or 23.6+ by default); a .js or .mjs module works everywhere.

Command line and CI

xwatch mcp                                    # stdio MCP server (what coding agents run)
xwatch a2a serve [--host h] [--port p] [--allow-remote]   # A2A 1.0 agent

As an A2A agent, for another agent or a CI job:

DH_A2A_TOKEN_SHA256_FILE=~/.xtarwall/a2a.sha256 xwatch a2a serve --port 8787

The Agent Card is at GET /.well-known/agent-card.json; JSON-RPC 2.0 is at POST /a2a/v1 with a bearer token whose sha256 is in that file. It binds to loopback unless you pass --allow-remote. Clients send A2A-Version: 1.0. In CI, start it in the job, call scan_changes on the checked-out repo, and fail the job on a Confirmed finding.

The package also ships SARIF 2.1.0 and pull-request comment renderers as library modules (dist/engine/src/report/). This release has no command that writes SARIF or posts a PR comment for you; a CI script can import them.

Signed record

Every scan seals start and finish events (plus each assessment's own events) onto an Ed25519 hash-chained ledger and verifies the chain before answering.

Tests

npm test

Hosted plans

XWatch is free and open source. XGuard and XShield are the hosted, paid plans: https://xtarwall.com/pricing/.

Security and licence

Report a vulnerability in XWatch privately as described in SECURITY.md. Use XWatch only on systems you own or are authorized to test (CONSENT.md).

XWatch is licensed under the GNU Affero General Public License, version 3 only (AGPL-3.0-only). In plain words:

  • Free to use and modify. Run it on your laptop, in CI or inside your coding agents, and change it as you like.

  • Share your changes if you serve them. If you run a modified version as a service for other people (over a network, for example), you must publish your changes under the same licence. The same applies if you hand a modified copy to someone else.

  • Commercial licences on other terms are available on request: email licensing@xtarwall.com.

LICENSE holds the full, binding text and NOTICE the copyright notice; this summary does not replace them.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables scanning diffs or code blobs for leaked secrets, returning a verdict with severity and masked findings, all processed locally with no data sent externally.
      1
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to scan a working tree and git history for committed credentials without exposing raw secrets, returning redacted findings and provider-specific rotation, misuse-check, and clean-up guidance.
      6
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to inspect git working trees and history for exposed credentials without letting raw secrets reach the model, with false-positive filtering, baseline support, and remediation guidance.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Lets agents scan local source, public GitHub repositories, or live URLs for security and quality findings, returning compact, false-positive-reduced summaries with locations, evidence, impact, and fixes, plus optional dependency audit and model-based triage.
      PolyForm Noncommercial 1.0.0