Datadog MCP Server
DISCLAIMER: This is a community-maintained project and is not officially affiliated with, endorsed by, or supported by Datadog, Inc. This MCP server utilizes the Datadog API but is developed independently.
MCP server providing AI assistants with full Datadog observability access. Features grep-like log search, APM trace filtering with duration/status/error queries, smart sampling modes for token efficiency, and cross-correlation between logs, traces, and metrics. Supports both stdio (local) and http (remote/Kubernetes) transports.
Quick Start
Minimal Claude Desktop / VS Code / Cursor config — just the two required keys:
{
"mcpServers": {
"datadog": {
"command": "npx",
"args": ["-y", "datadog-mcp"],
"env": {
"DD_API_KEY": "your-api-key",
"DD_APP_KEY": "your-app-key"
}
}
}
}
With optional tuning (EU site, custom default limits, longer log windows):
{
"mcpServers": {
"datadog": {
"command": "npx",
"args": ["-y", "datadog-mcp"],
"env": {
"DD_API_KEY": "your-api-key",
"DD_APP_KEY": "your-app-key",
"DD_SITE": "datadoghq.eu",
"MCP_DEFAULT_LIMIT": "50",
"MCP_DEFAULT_LOG_LINES": "200",
"MCP_DEFAULT_METRIC_POINTS": "1000",
"MCP_DEFAULT_TIME_RANGE": "24"
}
}
}
}
To run as an HTTP server (e.g. inside a container or Kubernetes pod), add transport variables to the same env block:
"env": {
"DD_API_KEY": "your-api-key",
"DD_APP_KEY": "your-app-key",
"MCP_TRANSPORT": "http",
"MCP_PORT": "3000",
"MCP_HOST": "0.0.0.0"
}
Configuration
Required environment variables
DD_API_KEY=your-api-key
DD_APP_KEY=your-app-key
Optional environment variables
DD_SITE=datadoghq.com # Default. Use datadoghq.eu for EU, etc.
# Limit defaults (fallbacks when the AI doesn't specify)
MCP_DEFAULT_LIMIT=50 # General tools default limit
MCP_DEFAULT_LOG_LINES=200 # Logs tool default limit
MCP_DEFAULT_METRIC_POINTS=1000 # Metrics timeseries data points
MCP_DEFAULT_TIME_RANGE=24 # Default time range in hours
# Transport (alternative to CLI flags — useful in Kubernetes)
MCP_TRANSPORT=stdio # stdio | http
MCP_PORT=3000 # HTTP port
MCP_HOST=0.0.0.0 # HTTP host
Optional flags
--site=datadoghq.com # Datadog site (overrides DD_SITE)
--transport=stdio|http # Transport mode (default: stdio)
--port=3000 # HTTP port when using http transport
--host=0.0.0.0 # HTTP host when using http transport
--read-only # Block all write operations
--disable-tools=synthetics,rum,security # Comma-separated list of tools to disable
Transports
Select with --transport=http or MCP_TRANSPORT=http.
Deployment
Docker
{
"mcpServers": {
"datadog": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "DD_API_KEY",
"-e", "DD_APP_KEY",
"-e", "DD_SITE",
"ghcr.io/tantiope/datadog-mcp"
],
"env": {
"DD_API_KEY": "your-api-key",
"DD_APP_KEY": "your-app-key",
"DD_SITE": "datadoghq.com"
}
}
}
}
Kubernetes
Use environment variables — not container args — for transport configuration:
env:
- name: DD_API_KEY
value: "your-api-key"
- name: DD_APP_KEY
value: "your-app-key"
- name: MCP_TRANSPORT
value: "http"
- name: MCP_PORT
value: "3000"
- name: MCP_HOST
value: "0.0.0.0"
Note: Kubernetes
args:replaces the entire Dockerfile CMD, causing Node.js to receive the flags instead of your application. Environment variables avoid this issue.
Tools
Limit Control
AI assistants have full control over query limits. The MCP_DEFAULT_* environment variables only set the fallback used when the AI doesn't specify a limit — they do NOT cap what the AI can request.
Tool-level token reduction features (compact: true on logs, sample: "diverse" | "spread" | "first", field projections, diagnostics) are surfaced in each tool's MCP description and chosen by the AI at call time.
Notable behaviors
A handful of patterns worth knowing about — the AI can discover the rest from tool descriptions.
- Renotifies vs real fires.
monitors topandevents searchwithsource:alertcount every renotify Datadog emits (one everyrenotify_intervalwhile a monitor is Alert). To get actual state transitions, usemonitors history(defaults totransitionType: ["alert","alert recovery"]) or passtransitionTypetoevents search. - DST-safe time buckets.
events histogrambuckets byhour_of_day/day_of_week/day_of_monthin any IANAtimezoneviaIntl.DateTimeFormat. Cursor-paginates the underlying search; cap controlled byMCP_MAX_EVENTS_HISTOGRAM(default 5000) withbucketCountIncomplete+nextCursoron overflow. - Validate before create.
monitors createwithdry_run: truecalls/api/v1/monitor/validateinstead of persisting. Allowed in--read-onlymode. - Monitor template preview.
monitors previewrenders a notification against acontextpayload — variable substitution + Datadog's six documented conditionals (is_alert,is_warning,is_no_data,is_recovery,is_alert_to_warning,is_warning_to_alert) + the tag conditionals{{#is_match "tag" "val"}}(substring) and{{#is_exact_match "tag" "val"}}(exact), with^negations and OR'd multiple comparison values (resolved againstcontext.variables; case-sensitive).{{#each}}and partials throwEUNSUPPORTED_TEMPLATE_SYNTAX. - SLO round-trip.
slos getprojectsquery,monitorIds,monitorTags,groups, and a UIurlso you can edit and feed back intoslos updatewithout dropping definition fields. - Cross-correlation.
logs(sample:"diverse")→ pulldd.trace_id→traces(query:"trace_id:<id>")→metrics(query:"p95:trace.express.request{service:...}")(root metric without.durationfor percentiles).
Deep links
Every query response includes a datadog_url field built for your configured DD_SITE — datadoghq.com (default), .eu, us3 / us5 / ap1.datadoghq.com, or ddog-gov.com. Supported on logs, metrics, traces, events, monitors, rum, slos.
Contributing
Contributions are welcome! Feel free to open an issue or a pull request if you have any suggestions, bug reports, or improvements to propose.
License
This project is licensed under the Apache License, Version 2.0.