convez.ai
MCP Server
MukundaKatta

agent-safety-mcp

MukundaKatta/agent-safety-mcp

Ver no GitHub
InicialPluginScore · de 0 a 100

MCP server that gives any LLM agent a built-in safety layer: arg validation, egress firewall, JSON repair, context fitting, and snapshot tracing. Wraps the @mukundakatta agent-stack libs.

Instalação

$npx convez-ai MukundaKatta/agent-safety-mcp

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
0
Saúde
28%
Último commit
há 5 meses
Versão
—
Issues abertas
5
Contribuidores
1

README

A tradução para o português deste README ainda está na fila.

agent-safety-mcp

An MCP server that gives any LLM agent a built-in safety layer. Every tool maps to a battle-tested, npm-published primitive from the @mukundakatta agent-stack, so the agent gets validation, egress control, JSON repair, context-window fitting, and snapshot tracing without writing any of that itself.

Why

When you give an LLM real tools, four things go wrong:

  1. The model emits bad arguments → your tool crashes (or worse, runs with garbage).
  2. The model fetches whatever URL it wants → data leaks, prompt injection, runaway cost.
  3. The model returns JSON wrapped in prose → your parser blows up.
  4. The conversation outgrows the context window → silent truncation, lost system prompt.

Each of those is solved separately by an open-source library. This MCP server wires those libraries into one server any agent (Claude, Gemini, GPT, anything with MCP support) can plug into in 30 seconds.

Tools

ToolWhat it doesBacked by
validate_argsValidate LLM-emitted tool arguments against a shape spec. Returns a structured error + retry hint.@mukundakatta/agentvet
check_egressDecide whether a URL is in the agent's allowlist before fetching.@mukundakatta/agentguard
extract_jsonPull JSON out of messy LLM output (handles fences, prose, balanced extraction).@mukundakatta/agentcast
fit_messagesTruncate chat history to a token budget. Preserves system messages.@mukundakatta/agentfit
count_tokensFast token estimate for a string or message array.@mukundakatta/agentfit
diff_snapshotCompare two agent traces. Reports PASSED, OUTPUT_DRIFT, TOOLS_REORDERED, TOOLS_CHANGED, or REGRESSION.@mukundakatta/agentsnap

Optional: Splunk HEC sink

Set SPLUNK_HEC_URL and SPLUNK_HEC_TOKEN (and optionally SPLUNK_HEC_INDEX) before starting the server. Every safety tool call is then forwarded to Splunk as a structured event with sourcetype=agent_safety, so SOC and SRE teams can search, alert, and dashboard agent policy decisions in real time. The sink is a no-op when those env vars are unset.

Run it

Local (stdio)

npm install
npm run build
node dist/server.js

Register in a Claude Desktop / Cursor / Cline config:

{
  "mcpServers": {
    "agent-safety": {
      "command": "node",
      "args": ["/absolute/path/to/agent-safety-mcp/dist/server.js"]
    }
  }
}

HTTP (Cloud Run, Fly, anywhere)

npm run build
npm run http        # listens on $PORT (default 8080) at /mcp

Deploy to Cloud Run

gcloud run deploy agent-safety-mcp \
  --source . \
  --region us-central1 \
  --allow-unauthenticated \
  --port 8080

The deployed server exposes:

  • POST /mcp — Streamable HTTP MCP endpoint
  • GET /healthz — liveness probe

Live demo deploy: https://agent-safety-mcp-444075785245.us-central1.run.app/mcp

Demo

examples/gemini-demo.ts runs a Gemini 2.0 Flash agent on Vertex AI that calls the MCP tools to validate args and check an egress URL.

gcloud auth application-default login
export GOOGLE_CLOUD_PROJECT=your-project
npm run demo:gemini

License

MIT

Ver o original no GitHub

Bom para

Relacionados