agent-guard-mcp
Enables instant approval notifications and links for high-risk operations through Telegram bot integration, allowing human approval via Telegram.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
agent-guard-mcp
MCP Guard Server — Budget control, approval workflows, and audit logging for AI agents.
Works with Claude Code, Cursor, ChatGPT, and any AI agent that speaks the MCP protocol.
Features
Budget Control — Daily credits hard limit prevents agent overspending
High-Risk Approval — Operations exceeding amount threshold or matching sensitive resource keywords trigger human approval
Approval Workflow — Agent requests → token generated → human approves via Dashboard or Telegram
Audit Log — All spend, approval, and rejection actions recorded with cursor-based pagination
Web Dashboard — Gin + HTMX + Tailwind real-time dashboard
Telegram Notifications — Instant approval links for high-risk operations
Multi-Transport — stdio / SSE / StreamableHTTP with automatic detection
Related MCP server: llm-cost-guard
MCP Tools
Tool | Description |
| Query today's budget status |
| Execute a spend (auto-detects high-risk) |
| Explicitly request human approval |
| Approve a pending token |
| Reject a pending token |
| Poll approval status |
| Query audit log with filtering and pagination |
| List all pending approval requests |
Quick Start
Requirements
Go 1.24+
No CGO required (pure Go SQLite driver)
Build from Source
git clone https://github.com/dygogogo/agent-guard-mcp.git
cd agent-guard-mcp
go build -o mcp-guard main.goDownload Pre-built Binary
Download the latest release for your platform:
Platform | amd64 | arm64 |
macOS | ||
Linux | ||
Windows |
Or visit the latest release page.
Configuration
Configure via environment variables or .env file:
Variable | Description | Default |
| Transport: stdio / sse / http | Auto-detect (TTY → http) |
| Daily budget cap (credits) | 10.0 |
| High-risk amount threshold | 2.0 |
| High-risk resource keywords (comma-separated) | delete,send |
| SQLite database path | ./mcp-guard.db |
| Dashboard HTTP port | 8080 |
| Base URL for approval links | |
| Log level: debug/info/warn/error | info |
| Payer identity | hostname |
| Telegram Bot Token (optional) | - |
| Telegram Chat ID (optional) | - |
Running
# HTTP mode (auto-detected, with Dashboard)
./mcp-guard
# Dashboard: http://localhost:8080/dashboard
# MCP endpoint: http://localhost:8080/mcp
# stdio mode (for MCP clients)
MCP_TRANSPORT=stdio ./mcp-guard
# SSE mode
MCP_TRANSPORT=sse ./mcp-guard
# SSE endpoint: http://localhost:8080/sseClaude Code Integration
Add to Claude Code's MCP configuration:
{
"mcpServers": {
"agent-guard-mcp": {
"command": "mcp-guard",
"env": {
"MCP_TRANSPORT": "stdio",
"BUDGET_LIMIT": "10"
}
}
}
}Architecture
┌─────────────┐ MCP Protocol ┌────────────────┐
│ AI Agent │ ◄──────────────────► │ MCP Guard │
│ (Claude, │ stdio / HTTP │ Server │
│ Cursor...) │ │ │
└─────────────┘ │ ┌────────────┐ │
│ │ BudgetStore │ │
┌─────────────┐ HTTP │ │ (SQLite) │ │
│ Dashboard │ ◄──────────────────► │ └────────────┘ │
│ (Gin+HTMX) │ └────────────────┘
└─────────────┘
┌─────────────┐ Webhook
│ Telegram │ ◄────── Approval notifications
└─────────────┘Core Files
File | Description |
| Entry point, transport selection, graceful shutdown |
| MCP Server with 8 registered tools |
| BudgetStore interface + SQLite implementation |
| High-risk detection, approval workflow, Telegram |
| Environment config, auto transport detection |
| zap logging (stdio mode: file only) |
| Gin Web Dashboard |
Approval Workflow
1. Agent calls spend(amount=5.0, resource="/api/delete")
2. MCP Guard detects high-risk (amount > threshold OR resource keyword matched)
3. Returns {status: "pending_approval", token: "xxx"}
4. Agent polls check_approval(token) for status
5. Human approves/rejects via Dashboard or Telegram
6. Agent receives final result (approved/rejected/budget_exceeded)Testing
# All tests with race detection
go test -race -count=1 ./...
# Integration tests only
go test -race -run TestIntegration -v ./...
# Coverage
go test -race -cover ./...Tech Stack
Go 1.24 — Language
mcp-go — MCP protocol Go SDK
Gin — Web framework (Dashboard)
modernc.org/sqlite — Pure Go SQLite (no CGO)
zap — Structured logging
HTMX + Tailwind CSS — Dashboard frontend
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
AgentGuard — 20-tool AI safety MCP: policy preflight, risk scoring, audit logging, rate limits.
Zero-secret MCP gateway for AI agents: risk-scored, audited calls with human-in-the-loop approval.
Agent Cost Allocator MCP — multi-tenant LLM cost attribution for chargeback billing. Companion to
MCP gateway: one connection for your AI apps, with tool policies, PII redaction and audit logs.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceMCP server for AI agent security guardrails. Provides input validation, prompt injection detection, PII redaction, output filtering, policy enforcement, rate limiting, and comprehensive audit logging.66 npm1MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for tracking LLM costs, setting spending limits, and receiving budget alerts directly within AI editors via slash commands like /guard.12 npm1MIT
- AlicenseBqualityAmaintenanceGovernance runtime for AI agents: a guard tool evaluates risky actions against policy before they execute (block / warn / require human approval), approvals route to a human queue, and every action becomes a replayable decision record with per-action spend tracking. Runs over stdio via npx @dashclaw/mcp-server; works with Claude Code, Codex, LangChain, CrewAI, or any MCP host.68318MIT
- AlicenseAqualityBmaintenanceMartinLoop is the independent governance and financial control layer for AI coding agents. Set hard spend limits, prevent runaway loops, enforce verification, trigger rollback on failure, and generate auditable receipts showing what changed, what it cost, and whether the work passed.24359 npm296Apache 2.0