Skip to main content
Glama

XWatch: open-source app security for coding agents that alerts only on a proven exploit

License: AGPL-3.0 npm xtarwall/xwatch MCP server

XWatch is a free, open-source security check for your app and every change you make to it. Ask your coding agent to check your app, or run xwatch check: with no setup and no AI key, XWatch maps your app, finds the weak spots and writes the fix your coding agent can apply. It raises an alert only when a test actually reproduced the problem: no exploit, no alert. Everything else is a Suspected finding, shown with its fix. It runs on your laptop, in CI, or inside Claude Code, Codex and Cursor as an MCP server. The client is open source; its brain is a free Xtarwall service that receives a coded summary of your app, never your code (How XWatch works).

What it does

  • Change-aware. Scans staged, unstaged and untracked changes against HEAD or a base branch, not the whole repo every time.

  • Four honest states. Every finding is Confirmed (a test reproduced it, with proof), Suspected, No issue or Not assessed. Only Confirmed is an alert.

  • Passive by default. Nothing is executed against anything until you give consent for one named target and a live scope grant; active tests run only against the short-lived copy you name, never production.

  • No AI key to start. The zero-config check and the offline checks use no AI model. The expert path uses your own key: Anthropic, OpenAI, Google Gemini or Groq. With no key set, every model call goes to an offline mock and costs nothing; a paid call needs a run budget you set.

  • Built for the flaws that cost money. Free credits drained, browser-only quotas, AI endpoints anyone can call on your bill, one tenant reading another's data.

The engine behind it, measured

These are results of Xtarwall's engine (the recipe layer and the full engine), not of an xwatch run on your machine. XWatch carries the same "no exploit, no alert" rule. Last re-run: 29 Nov 2026.

Public test app

Pinned commit

Classes found, of those in our test plan

Safe controls that raised an alert

Run layer

crAPI: REST API with a shop, coupons and a store credit

b5fc307f3e5f

5 of 5

0 of 5

Full engine: proof stored per finding, signed ledger

VAmPI: REST API (Flask)

f16052dce83f

5 of 5

0 of 5

Recipe layer, then the full engine with a signed ledger

DVGA: GraphQL API (Flask)

a961308c02d1

6 of 6

0 of 6

Recipe layer (no ledger on this run)

Total

16 of 16

0 of 16

  • 16 of 16 classes confirmed by running the exploit (crAPI 5 of 5 · VAmPI 5 of 5 · DVGA 6 of 6), with 0 of 16 safe controls raising an alert.

  • 3 of 3 money flaws proven on crAPI, each with a stored proof in a signed ledger of 35 hash-chained events.

  • Recall is per app, against the classes in our test plan for that app, not against every weakness the app documents. crAPI documents 18 challenges; this run attempted 4 of them and confirmed all 4. The others were not attempted, so they count neither as found nor as missed.

Definitions, pinned versions and misses: how we measured.

Related MCP server: secretscan-mcp

Try it: one command, a real proof

The demo boots a fictional vulnerable app, attacks it, and checks that the safe version of each feature stays quiet. Offline, no AI key, no spend.

git clone https://github.com/xtarwall/xwatch
cd xwatch
node --experimental-strip-types demo/run.ts

It prints the proven attacks and the false alarms, then PASS (or exits non-zero on any failure).

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/.

Add it to Claude Code (Codex and Cursor are in Add it to your coding agent below):

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

Point it at your app

  1. Ask your agent to check your app (the xtarwall_check_app tool), or run xwatch check. XWatch maps the app itself; the first time, it asks once before anything leaves your machine (How XWatch works).

  2. Expert path: describe exactly what to check yourself with DH_CANDIDATES (your candidate list) and DH_TARGET (the target your grants name).

  3. To allow active tests on that one target: a live scope grant in DH_GRANTS, and DH_MCP_ACTIVE_CONSENT set to exactly DH_TARGET, confirming written authorisation (CONSENT.md).

