Metrics Collection
MCP Gatekeeper automatically collects performance metrics from all MCP servers.
Collected Metrics
STDIO Servers
- Tool Call Count: Number of times each tool is called
- Latency: Response time per tool call
- Success Rate: Percentage of successful calls
- Error Count: Failed tool calls
- Agent Attribution: Which agent made the call
HTTP Servers
- Request Count: Total HTTP requests proxied
- Response Codes: Status code distribution
- Latency: Request/response time
- Error Rate: Failed requests percentage
- Agent Attribution: Extracted from URL path
Collection Methods
STDIO Wrapper
When packages are installed, MCP Gatekeeper:
- Replaces the binary entry point with a wrapper
- Wrapper intercepts STDIO communication
- Metrics extracted from JSON-RPC messages
- Metrics sent to
/api/metrics/record - Original execution continues transparently
HTTP Proxy
For HTTP servers:
- All requests pass through the proxy
- Proxy measures request/response timing
- Status codes and errors captured
- Metrics stored in database
- Real-time broadcast via WebSocket
Viewing Metrics
Metrics Page
Navigate to Metrics to view:
- Tool call distribution charts
- Latency histograms
- Error rate trends
- Time series data
- Agent breakdown
Server Activity Page
Per-server metrics:
- Individual server statistics
- Tool-by-tool breakdown
- Performance trends
- Recent activity
Dashboard
High-level overview:
- Total tool calls
- Average latency
- Error count
- Active servers
Metrics Storage
Metrics are stored in SQLite database:
- Retention: All metrics kept indefinitely
- Aggregation: Pre-computed summaries for performance
- Cleanup: Manual cleanup available
API Access
Metrics available via REST API:
GET /api/metrics/summary- Overall summaryGET /api/http-servers/{id}/metrics- HTTP server metrics- Real-time updates via WebSocket
For details, see Metrics API.
Privacy
Metrics collection:
- Local only (stored in SQLite)
- No external transmission
- Full data control
- Can be disabled by not using the wrapper