Datadog MCP Server
Query Datadog observability data through the official MCP Server.
Requirements
| Variable | Required | Description |
|---|
| INLINECODE0 | ✅ | Datadog API key (Organization Settings → API Keys) |
| INLINECODE1 |
✅ | Datadog Application key (Organization Settings → Application Keys) |
|
DD_SITE | Optional | Datadog site (default:
datadoghq.com) |
Setup
Option A: Remote MCP Server (Recommended)
Datadog hosts the MCP server — no local install needed.
CODEBLOCK0
To select specific toolsets, append ?toolsets=logs,metrics,monitors to the URL.
Option B: Local stdio MCP Server
Use the community datadog-mcp-server npm package:
CODEBLOCK1
Option C: Claude Code / Codex CLI
CODEBLOCK2
Available Toolsets
| Toolset | Tools | Description |
|---|
| INLINECODE6 | General platform tools | Default — always included |
| INLINECODE7 |
get_logs | Search and retrieve log entries |
|
traces |
list_spans,
get_trace | Investigate distributed traces |
|
metrics |
list_metrics,
get_metrics | Query timeseries metrics data |
|
monitors |
get_monitors | Retrieve monitor configs and status |
|
hosts |
list_hosts | Infrastructure host information |
|
incidents |
list_incidents,
get_incident | Incident management |
|
dashboards |
list_dashboards | Discover dashboards |
|
synthetics | Synthetic test tools | Synthetic monitoring tests |
|
workflows | Workflow automation tools | List, inspect, execute workflows |
Select toolsets via URL query parameter: INLINECODE26
Usage Examples
- - Error investigation: "Show me error logs from service:api-gateway in the last hour" — uses
get_logs with query filters - Monitor status: "Are there any triggered monitors for the payments service?" — uses
get_monitors with service tag filter - Metrics query: "Show me p99 latency for web-app over the last 4 hours" — uses
list_metrics then get_metrics for timeseries - Incident response: "List active incidents" — uses INLINECODE31
- Trace investigation: "Find slow spans for service:checkout taking over 5s" — uses
list_spans with duration filter
Operational Runbooks
- -
references/incident-response.md — step-by-step incident triage via MCP - INLINECODE34 — log/trace/metric correlation patterns
- INLINECODE35 — complete tool parameters and response schemas
Multi-Site Support
| Region | Site |
|---|
| US1 (default) | INLINECODE36 |
| US3 |
us3.datadoghq.com |
| US5 |
us5.datadoghq.com |
| EU |
datadoghq.eu |
| AP1 |
ap1.datadoghq.com |
| US1-FED |
ddog-gov.com |
For the remote MCP server, the site is determined by your API key's org. For the local server, pass --site.
Security Notes
- - API keys grant read access to your Datadog org — treat them as secrets
- Application keys inherit the permissions of the user who created them
- Use scoped application keys with minimal permissions for production
- The remote MCP server runs on Datadog infrastructure — data does not leave Datadog
- The local stdio server runs on your machine — API calls go directly to Datadog's API
Datadog MCP 服务器
通过官方 MCP 服务器查询 Datadog 可观测性数据。
要求
| 变量 | 必需 | 描述 |
|---|
| DDAPIKEY | ✅ | Datadog API 密钥(组织设置 → API 密钥) |
| DDAPPKEY |
✅ | Datadog 应用密钥(组织设置 → 应用密钥) |
| DD_SITE | 可选 | Datadog 站点(默认:datadoghq.com) |
设置
选项 A:远程 MCP 服务器(推荐)
Datadog 托管 MCP 服务器 — 无需本地安装。
bash
mcporter add datadog \
--transport http \
--url https://mcp.datadoghq.com/api/unstable/mcp-server/mcp \
--header DD-API-KEY:$DDAPIKEY \
--header DD-APPLICATION-KEY:$DDAPPKEY
要选择特定工具集,请在 URL 后附加 ?toolsets=logs,metrics,monitors。
选项 B:本地 stdio MCP 服务器
使用社区 datadog-mcp-server npm 包:
bash
npx datadog-mcp-server \
--apiKey $DDAPIKEY \
--appKey $DDAPPKEY \
--site $DD_SITE
选项 C:Claude Code / Codex CLI
bash
claude mcp add --transport http datadog-mcp \
https://mcp.datadoghq.com/api/unstable/mcp-server/mcp?toolsets=core
可用工具集
| 工具集 | 工具 | 描述 |
|---|
| core | 通用平台工具 | 默认 — 始终包含 |
| logs |
get_logs | 搜索和检索日志条目 |
| traces | list
spans, gettrace | 调查分布式追踪 |
| metrics | list
metrics, getmetrics | 查询时序指标数据 |
| monitors | get_monitors | 检索监控器配置和状态 |
| hosts | list_hosts | 基础设施主机信息 |
| incidents | list
incidents, getincident | 事件管理 |
| dashboards | list_dashboards | 发现仪表板 |
| synthetics | 合成测试工具 | 合成监控测试 |
| workflows | 工作流自动化工具 | 列出、检查、执行工作流 |
通过 URL 查询参数选择工具集:?toolsets=logs,metrics,monitors,incidents
使用示例
- - 错误调查: 显示过去一小时内服务:api-gateway 的错误日志 — 使用带查询过滤器的 getlogs
- 监控器状态: 支付服务是否有任何触发的监控器? — 使用带服务标签过滤器的 getmonitors
- 指标查询: 显示过去 4 小时内 web-app 的 p99 延迟 — 先使用 listmetrics 再使用 getmetrics 获取时序数据
- 事件响应: 列出活跃事件 — 使用 listincidents
- 追踪调查: 查找服务:checkout 中耗时超过 5 秒的慢跨度 — 使用带持续时间过滤器的 listspans
操作手册
- - references/incident-response.md — 通过 MCP 进行逐步事件分类
- references/troubleshooting.md — 日志/追踪/指标关联模式
- references/api-reference.md — 完整工具参数和响应模式
多站点支持
| 区域 | 站点 |
|---|
| US1(默认) | datadoghq.com |
| US3 |
us3.datadoghq.com |
| US5 | us5.datadoghq.com |
| EU | datadoghq.eu |
| AP1 | ap1.datadoghq.com |
| US1-FED | ddog-gov.com |
对于远程 MCP 服务器,站点由您的 API 密钥所属组织决定。对于本地服务器,请传递 --site 参数。
安全说明
- - API 密钥授予对您 Datadog 组织的读取权限 — 请将其视为机密信息
- 应用密钥继承创建该密钥的用户的权限
- 在生产环境中使用具有最小权限的范围限定应用密钥
- 远程 MCP 服务器运行在 Datadog 基础设施上 — 数据不会离开 Datadog
- 本地 stdio 服务器运行在您的机器上 — API 调用直接发送到 Datadog 的 API