Every variable is in Environment below.

How XWatch works

XWatch has two parts. The client in this repository is open source; its brain is a free Xtarwall service.

  • The open client maps your app on your machine. It finds your routes, what guards them and what they touch (database, payments, AI calls, files), with no setup and no AI key.

  • The free brain picks the checks. The client sends it a coded summary of that map and gets back Suspected weak spots, each with its severity and the steps to fix it. The brain uses no AI model, never reads or runs your code and attacks nothing.

  • What leaves your machine. Only the coded summary: no code, no file names, no route names. With it go a random install id and a repository tag that cannot identify the repository; each call is signed by a key that stays on your machine. xwatch check --show-payload prints exactly what would be sent, and sends nothing. XWatch keeps a copy of each summary it sends in ~/.xwatch/sent/; xwatch sent --last prints the last one.

  • One yes, once. Nothing leaves your machine until you allow the brain the first time, in your coding agent or with xwatch brain allow. Take it back at any time with xwatch brain off. xwatch brain status shows your install id and today's use.

  • Offline mode. When the brain is off, unreachable, over its limits or not yet allowed, XWatch still maps your app and runs a small set of public checks in the client, and the expert path works as before. The report says so: "Offline: public checks only. The free Xtarwall brain checks more."

  • Free limits. 20 brain checks a day for each repository and 3 repositories a day, for each install. A day is a calendar day in UTC (the limits reset at 00:00 UTC). Over a limit, XWatch runs its offline checks.

  • The rules. Using the brain means you accept the Brain API Terms. What the brain receives and keeps, and for how long: Privacy Policy, section 3.2A.

The four Xtarwall products

XWatch is one of four Xtarwall products, each with its own job:

  • XWatch: Detect. This repository, free. Maps your app, finds suspected weak spots and writes the fix.

  • XGuard: Prove. Runs the real attack on a short-lived copy of your app (never production), on every push, and keeps a signed, hash-chained record of each finding that you can re-check.

  • XShield: Protect. Guards your live app: known attacks blocked, repeat sources slowed. Starts in observe mode; alerts at any hour.

  • XDefeat: Defeat. Sets traps inside your own app, such as decoy keys that alert the moment someone touches them. It never contacts or attacks the attacker's machine.

XGuard, XShield and XDefeat are separate hosted products, in early access: xtarwall.com/pricing.

Add XDefend

XWatch finds weak spots; XDefend (@xtarwall/xdefend, free, open source, Apache-2.0) guards the running app: every request is checked inside your own process against a short list of attack signatures, in observe mode first (nothing blocked, matches logged), block when you are ready. It is the in-app guard XShield builds on, and it has no network code.

Ask your coding agent to "add XDefend to this app" (the xtarwall_add_xdefend tool), or run xwatch defend. XWatch maps the app on your machine, detects the framework and returns the install command, the exact lines for it in observe mode and the file they go in, how to switch to block later, two or three decoys picked from your app's map (an unlinked admin-looking route that none of your routes serves, a canary key you configure only by its sha256, a honey record on a route that reads customer data) and what XDefend does not cover. XWatch never edits your code and makes no network call for this; your agent applies the steps after you ask.

Express, Connect, node:http and Cloudflare Workers are XDefend's documented runtimes; Fastify and Hono use the guard's public decide() from a hook or middleware on those runtimes. Next.js is not a documented XDefend runtime: the steps say so, use its middleware (proxy.ts from Next.js 16) and list what that setup misses. For a framework XWatch does not recognise, it says so instead of guessing.

What it doesn't cover yet

XWatch is not the full engine: no hosted checks on every push, no live protection, and its findings output is redacted (no proof-of-concept, only a digest prefix). The harness behind the numbers above and the ledger verifier are not public yet. None of those results come from a customer's app. All stated gaps.

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. Expert path. Without it, xwatch check maps the app itself (zero-config) and a change scan lists the changed files.

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
xwatch scan [--repo dir] [--base ref|auto] [--sarif file] [--comment file] [--json] [--fail-on confirmed|never]

