---
title: "vetd MCP server setup for Claude Code, Cursor, Codex and VS Code"
description: "Add the vetd MCP server to Claude Code, Cursor, Codex, VS Code, Windsurf or Gemini CLI."
url: http://localhost:4173/mcp
updated: 2026-11-11
---

# vetd MCP server setup

> vetd is an MCP server. It gives your agent a `check` tool. The agent sends a diff and gets back TypeScript errors, [rule violations](http://localhost:4173/rules.md), affected routes and affected tests. Nothing is written to disk until the agent calls `commit`. Every client runs the same command: `npx --no-install vetd mcp`.

## Tools the agent gets

| Tool | Use |
| --- | --- |
| `check` | Check a diff for type errors and rule violations |
| `runTests` | Run the Vitest files the change affects |
| `impact` | List what uses a file or function |
| `explain` | Explain an error and how to fix it |
| `fork` | Try a second version of a change |
| `commit` | Write the change to disk |

All tools: [docs](http://localhost:4173/docs.md#mcp-tools).

## Automatic setup

```sh
npx vetd init
```

This writes `.mcp.json` and adds instructions to `AGENTS.md`. Commit both files. If your agent only reads `CLAUDE.md`, add the line `@AGENTS.md` to it.

## Claude Code

`npx vetd init` is enough. Or add it manually:

```sh
claude mcp add vetd -- npx --no-install vetd mcp
```

## Cursor, Windsurf and Gemini CLI

In `.cursor/mcp.json` or your client's MCP file:

```json
{ "mcpServers": { "vetd": { "command": "npx", "args": ["--no-install", "vetd", "mcp"] } } }
```

## Codex

In `~/.codex/config.toml`:

```toml
[mcp_servers.vetd]
command = "npx"
args = ["--no-install", "vetd", "mcp"]
```

## VS Code

In `.vscode/mcp.json`:

```json
{ "servers": { "vetd": { "type": "stdio", "command": "npx", "args": ["--no-install", "vetd", "mcp"] } } }
```

## Without MCP

```sh
git diff | npx vetd check --patch -
```

Output is JSON. Exit code 1 means the check failed.

## Text added to AGENTS.md

`init` adds this once and leaves the rest of the file unchanged:

```markdown
## vetd verification

This project uses vetd for fast TypeScript and framework checks. After changing code, call the vetd MCP `check` tool with a unified diff or whole-file writes. Changes stay in an in-memory fork until you call `commit`. Review `typeErrors`, `ruleViolations`, `recheck`, and `fallback`; do not treat an unsupported or failed check as a pass. Use `runTests` with scope `affected` for relevant Vitest tests. Use `explain` for a diagnostic ID and `impact` before changing shared exports. Run `verify` when the incremental result needs a second check; `verify` with `oracle: true` runs a slow independent full tsgo check. Keep the project's full build and CI checks as the release gate.
```

## FAQ

### Which agents work with vetd?

Any MCP client that uses stdio: Claude Code, Cursor, Codex, VS Code, Windsurf, Gemini CLI. Other agents can use `npx vetd check --patch -`.

### Does a check change my files?

No. Files change only when the agent calls `commit`.

### What if several agents run at once?

They share one vetd process per repository, including across git worktrees. Each agent session has its own changes and can't see the others'.

### What does a failed check return?

`ok: false`, with new type errors in `errors` and rule violations in `violations`. Each has a file and line. Errors that were already in the project are counted in `preexisting` and don't fail the check.

### Which folder does it check?

The folder you run it from. To set it, pass `--root /path/to/project`.
