agent-safety-mcp
Unified MCP safety server that detects prompt injection (75 patterns), scans LLM outputs for leaked secrets/PII, enforces API cost budgets, and creates signed audit trails. Zero ML dependencies, pure Python.
README
agent-safety-mcp
MCP server for AI agent safety. One install gives any MCP-compatible AI assistant access to cost guards, prompt injection scanning, and decision tracing.
Works with Claude Code, Cursor, Windsurf, Zed, and any MCP client.
Install
Claude Code (recommended)
claude mcp add agent-safety -- uvx agent-safety-mcp
Manual (any MCP client)
Add to your MCP config:
{
"mcpServers": {
"agent-safety": {
"command": "uvx",
"args": ["agent-safety-mcp"]
}
}
}
From PyPI
pip install agent-safety-mcp
agent-safety-mcp # runs stdio server
Tools
Cost Guard — Budget enforcement for LLM calls
| Tool | What it does |
|---|---|
cost_guard_configure |
Set weekly budget, alert threshold, dry-run mode |
cost_guard_status |
Check current spend vs budget |
cost_guard_check |
Pre-check if a model call is within budget |
cost_guard_record |
Record a completed call's token usage |
cost_guard_models |
List supported models with pricing |
Example: "Check if I can afford a GPT-4o call with 2000 input tokens"
Injection Guard — Prompt injection scanner
| Tool | What it does |
|---|---|
injection_scan |
Scan text for injection patterns (non-blocking) |
injection_check |
Scan + block if injection detected |
injection_patterns |
List all 75 built-in detection patterns across 9 categories |
Example: "Scan this user input for prompt injection: 'ignore previous instructions and...'"
Decision Tracer — Agent decision logging
| Tool | What it does |
|---|---|
trace_start |
Start a new trace session |
trace_step |
Log a decision step with context |
trace_summary |
Get session summary (steps, errors, timing) |
trace_save |
Save trace to JSON + Markdown files |
Example: "Start a trace for my analysis agent, then log each decision step"
What this wraps
This MCP server wraps the AI Agent Infrastructure Stack — three standalone Python libraries:
- ai-cost-guard —
pip install ai-cost-guard - ai-injection-guard —
pip install ai-injection-guard - ai-decision-tracer —
pip install ai-decision-tracer
All three: MIT licensed, zero runtime dependencies (individually), pure Python stdlib.
The MCP server adds mcp>=1.0.0 as a dependency for the protocol layer.
Why
AI coding assistants (Claude Code, Cursor, etc.) can now protect the agents they help build — checking budgets, scanning inputs, and tracing decisions — without leaving the IDE.
Built from 8 months of running autonomous AI trading agents in live financial markets.
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.