MCP
Connect Model Context Protocol servers, authorize their tools one at a time, and use them from an MCP client with no code, from the SDK, or through the CLI.
Model Context Protocol servers expose tools to agents. Veefore treats an MCP server as an untrusted tool source: you register it, you discover what it offers, and then a human authorizes each tool individually.
Discovery and authorization are separate steps
A newly discovered MCP tool is unauthorized until someone authorizes it.
If discovery granted access, an MCP server could widen its own reach by adding a tool — you would connect to it for one capability and silently acquire however many it chose to expose later. Separating the steps means the server proposes and you decide.
#Choose how to use it
Every way runs the same checks: the tool's authorization, the agent's capabilities, policy, risk, approval, the brokered credential and the audit trail. Pick the one that fits, and follow its guide from the start.
| Guide | For | You need |
|---|---|---|
| Use MCP from Claude Desktop, Cursor and other clients | Anyone. No code. | The console and your MCP client |
| Call MCP tools from your code | An agent you write in TypeScript or Python | The CLI and the SDK |
| Reroute MCP calls with the CLI | Code that already calls a server with the MCP SDK | The CLI |
| Veefore's own tools in Claude, Cursor, VS Code, n8n | An assistant that should act only through your Veefore tools (/mcp) |
The console and your MCP client |
Each guide includes connecting the server, choosing the tools, trying a call, checking it in the console, and turning protection on. If something goes wrong, MCP troubleshooting lists every message and its fix.
New accounts start in Observe
Every environment in a new account starts in Observe mode: calls run and are recorded, and nothing is blocked. Each guide ends with the step that turns protection on.
#Connect a server in the console
MCP → Connect server registers the server, lists its tools and activates
it, then asks which agent may call which tools. Tools that only read are ticked
for you; tools that change things, and anything rated HIGH or CRITICAL, are
not. Each authorized tool gets a capability such as mcp.deepwiki.read, which
is created and granted to the agent. The guides walk through it screen by
screen.
Register manually on the same page, and the API below, do the same thing one step at a time, for when you need a different transport or rate limit, or want to script it.
#Connect a server with the API
#Register a server
bashcurl -X POST https://veefore.example.com/v1/mcp/servers \
-H "Authorization: Bearer $VEEFORE_API_KEY" \
-H 'content-type: application/json' \
-d '{
"workspace_id": "ws_01JAV…",
"environment_id": "env_01JAV…",
"name": "Internal tools",
"endpoint_url": "https://mcp.internal.example.com/mcp",
"transport": "HTTP_STREAM",
"credential_id": "cred_01JAV…",
"risk_level": "MEDIUM"
}'
The server starts PENDING. It cannot be used until it is activated, and no
agent can reach anything through it in the meantime. Its slug, derived from the
name (internal-tools here), is what agents pass as server.
credential_id is the credential Veefore presents to the server, on
discovery and on every call. The agent never receives it.
Only HTTP transports are supported. Veefore will not run a stdio server as a child process of the enforcement plane.
#Discover its tools
bashcurl -X POST https://veefore.example.com/v1/mcp/servers/mcp_01ABC/discover \
-H "Authorization: Bearer $VEEFORE_API_KEY"
Returns the tool list the server advertises, with each tool's schema and description. Every one of them is unauthorized.
Each tool also gets a risk level, worked out by Veefore from its name,
description and parameters — never from the server's own readOnlyHint, which
is a claim. A delete with an all or filter parameter is CRITICAL; a
lookup with neither is LOW. It is never lower than the risk level you gave
the server. It is a starting point for your review, and you can override it
when you authorize the tool.
Read the list before authorizing anything. A tool named run_query with free-
text SQL is a different proposition from get_ticket, and the names are chosen
by the server, not by you.
#Authorize, one at a time
bashcurl -X POST https://veefore.example.com/v1/mcp/servers/mcp_01ABC/tools/mcpt_01XYZ/authorize \
-H "Authorization: Bearer $VEEFORE_API_KEY" \
-H 'content-type: application/json' \
-d '{
"required_capability": "tickets.search",
"allowed_agent_ids": ["agt_01JAV…"]
}'
The server must be activated first (POST /v1/mcp/servers/{id}/activate).
An authorized MCP tool behaves like any other tool from here: it requires a capability, it is subject to policy, and it goes through the full pipeline.
Authorize what your agents actually need. "All of them" is not a decision.
#Write the policy before you authorize
Authorizing binds the MCP tool to a Veefore tool key,
mcp_<server-slug>_<tool-name> — mcp_internal_tools_search_tickets for the
example above. The key is known from the moment the tool is discovered, so a
rule can name it before anyone authorizes it, and applies the moment someone
does.
The Policy Builder offers these keys when you set a tool.key condition,
discovered tools included, marked "awaiting review". The same list is
GET /v1/policies/subjects.
#Call it from code
The SDK guide covers this step by step. In short:
tsconst decision = await agent.veefore.mcpCall({
server: 'internal-tools',
tool: 'search_tickets',
arguments: { query: 'refund failed', limit: 20 },
});
pythondecision = agent.veefore.mcp_call(
server="internal-tools",
tool="search_tickets",
arguments={"query": "refund failed", "limit": 20},
)
Over the wire: POST /gateway/v1/mcp/call. The same twelve-stage pipeline
applies — same decisions, same action record, same audit trail. An MCP tool is
not a side door. Veefore makes the call itself, over the protocol's
tools/call, with the server's brokered credential, and returns the server's
result as decision.result.
#Already using an MCP client
If your code calls a server with the official MCP SDK, change the receiver and nothing else:
tsimport { mcpServer } from '@veefore/sdk';
// Before: await client.callTool({ name: 'search_tickets', arguments: { query } })
const result = await mcpServer('internal-tools').callTool({
name: 'search_tickets',
arguments: { query },
});
result.content; // the server's own tools/call result, as before
mcpServer() builds its client from the environment veefore init writes, like
guard(). It needs @veefore/sdk 1.8.0 or later.
#When a human must approve
MCP calls take the same approval modes as guard(): onApproval: 'wait'
(the default), 'defer' or 'throw' — on_approval= in Python. Without the
option, VEEFORE_APPROVAL_MODE applies, so a project that defers gets it for
MCP too.
A deferred call returns "awaiting approval" at once, without contacting the
server. resumeApprovals() on a later turn finds the decision and, if it was
approved, Veefore performs the call — exactly once. There is no local
implementation to register: the approved request is the work.
tsconst outcome = await mcpServer('internal-tools', { onApproval: 'defer' }).callTool({
name: 'close_ticket',
arguments: { id },
});
if (isAwaitingApproval(outcome)) return outcome.say;
Bridge approval modes need @veefore/sdk / veefore-py 1.7.0 or later.
#Let the CLI wire it
The CLI guide covers this step by step.
veefore integrate reroutes a direct client.callTool(...) from the official
MCP SDK to mcpServer('<slug>').callTool(...), with the same diff, backup and
automatic rollback as every other change it makes. It does so only when the
file names the server's endpoint URL and that URL matches exactly one server
registered in this environment. Anything less certain is not guessed: the call
is listed with the line to write. Python MCP sessions and direct A2A clients
are always listed rather than rewritten.
In a project that defers approvals, a call whose result the code reads is also listed rather than rewritten, because the result can now be "awaiting approval" and the code around it has to check for that.
veefore doctor fails a project that still calls an MCP server or an A2A peer
directly, with the file and line of each call. A direct call gets no policy, no
approval, no brokered credential and no audit record.
#Re-discovery
Servers add and remove tools. Running discovery again updates the list, and newly discovered tools arrive unauthorized — including on a server whose other tools you have already authorized.
A tool whose schema changed is treated as a new tool: its authorization is
revoked and its risk level is worked out again, so a lookup that grew a
filter parameter does not keep the level it had when it was harmless. A tool
the server stopped advertising is disabled, not deleted, so the audit trail
can still name it.
Make re-discovery a routine thing you do and look at, rather than something that happens implicitly. A tool appearing in the list is the server telling you it would like more reach.
#Disable a tool
bashcurl -X POST https://veefore.example.com/v1/mcp/servers/mcp_01ABC/tools/tool_01XYZ/disable \
-H "Authorization: Bearer $VEEFORE_API_KEY"
Immediate. Refused with TOOL_DISABLED.
To cut off a whole server, disable its tools or revoke its credential. A server
that is not trusted is refused with MCP_SERVER_NOT_TRUSTED.
#Transport
veefore doctor audits MCP transport and authorization, and reports:
- A server reachable over plaintext HTTP to a non-loopback host
- Tools authorized but never used — reach you are carrying for nothing
- Servers in
PENDINGfor a long time — someone started and did not finish - A server with no credential, calling an endpoint that presumably wants one
#Policy on MCP
tool.kind is MCP and tool.protocol is MCP, so you can write rules that
apply to MCP specifically:
json{
"id": "rule-mcp-needs-approval-in-prod",
"name": "MCP tools need approval in production",
"priority": 600,
"enabled": true,
"when": {
"kind": "group",
"id": "g-mcp-prod",
"operator": "and",
"children": [
{ "kind": "condition", "id": "c-kind", "field": "tool.kind", "operator": "eq", "value": "MCP" },
{
"kind": "condition",
"id": "c-env",
"field": "environment.type",
"operator": "eq",
"value": "PRODUCTION"
}
]
},
"then": {
"decision": "REQUIRE_APPROVAL",
"reason": "Third-party MCP tools require a human decision in production.",
"approval": { "routingMode": "SINGLE", "requiredApprovals": 1, "ttlSeconds": 900 }
}
}
A good default for a server you do not operate yourself. It can be relaxed per tool once you have watched specific ones behave.
#Practical advice
Treat an MCP server as a dependency with privileges. It gets a credential, it gets reached over the network, and its tool list is under its control. Review it the way you would review a library you are about to add.
Authorize narrowly, and revisit. A tool authorized for a one-off task and never revoked is standing reach nobody remembers granting.
Prefer MCP servers you run. A server on your own infrastructure with its own credential is a very different risk profile from a public one.
#Related
Claude Desktop, Cursor, VS Code, Claude Code, n8n — no code.
TypeScript and Python, step by step.
Let veefore integrate make the change.
Every message, and its fix.
The other external-party protocol, with passport verification.
Register, discover, authorize, disable.
Why discovery and authorization are separate.
How a tool works in general.