Summary
Add a /metrics endpoint that exposes gateway metrics in Prometheus format for production observability.
Parent Epic
Part of #1 - Production Kubernetes & Container Support
Proposed Metrics
Gateway Metrics
| Metric |
Type |
Description |
mcp_gateway_requests_total |
Counter |
Total MCP requests by server_id, method |
mcp_gateway_request_duration_seconds |
Histogram |
Request latency histogram |
mcp_gateway_active_servers |
Gauge |
Currently running server instances |
mcp_gateway_server_starts_total |
Counter |
Server startup count by server_id |
mcp_gateway_server_stops_total |
Counter |
Server shutdown count by server_id, reason |
mcp_gateway_errors_total |
Counter |
Error count by server_id, error_type |
Server-Level Metrics
| Metric |
Type |
Description |
mcp_server_tools_called_total |
Counter |
Tool invocations by server_id, tool_name |
mcp_server_uptime_seconds |
Gauge |
Time since server started |
mcp_server_memory_bytes |
Gauge |
Memory usage (if available) |
Implementation
Dependencies
[dependencies]
prometheus = "0.13"
Endpoint
GET /metrics
Content-Type: text/plain; version=0.0.4
Example Output
# HELP mcp_gateway_requests_total Total MCP requests
# TYPE mcp_gateway_requests_total counter
mcp_gateway_requests_total{server_id="postgres",method="tools/call"} 142
# HELP mcp_gateway_active_servers Currently running servers
# TYPE mcp_gateway_active_servers gauge
mcp_gateway_active_servers 3
Acceptance Criteria
References
Summary
Add a
/metricsendpoint that exposes gateway metrics in Prometheus format for production observability.Parent Epic
Part of #1 - Production Kubernetes & Container Support
Proposed Metrics
Gateway Metrics
mcp_gateway_requests_totalmcp_gateway_request_duration_secondsmcp_gateway_active_serversmcp_gateway_server_starts_totalmcp_gateway_server_stops_totalmcp_gateway_errors_totalServer-Level Metrics
mcp_server_tools_called_totalmcp_server_uptime_secondsmcp_server_memory_bytesImplementation
Dependencies
Endpoint
Example Output
Acceptance Criteria
/metricsendpoint returns Prometheus-format metricsReferences