@verdicter/mcp
v1.0.2
Published
Verdicter policy enforcement for MCP servers
Maintainers
Readme
@verdicter/mcp
Runtime security for MCP servers. One line wraps any MCP server so every tool call is evaluated against your Verdicter policies before it executes.
What is this?
MCP is the standard that powers Claude Desktop and most modern agent frameworks. Every tool your MCP server exposes is now a potential attack surface.
@verdicter/mcp intercepts every tool call before it reaches your handler. DENY stops execution and returns an error to the client. ESCALATE pauses and waits for human approval. ALLOW passes through transparently - the agent never sees the enforcement layer.
MCP client → tool call → withVerdicter() → Verdicter policy engine → ALLOW / DENY / ESCALATE → your handler→ Get your free API key at verdicter.dev
Install
npm install @verdicter/mcpRequires @modelcontextprotocol/sdk >= 1.0.0 as a peer dependency.
Quick start
1. Get an API key at verdicter.dev - free to sign up, 10k evaluations/month on the free plan.
2. Register your agent in the Verdicter dashboard and define your policies.
3. Wrap your MCP server:
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { withVerdicter } from "@verdicter/mcp";
const server = new Server(
{ name: "my-tools", version: "1.0.0" },
{ capabilities: { tools: {} } },
);
// Register your tools as normal
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [...] }));
server.setRequestHandler(CallToolRequestSchema, async (request) => {
// Your tool logic - Verdicter runs before this
return { content: [{ type: "text", text: "done" }] };
});
// One line - works with any transport
const guarded = withVerdicter(server, {
apiKey: process.env.VERDICTER_API_KEY!,
agentId: "my_mcp_agent",
});
await guarded.connect(new StdioServerTransport());Works identically with HTTP/SSE transports - just swap the transport.
Configuration
withVerdicter(server, {
apiKey: process.env.VERDICTER_API_KEY!,
agentId: "my_mcp_agent",
escalationTimeoutMs: 10_000, // auto-deny escalations after this (default: 10s)
apiUrl: "https://www.verdicter.dev", // default
onEvaluation: (result) => console.log(result),
});| Option | Type | Default | Description |
|--------|------|---------|-------------|
| apiKey | string | required | Your Verdicter API key |
| agentId | string | required | Agent ID or name registered in your dashboard |
| escalationTimeoutMs | number | 10000 | How long to wait for human approval before auto-denying |
| apiUrl | string | https://www.verdicter.dev | Verdicter API base URL |
| onEvaluation | function | - | Called after every evaluation with the full result |
Decisions
| Decision | What happens |
|----------|-------------|
| ALLOW | Tool call passes through to your handler |
| DENY | MCP InvalidRequest error returned to the client |
| ESCALATE | Polls for human approval, auto-denies after escalationTimeoutMs |
Fail-open behavior
If the Verdicter API is unreachable, the adapter logs a warning and allows the tool call through rather than taking your MCP server down. If you need strict fail-closed behavior, throw inside onEvaluation when result.decision is undefined.
Logging
withVerdicter(server, {
apiKey: process.env.VERDICTER_API_KEY!,
agentId: "my_mcp_agent",
onEvaluation: (result) => {
console.log(`[${result.decision}] ${result.tool} - risk ${result.riskScore} (${result.latencyMs}ms)`);
},
});Links
- Sign up free - verdicter.dev
- Dashboard - app.verdicter.dev
- Documentation - verdicter.dev/docs
- npm - npmjs.com/package/@verdicter/mcp
MIT License © Verdicter
