MCP server
Give any MCP client the guard as a tool: it can check an action before running it, or check every call a script is about to make. One address, your existing API key, no code.
https://api.mcp-guard.ai/mcpStreamable HTTP · Bearer mcpg_live_… keyConnect your client
You need an API key from the dashboard (new workspaces get 1,000 free requests). Pick your client, paste your key if you like, and copy the snippet.
Run once in your terminal. Add --scope user to make MCP Guard available in every project.
Then type /mcp inside Claude Code to check that "mcp-guard" is connected.
Claude Code in one line
This lets Claude call the guard when it thinks to. To check every tool call, whether or not the model asks, use the PreToolUse hook instead (or as well).
The three tools
Pick a tool to see what it does, its parameters and an example call.
Check one agent action before it runs
Judge a tool call BEFORE executing it. Returns verdict (allow / ask / block), p_unsafe, reasons, and calibrated scores for nine questions: safe, violation (policy / scope / injection / goal drift / corrigibility), severity, destructive, exfiltration, injected (driven by tool output rather than the user), approval_policy (auto_approve / require_human / reject), blast_radius (read-only / reversible / production) and args_grounded (arguments supported by the request). Run the action on allow, ask the user on ask, never run it on block. 1 credit per check; failed calls are free.
| Parameter | What it is |
|---|---|
actionrequiredstring | object | The tool call about to run: a string such as "db.drop_table(users)", or an object {tool, args}. |
intentstring | What the user asked the agent to do. The most useful field after the action. |
user_messagestring | The latest user message, when it differs from the intent. |
trigger"user_request" | "tool_result" | "correction" | "user_override" | What produced the action. Use tool_result when the idea came from a tool output or document (possible prompt injection). |
constraintsstring[] | Rules the action must respect, e.g. "staging only", "never email outside acme.com". |
contextstring | Agent role, environment (production / staging), anything else worth knowing. |
conversationobject[] | Recent turns, oldest first. Only the most recent part is read, so keep it short. |
Every result also comes back as a text block holding the same JSON, for clients that ignore structuredContent. Errors (invalid arguments, not enough credits, inference busy) come back as a result with isError: true and a plain-English message the assistant can act on.
guard_check takes the same fields as POST /v1/guard; guard_batch takes up to 64 of them. Results have the same shape as the REST API, plus credits_charged, free_request and free_requests_remaining. What the scores mean: scores & verdicts.
Billing, limits and errors
Tool calls go through the same pipeline as POST /v1/guard: the same key, rate limit, credit balance and usage records (logged with the endpoint names mcp and mcp/batch). 1 credit per check, or one free request per tool call while the workspace has them. Failed calls are free; usage is always free.
| Status | Meaning |
|---|---|
200 | JSON-RPC response. Tool problems (invalid arguments, not enough credits, inference busy) come back as a tool result with isError: true, a plain-English message and a code (invalid_arguments, insufficient_credits, inference_unavailable, …). |
202 | The message was a notification (for example notifications/initialized); there is no body. |
400 | Invalid JSON (-32700), an empty batch or one over 64 messages, or an unsupported MCP-Protocol-Version header. |
401 | Missing or invalid key. Comes with WWW-Authenticate: Bearer and a JSON-RPC error body (-32001). |
405 | GET or DELETE: there is no SSE stream and no session to end. Use POST. |
413 | Body over 512 KB. |
429 | Rate limited per key (-32029). Honour Retry-After. |
Unknown methods return JSON-RPC error -32601; an unknown tool name or non-object arguments return -32602. Batches (a JSON array of messages) are supported and run in order. More in errors, limits & retries.
Protocol details (for client builders)
Streamable HTTP transport, JSON responses only. Protocol version 2025-06-18; clients asking for 2025-03-26 or 2024-11-05 get that version back. Supported methods: initialize, notifications/initialized, ping, tools/list, tools/call, and empty resources/list and prompts/list. A session id is returned on initialize but never required.
Questions
What does the MCP server add over the REST API?
Nothing new under the hood: the same checks, key, limits and billing. It lets an MCP client or agent call the guard as a tool (guard_check before a risky action, guard_batch before a script runs) without any code on your side.
Does it cost extra?
No. Tool calls are billed like the REST API: 1 credit per check ($0.20 per 1,000 checks), failed calls are free and the usage tool is free. Every workspace starts with 1,000 free requests; a tool call (or a whole guard_batch) uses one.
Which key do I use?
The same mcpg_live_ API key you use for the REST API, sent as "Authorization: Bearer mcpg_live_…". Create one in the dashboard under API keys.
Will the model always call guard_check?
No, a model decides when to call a tool, and it can forget. For a guarantee that every call is checked, put the guard in the path of the call: a Claude Code PreToolUse hook, your agent loop, or your sandbox tool proxy. See the integrations page.
Does it support OAuth or SSE streaming?
Not today. The server speaks the Streamable HTTP transport with plain JSON responses and authenticates with your API key as a bearer token. Every call is a single short request, so there is nothing to stream.