Overview

Integrate MCPcat with Datadog for monitoring and alerting. Events are sent as both logs and metrics for comprehensive observability.

Prerequisites

  1. A Datadog account with an API key
  2. Your Datadog site (e.g., datadoghq.com for US, datadoghq.eu for EU)

Configuration

mcpcat.track(server, null, {
  exporters: {
    datadog: {
      type: "datadog",
      apiKey: process.env.DD_API_KEY,
      site: "datadoghq.com",
      service: "my-mcp-server",
      env: "production"
    }
  }
})

Configuration Fields

FieldTypeRequiredDescription
api_key / apiKeystringYesYour Datadog API key
sitestringYesDatadog site (e.g., “datadoghq.com”, “datadoghq.eu”)
servicestringYesService name for grouping
envstringNoEnvironment name (default: “production”)

Field Mapping

Trace and Span IDs

MCPcat FieldDatadog FieldFormat
session_idtrace_idNumeric - last 64 bits of SHA256 hash
event_idspan_idNumeric - SHA256 hash

Logs

Each event creates a log entry with the following structure:
FieldValueDescription
message"{event_type} - {resource_name}"Combined event type and resource (e.g., “tools/call - get_weather”)
serviceYour configured service nameFrom exporter configuration
ddsource"mcpcat"Fixed source identifier
ddtagsComma-separated stringIncludes env, event_type, resource, and error tags
timestampUnix timestamp in millisecondsEvent occurrence time
status"error" or "info"Based on is_error flag

MCP Event Data

All MCPcat event fields are preserved in the mcp object:
FieldDescription
mcp.session_idSession identifier
mcp.event_idEvent identifier
mcp.event_typeEvent type (e.g., “tools/call”)
mcp.resourceResource name
mcp.duration_msDuration in milliseconds
mcp.user_intentUser’s intent (if captured)
mcp.actor_idUser identifier (if identified)
mcp.actor_nameUser name (if identified)
mcp.client_nameMCP client name
mcp.client_versionMCP client version
mcp.server_nameServer name
mcp.server_versionServer version
mcp.is_errorError flag (boolean)
mcp.errorError details (if applicable)

Metrics

Metric NameTypeDescription
mcp.events.countcountTotal number of events
mcp.event.durationgaugeEvent duration in milliseconds
mcp.errors.countcountNumber of error events
All metrics include the following tags for filtering and grouping:
TagExample ValueSource
service"my-mcp-server"Exporter configuration
env"production"Exporter configuration
event_type"tools.call"Event type (slashes replaced with dots)
resource"get_weather"Resource name