AgentsGate
OfficialAllows AI agents to interact with MySQL databases through the proxy, with risk scoring and checkpointing for database operations.
Allows AI agents to interact with PostgreSQL databases through the proxy, with risk scoring and checkpointing for database operations.
Exposes Prometheus metrics at the /metrics endpoint for monitoring proxy performance and agent activity.
Sends Slack notifications via Incoming Webhooks when operations require human approval.
Allows AI agents to interact with SQLite databases through the proxy, with risk scoring and checkpointing for database operations.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@AgentsGateapprove the pending tool call"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
AgentsGate
AI Agent I/O Tracking & Rollback System — MCP Proxy Gateway
Status: 0.1.0, first public release. The proxy, risk scoring, checkpoints and rollback are covered by 7,200 tests, but the API surface should be treated as unstable until 1.0 — command flags and config keys may still change. Read SECURITY.md before exposing anything beyond loopback.
AgentsGate sits between AI agents (Claude, GPT, etc.) and the MCP tools they call. Every tool call is intercepted, risk-scored, checkpointed, and optionally paused for human approval before execution. If an agent does something destructive, you can roll back in seconds.
AI Agent (Claude, GPT, etc.)
↓ MCP Protocol
┌──────────────────────────┐
│ AgentsGate Proxy │ ← All traffic passes here
└────────┬─────────────────┘
│
┌──────▼──────┐ ┌──────────────────────┐ ┌────────────────────┐
│ Logger │ │ Risk Engine (L1/L2) │ │ Policy Engine │
└──────┬──────┘ └──────┬───────────────┘ └────────┬───────────┘
│ │ │
┌──────▼──────────────────▼─────────────────────────────▼───────────┐
│ SQLite State Store │
└──────────────────────────────┬─────────────────────────────────────┘
│
┌────────▼────────┐
│ Intervention │ ← Block / Allow / Require-approval
└────────┬────────┘
│
allowed ────────────┤──────────── blocked / pending
↓
┌────────▼────────┐
│ Actual MCP Tool│
└─────────────────┘
Dashboard REST API ←→ SQLite (read-only visibility, real-time SSE)Security model — read this first
AgentsGate is a local, single-operator tool. It records everything your agent does, including tool arguments and results that routinely contain file contents, database rows, and credentials.
The proxy transport has no authentication, and the dashboard's is opt-in. That is safe only because AgentsGate binds to loopback by default:
Surface | Default port | Default bind | Built-in auth |
MCP proxy |
|
| None |
Dashboard REST/SSE |
|
| Opt-in ( |
proxy.host controls the bind address for the proxy, dashboard, and WebSocket
gateway. Leave it at 127.0.0.1 unless you know exactly what you are doing.
If you set
proxy.hostto a routable address, you must put an authenticating reverse proxy in front of it. No AgentsGate setting alone makes a non-loopback bind safe — exposing it without a reverse proxy means unauthenticated operation forwarding plus full read access to your agent's history. AgentsGate prints a startup warning when you do this; treat it as an error in production.
For the full threat model, residual risks, and a deployment checklist, see SECURITY.md.
Related MCP server: promptspeak-mcp-server
Features
Proxy & Interception
Zero-trust MCP proxy — every tool call intercepted regardless of agent cooperation
Stdio transport support (
MCPStdioProxy) for pipe-based MCP clientsDry-run mode (
--dry-run) — scores and logs without blocking any operationsPer-operation session tracking, agent identification, and tag propagation
Risk Scoring
L1 static rules — 8 built-in rules covering destructive file ops, sensitive path writes, database drops, command execution, git force-push
L2 user history — per-agent Bayesian model (requires ≥10 outcomes)
L3 community enrichment — configurable HTTP endpoint (opt-in)
Checkpoints & Rollback
Pre-operation file snapshots into a shadow git repository
One-command rollback to any checkpoint
Checkpoint diff view before restoring
Rollback preview (dry-run before committing restore)
Policy System
Custom policy rules loaded from
~/.agentsgate/policy.jsonPer-rule match on tool, method, agentId, pathPattern, and tags
Rule actions:
allow,block,require_approval, or score overrideAgent allowlist / denylist
Per-agent tool allowlist / denylist
L1 rule muting and score overrides
Live policy stats via the dashboard
Approval Queue
Pending operations pause at the proxy until approved or denied
Webhook notifications (with retry) on enqueue
Slack Incoming Webhook integration
Escalation webhooks for stale approvals
Approvals persist across restarts (SQLite-backed)
Auto-expiry with configurable TTL (default 24h)
Real-time SSE push when approvals expire
Dashboard API (see docs/api-reference.md)
Full REST API: operations, agents, tools, sessions, risk, checkpoints, rollback, approvals, policy, telemetry, circuit breakers, rate limits, quota, audit
Server-Sent Events (
GET /events) for live operation feedPrometheus metrics (
GET /metrics)RBAC via
X-API-KeyheaderAudit log HMAC-SHA256 verification (
GET /audit/verify)CSV export for operations
Telemetry & Analytics
Anonymized aggregate stats — zero PII stored
Anomaly detection with z-score alerting (configurable threshold)
Periodic export to a configurable HTTP endpoint
Per-agent, per-tool, per-session telemetry breakdowns
Plugin Adapters
BaseRollbackAdapterbase class for extending rollback to SaaS toolsCommunity adapter registry — load adapters from a directory
Operations Management
Per-agent and per-tool operation history
Full-text and filter-based search across operations
Rate limiting per agent (ops/minute)
Circuit breaker per agent
Daily quota management per agent
Log retention and pruning
Developer / Ops Tools
agentsgate doctor— environment health checkagentsgate benchmark— throughput benchmarkagentsgate inject/eject— auto-configure Claude Desktopagentsgate completion— shell autocomplete
Installation
npm install -g agentsgateOr run directly without installing:
npx agentsgate startFor local development from a fresh clone:
git clone https://github.com/agentsgate/agentsgate.git
cd agentsgate
npm run bootstrapQuick Start
# Start the proxy (default port 4000, dashboard on port 4001)
agentsgate start
# Start on a custom port
agentsgate start 8080
# Check that the proxy is running
agentsgate status
# Show effective config
agentsgate config
# Show dashboard health
agentsgate healthConfigure Claude Desktop
# Auto-inject AgentsGate into Claude Desktop's MCP config
agentsgate inject
# Verify injection
agentsgate status
# Remove injection
agentsgate ejectRestart Claude Desktop after injection. All Claude tool calls now flow through AgentsGate.
CLI Reference
Commands are grouped by category. Run agentsgate <command> --help for full flag details.
Startup
Command | Description |
| Start the proxy and dashboard |
| Send stop signal to the running proxy |
| Show proxy PID, port, dashboard URL, and start time |
| Liveness check against the running dashboard |
| Diagnose environment (Node version, build, config, DB) |
| Auto-configure Claude Desktop to route through AgentsGate |
| Show current injection status |
| Remove AgentsGate from Claude Desktop config |
| Stdio proxy mode |
Database MCP servers
Register a guarded database server in the Claude config, so the SQL an agent issues is risk-scored and checkpointed like any other tool call. Restart Claude Desktop / Claude Code after registering.
Command | Description |
| Register the SQLite MCP server |
| Alias for |
| Register the PostgreSQL MCP server |
| Register the MySQL MCP server |
| Remove that server from the Claude config |
| Delete rollback snapshots older than the cutoff (default 7d) |
# PostgreSQL — the connection string is redacted in all output and logs
agentsgate inject-pg --connection-string=postgresql://user:pass@localhost:5432/mydb
# Several databases at once — distinguish them with --name
agentsgate inject-pg --connection-string=postgresql://... --name=production-db
agentsgate inject-mysql --connection-string=mysql://... --name=staging-dbConfiguration
Command | Description |
| Print effective config (merged defaults + file) |
| Fetch live sanitized config from running dashboard |
Operations
Command | Description |
| List recent operation logs |
| Live-tail operations via SSE |
| Tail operations in tabular format |
| Aggregate statistics (counts, risk, trends, top agents/tools) |
| Offline stats from local DB |
| Export operations to CSV or JSON |
| Fetch a single operation by ID |
| Count operations matching filters |
| Prune old operation logs |
| Show risk assessments |
| Explain the risk decision for a specific operation |
| Re-run an operation through the pipeline |
| Top agents/tools by risk or count |
| Live watch operation stream |
| Throughput benchmark |
| Export full operation history |
Policy
Command | Description |
| Print current policy rules |
| List all policy rules with details |
| Add a new policy rule |
| Remove a policy rule by ID |
| Load policy from a specific file |
Sessions
Command | Description |
| List sessions with event counts and risk stats (requires telemetry) |
| Detail for one session |
| Show operations for a specific session |
| Force-expire a session — blocks all its future operations |
| Session detail derived from the operation log |
Agents
Command | Description |
| List all agents with operation counts and risk stats |
| Detail view for a single agent |
| Tools used by an agent |
| Sessions for an agent |
Tools
Command | Description |
| List all tools with operation counts and risk stats |
| Detail view for a single tool |
Telemetry
Command | Description |
| Current in-memory telemetry snapshot |
| Per-session telemetry |
| Per-agent telemetry |
| Per-tool telemetry |
Checkpoints & Rollback
Command | Description |
| List recent checkpoints |
| Manage snapshots |
| Show diff for a checkpoint |
| Restore files from a checkpoint |
Approvals
Command | Description |
| List pending approval requests |
| Approve a pending operation |
| Deny a pending operation |
Audit & Debug
Command | Description |
| HMAC-verify operation log integrity |
| Verify HMAC signatures on recent logs |
| Recent errors recorded by the running proxy |
| View or reset per-agent circuit breakers |
| View per-agent rate limiter stats |
| View per-agent daily quota usage |
| Generate a risk report |
| Show the operation tree |
| Prune old logs from the database |
| Print shell completion script |
Dashboard API
While the proxy is running, a REST server on port+1 (default: 4001) provides full visibility and control. See docs/api-reference.md for the complete endpoint reference.
Key features:
All endpoints (except
GET /health) requireX-API-Keyheader whendashboard.apiKeyis setReal-time events via
GET /events(Server-Sent Events)Prometheus metrics via
GET /metricsCSV export via
GET /operations/exportRollback via
POST /rollback/:checkpointIdApproval management via
POST /approvals/:id/approveandPOST /approvals/:id/deny
Risk Scoring
Operations are scored 0.0 (safe) → 1.0 (extremely risky) using three layers:
Layer | Source | Status |
L1 Static rules | Built-in rule set | Always active |
L2 User history | Per-agent Bayesian model | Active (requires ≥10 outcomes) |
L3 Community | Configurable HTTP enrichment | Opt-in via |
L1 Rules
Rule ID | Trigger | Default Score |
|
| 0.90 |
| Write to | 0.90 |
|
| 0.95 |
|
| 0.75 |
|
| 0.80 |
|
| 0.85 |
|
| 0.65 |
|
| 0.05 |
Intervention thresholds (default)
Score range | Action |
< 0.3 |
|
0.3 – 0.69 |
|
≥ 0.7 |
|
Override thresholds in policy.json or config.json.
Policy System
Create ~/.agentsgate/policy.json to define custom rules:
{
"rules": [
{
"id": "BLOCK_PROD_DB_DELETE",
"description": "Always block deletes on the production database tool",
"match": { "tool": "database", "method": "/delete|drop/i" },
"action": "block"
},
{
"id": "TRUST_READONLY_AGENT",
"description": "Treat all ops from the readonly-agent as low risk",
"match": { "agentId": "readonly-agent" },
"score": 0.05
},
{
"id": "ELEVATE_SECRET_WRITES",
"description": "Treat writes to /secrets/ as very high risk",
"match": { "pathPattern": "/secrets/" },
"score": 0.95
}
],
"thresholds": { "allowBelow": 0.2, "blockAtOrAbove": 0.8 },
"agents": {
"denylist": ["untrusted-agent-*"],
"allowlist": [],
"toolRules": {
"limited-agent": {
"allowlist": ["filesystem", "search"]
}
}
},
"mutedRules": [],
"ruleOverrides": {
"L1_OVERWRITE_FILE": 0.4
}
}Policy rule fields
Field | Type | Description |
| string | Unique rule identifier |
| string | Human-readable description (optional) |
| string | Exact or |
| string | Exact or |
| string | Exact or |
| string | Regex matched against params.path / params.filePath |
| string[] | Operation must have ALL of these tags |
| number | Override L1 risk score (0–1) |
| string | Force |
| number | Evaluation order — lower wins (default: 100) |
| number | Maximum score this rule can produce |
| string[] | Parameter keys to redact in the audit log |
Plugin Adapters
Extend rollback to external services by implementing RollbackAdapter. See docs/plugin-authoring.md for the full authoring guide.
Quick example:
import { BaseRollbackAdapter } from 'agentsgate';
import type { MCPOperation, RollbackCapability, StateSnapshot, RollbackResult, RollbackPreview } from 'agentsgate';
export default class GitHubIssueAdapter extends BaseRollbackAdapter {
readonly adapterId = 'github-issues';
readonly version = '1.0.0';
readonly supportedTools = ['github', 'github-mcp'];
async canRollback(operation: MCPOperation): Promise<RollbackCapability> {
const isDestructive = ['close_issue', 'delete_comment'].includes(operation.method);
return { canRollback: isDestructive, confidence: 0.9 };
}
async captureState(context: MCPOperation): Promise<StateSnapshot> {
// Snapshot current state before the operation
return { adapterId: this.adapterId, operationId: context.id, data: {}, capturedAt: new Date() };
}
async rollback(snapshot: StateSnapshot): Promise<RollbackResult> {
// Restore via external API
return { success: true, restoredFiles: ['github:issue'], failedFiles: [] };
}
async previewRollback(snapshot: StateSnapshot): Promise<RollbackPreview> {
return { willRestore: ['github:issue#1'], cannotRestore: [], warnings: [] };
}
}Load adapters at startup:
import { CommunityAdapterRegistry } from 'agentsgate';
const registry = new CommunityAdapterRegistry();
await registry.load('./plugins'); // scans ./plugins/*.jsConfiguration
Config file: ~/.agentsgate/config.json
{
"proxy": {
"port": 4000,
"host": "127.0.0.1",
"checkpointThreshold": 0.3
},
"intervention": {
"allowBelow": 0.3,
"blockAtOrAbove": 0.7
},
"webhook": {
"url": "https://your-webhook-endpoint.example.com",
"secret": "your-hmac-signing-secret",
"slackUrl": "https://hooks.slack.com/services/..."
},
"approvals": {
"maxAgeMs": 86400000
},
"telemetry": {
"exportEndpoint": "https://your-telemetry-sink.example.com",
"exportIntervalMs": 300000,
"anomalyWebhookUrl": "https://alerts.example.com",
"anomalyZScoreThreshold": 2.0,
"otlpEndpoint": "http://collector:4318/v1/metrics",
"otlpExportIntervalMs": 300000
},
"intelligence": {
"communityEndpoint": "https://community-risk.example.com"
},
"rateLimit": {
"enabled": false,
"maxOpsPerMinute": 60
},
"logs": {
"retentionDays": 30
},
"dashboard": {
"apiKey": "your-secret-api-key"
},
"audit": {
"signingSecret": "your-hmac-secret"
}
}Configuration fields
Field | Default | Description |
|
| Proxy listen port; dashboard runs on |
|
| Bind address for proxy, dashboard, and WS gateway. The proxy is unauthenticated — only set a routable address behind an authenticating reverse proxy. See Security model |
|
| Minimum risk score to trigger a pre-op checkpoint |
|
| Risk scores below this are allowed |
|
| Risk scores at or above this are blocked |
| — | POST target for approval-required notifications |
| — | HMAC-SHA256 secret. When set, every webhook POST carries |
| — | Slack Incoming Webhook for block/approval events |
|
| Approval TTL in ms (default: 24h) |
| — | HTTP endpoint for periodic telemetry export |
|
| Export interval in ms (default: 5 min) |
| — | Webhook for z-score anomaly alerts |
|
| Z-score threshold for anomaly firing |
| — | OpenTelemetry OTLP/HTTP metrics endpoint |
|
| OTLP export interval in ms |
| — | L3 community risk enrichment endpoint |
|
| Enable per-agent rate limiting |
|
| Max operations per agent per minute |
| — | Days to retain operation logs before auto-pruning |
| — |
|
| — | HMAC-SHA256 secret for operation log signing |
| — | Namespace identifier — selects the database file ( |
Architecture
Module | Responsibility |
M1 MCP Proxy Core | HTTP/stdio server + pipeline orchestration |
M2 State Store | SQLite persistence (WAL mode) |
M3 Operation Logger | Audit trail for every intercepted event |
M4 Checkpoint Engine | Pre-operation file state capture |
M5 File Shadow System | Shadow git repo for file snapshots |
M6 Risk Scoring Engine | L1 static rules |
M7 Intervention Controller | allow / require_approval / block gate |
M8 Rollback Engine | File restore from checkpoint |
M9 Plugin Adapter SDK | Registry + base class for community adapters |
M10 Dashboard API | REST API + SSE + Prometheus metrics |
M11 Risk Intelligence | L2 Bayesian user-history + L3 community scoring |
M12 Community Registry | Plugin discovery and validation |
M13 Telemetry | Anonymized aggregate stats + anomaly detection |
Project structure
src/
cli.ts ← agentsgate CLI entry point
index.ts ← library exports
config.ts ← configuration loader
policy.ts ← policy engine
types/
interfaces.ts ← all shared types (Architect-owned)
errors.ts ← typed error classes
modules/
m1-proxy/ ← MCP proxy + createPipeline factory
m2-store/ ← SQLite state store
m3-logger/ ← operation logger
m4-checkpoint/ ← checkpoint engine
m5-shadow/ ← file shadow system
m6-risk/ ← risk scoring engine (L1)
m7-intervention/ ← intervention controller
m8-rollback/ ← rollback engine
m9-plugin-sdk/ ← plugin adapter SDK
m10-dashboard/ ← dashboard REST API + SSE
m11-intelligence/ ← risk intelligence (L2/L3)
m12-registry/ ← community adapter registry
m13-telemetry/ ← anonymized telemetry
utils/
rate-limiter.ts ← per-agent rate limiting
circuit-breaker.ts ← per-agent circuit breaker
agent-quota.ts ← per-agent daily quota
graceful-shutdown.ts ← signal handling + drain
slack-notifier.ts ← Slack webhook notifications
claude-desktop-injector.ts ← Claude Desktop config management
mcp-server-registry.ts ← MCP server discovery
tests/
modules/ ← unit tests (one file per module)
e2e/ ← end-to-end pipeline testsDevelopment
git clone https://github.com/agentsgate/agentsgate.git
cd agentsgate
npm install
npm run build # compile TypeScript
npm test # run full test suite
npm run typecheck # type-check without buildingRecommended first run:
npm run bootstrap
npm run smoke:start
node dist/cli.js startContributing
Contributions are welcome. Please open an issue to discuss proposed changes before submitting a pull request.
License
MIT — see LICENSE
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceHuman-in-the-Loop authorization gateway for AI Agents. Securely pause MCP workflows and route high-risk actions to human approvers via Slack or Email.Last updated511MIT
- AlicenseBqualityDmaintenancePre-execution governance for AI agents. 45 MCP tools for hold queues, audit trails, risk scoring, and policy enforcement. Validates agent actions before they execute.Last updated45931MIT
- AlicenseCqualityDmaintenanceEnables secure, zero-trust access to MCP tools through short-lived, signed capability leases that bind tool execution to specific sessions, intents, and constraints. Prevents prompt injection attacks and privilege escalation with dynamic risk scoring, policy enforcement, and tamper-evident audit logging.Last updated41MIT
- Alicense-qualityCmaintenanceA secure MCP gateway for enterprise AI tool execution, enabling governed invocation of business tools with authentication, RBAC, audit logging, PII redaction, and async processing.Last updatedApache 2.0
Related MCP Connectors
Runtime permission, approval, and audit layer for AI agent tool execution.
See, price, and control every tool call your AI agents make: policy checks, cost, and audit tools.
Control plane for autonomous software labor. Agents claim objectives over MCP with audit trail.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/agentsgate/agentsgate'
If you have feedback or need assistance with the MCP directory API, please join our Discord server