🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@frontmcp/observability

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frontmcp/observability

OpenTelemetry instrumentation, structured JSON logging, and request log objects for FrontMCP

latest
Source
npmnpm
Version
1.6.0
Version published
Weekly downloads
203
-62.2%
Maintainers
1
Weekly downloads
 
Created
Source

@frontmcp/observability

OpenTelemetry instrumentation, structured JSON logging, and Prometheus metrics for FrontMCP servers.

NPM

What you get

Install the plugin and every MCP request produces a trace span, a structured log line, and counters — without touching your tool code.

  • Traces — W3C trace context propagated across the request pipeline, with MCP-specific span attributes (tool name, session, transport, RPC method).
  • Logs — one structured JSON object per request; ready for Datadog, Loki, CloudWatch, or anything that reads JSON from stdout.
  • Metrics — counters and gauges exposed in Prometheus or JSON format.
  • Process stats — memory, event-loop lag, and uptime.

Install

npm install @frontmcp/observability

Usage

import { ObservabilityPlugin } from '@frontmcp/observability';
import { FrontMcp } from '@frontmcp/sdk';

@FrontMcp({
  info: { name: 'my-server', version: '1.0.0' },
  apps: [MyApp],
  plugins: [ObservabilityPlugin],
})
class Server {}

Configure

plugins: [
  ObservabilityPlugin.configure({
    logging: { level: 'info', includeRequestBody: false },
    otel: { serviceName: 'my-server', endpoint: process.env.OTEL_EXPORTER_OTLP_ENDPOINT },
  }),
];

Do not log request bodies in production unless you have reviewed them for PII — tool arguments frequently carry user data.

Exposing metrics

import { PROMETHEUS_CONTENT_TYPE, renderPrometheusExposition } from '@frontmcp/observability';

http: {
  routes: [
    {
      method: 'GET',
      path: '/metrics',
      handler: (_req, res) => {
        res.setHeader('Content-Type', PROMETHEUS_CONTENT_TYPE);
        res.status(200).send(renderPrometheusExposition());
      },
    },
  ];
}

renderJsonExposition() returns the same data as JSON when you would rather scrape structured output.

/metrics is unauthenticated in the snippet above. Bind it to an internal interface, or put it behind auth, before exposing the server publicly.

Key exports

ExportPurpose
ObservabilityPluginThe plugin — add it to plugins: []
setupOTelWire an OTel SDK yourself instead of via the plugin
FrontMcpPropagatorW3C trace-context propagator for FrontMCP contexts
McpAttributes, RpcAttributes, HttpAttributesSemantic-convention attribute keys
renderPrometheusExposition, renderJsonExpositionMetrics rendering
ProcessStatsCollectorMemory / event-loop / uptime sampling
reportStartupEmit a structured boot record

Trace context over MCP

Protocol revision 2026-07-28 carries OpenTelemetry context in the request _meta (traceparent, tracestate, baggage) per SEP-414, and FrontMCP echoes it back on the result. A client can therefore stitch its span to the server's without an out-of-band correlation id — see the protocol versions guide.

Full guide: Observability · Metrics

License

Apache-2.0

Keywords

opentelemetry

FAQs

Package last updated on 02 Aug 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts