Skip to main content
MCPHub exposes health checks, an optional Prometheus metrics endpoint, logs, and activity tracking. OpenTelemetry exporters and alerting pipelines are not bundled.

Health endpoint

GET /health — public, no authentication.
Sample response:
status is one of: This makes /health suitable for liveness/readiness probes. See src/controllers/healthController.ts.

Prometheus metrics

Set ENABLE_METRICS=true to enable GET /metrics at the root, independently of BASE_PATH. It returns 404 when disabled (the default). Set METRICS_TOKEN to require Authorization: Bearer <token>; this is a dedicated scrape credential, not a dashboard or MCP bearer key. Without this variable the enabled endpoint is public. Restrict access to your monitoring network or configure the token, especially on multi-tenant deployments.
Calls through MCP, Dashboard and the OpenAPI tool API share instrumentation. One client call counts once regardless of internal retries; both thrown errors and isError results count as failures. Calls without a resolved upstream (including search/describe meta-tools and credential preparation failures) use server="unknown". These counters do not include HTTP authentication rejections before the tool handler. There are no group, user, session, tool-name or raw-error labels. Error categories and an OTel exporter are outside this initial implementation. Metrics work without a database or activity logging. Each process owns its counters, which reset on restart; scrape each replica separately. Server/session gauges refresh at scrape time without connecting to upstreams. Time series for removed server names remain until restart, so avoid continually creating new server names.

In-process logs

MCPHub keeps a rolling in-memory log buffer (src/services/logService.ts) that powers the dashboard’s log viewer. The stream emits one data: line per event, including an initial { "type": "initial", "logs": [...] } snapshot. All three endpoints require an authenticated admin (dashboard JWT, bearer key with accessType: all, OAuth token, or Better Auth session). The buffer is process-local. For multi-instance deployments, ship stdout to your log aggregator instead of relying on this endpoint.

Activity log (database mode)

When MCPHub runs against PostgreSQL (see Database Configuration), every MCP request/response is persisted to the mcphub_activity table by src/services/activityLoggingService.ts. The dashboard exposes it through: In file mode these endpoints return 404 and the dashboard hides the Activity page.

Process-level metrics

The dashboard surfaces basic server connection statistics from getServerConnectionStats() (also embedded in /health). To export richer process metrics:
  • Use any Node.js APM agent that wraps http/express automatically.
  • Or scrape /health and /api/activities/stats from your monitoring platform.

See also