Veefore docs

Reroute MCP calls with the CLI

A step-by-step guide to letting veefore integrate move a project's existing MCP calls onto Veefore, with a diff, backups and automatic rollback.

If your code already calls an MCP server with the official MCP SDK — client.callTool(…) — veefore integrate can move those calls onto Veefore for you. It shows you the change first, backs up every file, type-checks your project afterwards, and puts everything back if the check newly fails.

The result is the same code the SDK guide has you write: mcpServer('<server>').callTool(…).

You will need: Node.js 20.10 or newer, a TypeScript or JavaScript project that calls an MCP server over HTTP, and a Veefore account.

#Step by step

Set up the project

bash
npm install -g veefore
cd your-agent-project
veefore

Sign in when the browser opens and answer y. The CLI creates an agent for this project in the Development environment and writes .env.local and veefore.config.json. See the Quickstart for what each step shows.

Connect the same server in the console

The CLI only rewrites a call when it is sure which server it goes to, so the server must be registered with exactly the URL your code uses.

  1. Find the URL in your code — the one passed to new StreamableHTTPClientTransport(new URL('…')).
  2. In the console, set the Environment switcher to Development.
  3. Open MCP → Connect server, paste that URL, tick I know who runs this server and trust it, and click Connect.
  4. Tick your project's agent and the tools your code calls, then click Authorize N tools.

Install the SDK

bash
npm install @veefore/sdk@1.8.0

Install it first: the rewrite uses mcpServer(), which needs 1.8.0 or later. With an older SDK installed, the calls are listed with this command instead of changed, so the project keeps compiling.

Preview the change

bash
veefore integrate --dry-run

This shows the diff without writing anything. Each rerouted call looks like this:

diff
+import { mcpServer } from '@veefore/sdk';
 ...
-  const result = await client.callTool({ name: 'read_wiki_structure', arguments });
+  const result = await mcpServer('deepwiki').callTool({ name: 'read_wiki_structure', arguments });

Anything the CLI is not sure about is listed instead of changed, with the file, the line and the code to write (see What it will not change).

Apply it

bash
veefore integrate

integrate shows the same diff and asks before writing. It backs up each file, then runs your TypeScript compiler (--noEmit) or node --check. If a check newly fails, every file is restored automatically.

To undo it later:

bash
veefore undo

A file you edited after the change is left alone and listed, unless you add --force.

Run it, and check it worked

Run your agent as usual, with veefore dev in another terminal to watch the decisions. Open Actions in the console: each MCP call is listed with your agent and a tool named mcp_<server>_<tool>.

Then confirm nothing still goes around Veefore:

bash
veefore doctor

doctor fails a project that still calls an MCP server directly, with the file and line of each call.

Turn on protection

bash
veefore policies test
veefore deploy --mode ENFORCE --reason "MCP calls rerouted and reviewed"

Until then the environment is in Observe: calls run and are recorded, and nothing is blocked.

#What it will not change

The CLI rewrites a call only when it can be certain. It lists the rest, with the line to write, when:

  • The URL is not in the file, or does not match exactly one server registered in the agent's environment. Register the server with the exact URL, or make the change by hand.
  • The project defers approvals (VEEFORE_APPROVAL_MODE=defer) and the code reads the result. The result can now be "awaiting approval", so the code around it needs an isAwaitingApproval(…) check. See the SDK guide.
  • The code is Python. Python MCP sessions are always listed. Use guard_client().mcp_call(…) as shown in the SDK guide.

Running veefore integrate again changes nothing that is already rerouted.

Identity, authority, policy and enforcement for autonomous AI agents.