agent-guard-mcp
Enables instant approval notifications and links for high-risk operations through Telegram bot integration, allowing human approval via Telegram.
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: sovr-mcp-proxy
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
This server cannot be installed
Maintenance
Appeared in Searches
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/dygogogo/agent-guard-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server