xwatch scan runs one change scan from the command line or CI. It uses the same logic and the same gates as the scan_changes tool, and takes its config from the same environment variables. It is passive unless you also pass --active and the environment grants it (see above).

  • --repo: the repo folder (default: the current folder).

  • --base: diff against the merge-base of this branch, tag or commit and HEAD (default: HEAD, which means uncommitted changes). auto means the last commit when it exists, else uncommitted changes.

  • --sarif: write SARIF 2.1.0 to this file. Only Confirmed findings become results.

  • --comment: write the pull-request comment as Markdown. The proof is always redacted there; finding text is escaped.

  • --json: print the redacted result as JSON.

  • Exit codes: 0 ok, 1 a Confirmed finding (with --fail-on confirmed, the default), 2 error or bad arguments.

  • Code under review never configures its own review: DH_CANDIDATES (a module XWatch imports), DH_GRANTS (scope grants), DH_KEY_DIR and DH_MCP_LEDGER_DIR are refused when they sit anywhere in the scanned repo's work tree, and output files must be written outside it. Output files are written atomically and never through a symlink.

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.

GitHub Action

Add XWatch to your pull requests with one workflow file, .github/workflows/xwatch.yml:

name: XWatch
on: pull_request            # never pull_request_target
permissions:
  contents: read
  security-events: write    # SARIF upload to code scanning
  pull-requests: write      # the one XWatch comment
jobs:
  xwatch:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          fetch-depth: 0              # the base commit must exist
          persist-credentials: false  # XWatch refuses a repo whose git config pulls in other files
      - uses: xtarwall/xwatch@v0

It scans the pull request's changes against its base, writes SARIF and uploads it to code scanning, posts or updates one comment on the pull request, and fails the job only on a Confirmed finding. The free mode needs no secret: it is passive, makes no network call for the scan and spends nothing.

Input

Default

Meaning

base

the pull request's base sha (on push: the before sha)

Commit or ref to diff against.

fail-on

confirmed

confirmed fails the job on a Confirmed finding; never only reports.

upload-sarif

true

Upload SARIF to code scanning. Set false on a private repo without code scanning.

comment

true

Post or update one comment on the pull request.

ai-key

(none)

Your own model key, from a secret. Used only together with run-budget-cents.

ai-provider

anthropic

anthropic, openai, gemini or groq.

run-budget-cents

(none)

Spending cap per run in whole cents. Unset means no paid model call.

On a private repo, also add actions: read to permissions: (the SARIF upload needs it there). The comment is posted with the job's own GITHUB_TOKEN, so there is always exactly one XWatch comment per pull request.

Outputs: exit-code, confirmed, sarif-file. Candidates, grants and the other variables in the table above come from the job's env:, and must point outside the checkout (for example a file your workflow writes under $RUNNER_TEMP from a secret or a trusted branch). Without DH_CANDIDATES a run lists the changed files and assesses nothing, and the comment says so (it never shows a pass for a run that assessed nothing). On a pull request from a fork (or from Dependabot) the token is read-only, so the upload and the comment are skipped with a notice and the result is in the job summary. Every input reaches the shell only through environment variables, and third-party actions are pinned to full commit shas.

The SARIF 2.1.0 and pull-request comment renderers are also library modules (dist/engine/src/report/).

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

Other Xtarwall products

XWatch is free and open source, and its brain is a free service. XGuard (Prove), XShield (Protect) and XDefeat (Defeat) are separate hosted products: 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). To contribute, see CONTRIBUTING.md: we ask for a one-time contributor licence agreement before your first pull request is merged.

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.


XWatch is part of Xtarwall. An Xtarvrse company. Licence: AGPL-3.0.

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