Datadog MCP服务器
    ](https://github.com/shelfio/datadog-mcp/releases)
一种模型上下文协议(MCP)服务器,通过Claude Desktop和其他MCP客户端提供全面的Datadog监控功能。
特性
此MCP服务器使Claude能够:
- CI/CD管道管理:列出CI管道,提取指纹
- 服务日志分析:使用环境和时间过滤检索和分析服务日志
- 指标监控:通过灵活的过滤、聚合和字段发现查询任何Datadog指标
- 监控和警报:列出并管理Datadog监视器和服务级别目标(SLO)
- 服务定义:列出并检索包含元数据、所有权和配置的详细服务定义
- 团队管理:列出团队、查看成员详细信息和管理团队信息
快速开始
选择运行Datadog MCP服务器的首选方法:
🚀 UVX直接运行(推荐)
export DD_API_KEY="your-datadog-api-key" DD_APP_KEY="your-datadog-application-key"
# Latest version (HEAD)
uvx --from git+https://github.com/shelfio/datadog-mcp.git datadog-mcp
# Specific version (recommended for production)
uvx --from git+https://github.com/shelfio/datadog-mcp.git@v0.0.5 datadog-mcp
# Specific branch
uvx --from git+https://github.com/shelfio/datadog-mcp.git@main datadog-mcp🔧 UV快速运行(开发)
export DD_API_KEY="your-datadog-api-key" DD_APP_KEY="your-datadog-application-key"
git clone https://github.com/shelfio/datadog-mcp.git /tmp/datadog-mcp && cd /tmp/datadog-mcp && uv run ddmcp/server.py🐳 波德曼(可选)
podman run -e DD_API_KEY="your-datadog-api-key" -e DD_APP_KEY="your-datadog-application-key" -i $(podman build -q https://github.com/shelfio/datadog-mcp.git)方法比较:
| 方法 | 速度 | 最新代码 | 设置 | 最适合 |
|---|---|---|---|---|
| 🚀 UVX直接运行 | ⚡⚡⚡ | ✅ (版本化) | 最小 | 生产,克劳德桌面 |
| 🔧 UV快速运行 | ⚡⚡ | ✅ (前沿) | 需要克隆 | 开发、测试 |
| 🐳 波德曼 | ⚡ | ✅ (前沿) | 需要Podman | 集装箱化环境 |
需求
UVX/UV方法
- Python 3.13+
- UV包管理器(包括uvx)
- Datadog API密钥和应用程序密钥
波德曼方法
- 波德曼
- Datadog API密钥和应用程序密钥
版本管理
使用UVX时,您可以为可重复部署指定确切的版本:
版本格式
- 最新:
git+https://github.com/shelfio/datadog-mcp.git(头部) - 特定标签:
git+https://github.com/shelfio/datadog-mcp.git@v0.0.5 - 分支:
git+https://github.com/shelfio/datadog-mcp.git@main - 提交哈希:
git+https://github.com/shelfio/datadog-mcp.git@59f0c15
建议
- 生产:使用特定标签(例如。,
@v0.0.5)为了稳定性 - 发展:使用最新或特定分支获取最新功能
- 测试:使用提交哈希以实现精确的可重复性
看 对于所有可用版本。
Claude桌面集成
使用UVX(推荐)
添加到Claude桌面配置:
最新版本(前沿):
{
"mcpServers": {
"datadog": {
"command": "uvx",
"args": ["--from", "git+https://github.com/shelfio/datadog-mcp.git", "datadog-mcp"],
"env": {
"DD_API_KEY": "your-datadog-api-key",
"DD_APP_KEY": "your-datadog-application-key"
}
}
}
}特定版本(推荐用于生产):
{
"mcpServers": {
"datadog": {
"command": "uvx",
"args": ["--from", "git+https://github.com/shelfio/datadog-mcp.git@v0.0.5", "datadog-mcp"],
"env": {
"DD_API_KEY": "your-datadog-api-key",
"DD_APP_KEY": "your-datadog-application-key"
}
}
}
}欧盟地区 (参见 多区域支持 其他地区):
{
"mcpServers": {
"datadog": {
"command": "uvx",
"args": ["--from", "git+https://github.com/shelfio/datadog-mcp.git", "datadog-mcp"],
"env": {
"DD_API_KEY": "your-datadog-api-key",
"DD_APP_KEY": "your-datadog-application-key",
"DD_SITE": "datadoghq.eu"
}
}
}
}使用本地开发设置
对于使用本地克隆存储库进行开发:
git clone https://github.com/shelfio/datadog-mcp.git
cd datadog-mcp添加到Claude桌面配置:
{
"mcpServers": {
"datadog": {
"command": "uv",
"args": ["run", "ddmcp/server.py"],
"cwd": "/path/to/datadog-mcp",
"env": {
"DD_API_KEY": "your-datadog-api-key",
"DD_APP_KEY": "your-datadog-application-key"
}
}
}
}安装选项
UVX安装(推荐)
直接从GitHub安装并运行,无需克隆:
export DD_API_KEY="your-datadog-api-key"
export DD_APP_KEY="your-datadog-application-key"
# Latest version
uvx --from git+https://github.com/shelfio/datadog-mcp.git datadog-mcp
# Specific version (recommended for production)
uvx --from git+https://github.com/shelfio/datadog-mcp.git@v0.0.5 datadog-mcp开发安装
对于本地开发和测试:
- 克隆存储库:
git clone https://github.com/shelfio/datadog-mcp.git
cd datadog-mcp- 安装依赖项:
uv sync- 运行服务器:
export DD_API_KEY="your-datadog-api-key"
export DD_APP_KEY="your-datadog-application-key"
uv run ddmcp/server.pyPodman安装(可选)
对于容器化环境:
podman run -e DD_API_KEY="your-key" -e DD_APP_KEY="your-app-key" -i $(podman build -q https://github.com/shelfio/datadog-mcp.git)工具
服务器为Claude提供了以下工具:
list_ci_pipelines
列出在Datadog中注册的所有CI管道及其过滤选项。
论据:
repository(可选):按存储库名称筛选pipeline_name(可选):按管道名称筛选format(可选):输出格式-“表”、“json”或“摘要”
get_pipeline_fingerprints
提取管道指纹以用于Terraform服务定义。
论据:
repository(可选):按存储库名称筛选pipeline_name(可选):按管道名称筛选format(可选):输出格式-“表”、“json”或“摘要”
list_metrics
列出Datadog中用于指标发现的所有可用指标。
论据:
filter(可选):按标签搜索指标的过滤器(例如,“aws:*','环境:*','服务:web')limit(可选):要返回的最大指标数(默认值:100,最大值:10000)
get_metrics
通过灵活的过滤和聚合查询任何Datadog指标。
论据:
metric_name(必填):要查询的度量名称(例如,“aws.apigateway.count”、“system.cpu.user”)time_range(可选):“1h”、“4h”、“8h”、“1d”、“7d”、“14d”、“30d”aggregation(可选):“平均”、“总和”、“最小”、“最大”、“计数”filters(可选):要应用的过滤器字典(例如,{“service”:“web”,'env':“prod”})aggregation_by(可选):用于对结果进行分组的字段列表format(可选):“表”、“摘要”、“json”、“时间序列”
get_metric_fields
检索特定指标的所有可用字段(标签)。
论据:
metric_name(必填):用于获取字段的度量名称time_range(可选):“1h”、“4h”、“8h”、“1d”、“7d”、“14d”、“30d”
get_metric_field_values
检索指标特定字段的所有值。
论据:
metric_name(必填):度量名称field_name(必填):用于获取值的字段名time_range(可选):“1h”、“4h”、“8h”、“1d”、“7d”、“14d”、“30d”
list_service_definitions
列出Datadog中所有带有分页和筛选功能的服务定义。
论据:
page_size(可选):每页服务定义数(默认值:10,最大值:100)page_number(可选):分页页码(0索引,默认值:0)schema_version(可选):按架构版本筛选(例如,“v2”、“v2.1”、“v2.0”)format(可选):输出格式-“表”、“json”或“摘要”
get_service_definition
使用详细的元数据检索特定服务的定义。
论据:
service_name(必填):要检索的服务的名称schema_version(可选):要检索的架构版本(默认:“v2.2”,选项:“v1”、“v2”、“v2.1”、“v2.0”)format(可选):输出格式-“格式化”、“json”或“yaml”
get_service_logs
检索具有全面过滤功能的服务日志。
论据:
service_name(必填):服务名称time_range(必填):“1h”、“4h”、“8h”、“1d”、“7d”、“14d”、“30d”environment(可选):“prod”、“staging”、“backoffice”log_level(可选):“信息”、“错误”、“警告”、“调试”format(可选):“表”、“文本”、“json”、“摘要”
list_monitors
列出所有具有全面过滤选项的Datadog监视器。
论据:
name(可选):按名称筛选监视器(子字符串匹配)tags(可选):按标签过滤监视器(例如,“env:prod,service:web”)monitor_tags(可选):按监视器标签过滤监视器(例如,“团队:后端”)page_size(可选):每页监视器数量(默认值:50,最大值:1000)page(可选):页码(0索引,默认值:0)format(可选):输出格式-“表”、“json”或“摘要”
list_slos
列出Datadog中具有过滤功能的服务级别目标(SLO)。
论据:
query(可选):按名称或描述过滤SLO(子字符串匹配)tags(可选):按标签过滤SLO(例如,“团队:后端,环境:产品”)limit(可选):要返回的最大SLO数(默认值:50,最大值:1000)offset(可选):要跳过的SLO数量(默认值:0)format(可选):输出格式-“表”、“json”或“摘要”
get_teams
列出团队及其成员。
论据:
team_name(可选):按团队名称筛选include_members(可选):包括成员详细信息(默认值:false)format(可选):“表”、“json”、“摘要”
例子
请克劳德帮你:
"Show me all CI pipelines for the shelf-api repository"
"Get error logs for the content service in the last 4 hours"
"List all available AWS metrics"
"What are the latest metrics for aws.apigateway.count grouped by account?"
"Get all available fields for the system.cpu.user metric"
"List all service definitions in my organization"
"Get the definition for the user-api service"
"List all teams and their members"
"Show all monitors for the web service"
"List SLOs with less than 99% uptime"
"Extract pipeline fingerprints for Terraform configuration"配置
环境变量
| 变量 | 描述 | 必填 | 默认 |
|---|---|---|---|
DD_API_KEY | 数据狗API密钥 | 是 | - |
DD_APP_KEY | Datadog应用程序密钥 | 是 | - |
DD_SITE | 数据狗站点/地区(见下表) | 否 | datadoghq.com |
多区域支持
Datadog在多个地区开展业务。设置 DD_SITE 连接到Datadog区域的环境变量:
| 区域 | DD_SITE值 | 描述 |
|---|---|---|
| 美国1 | datadoghq.com | 美国(默认) |
| 美国3 | us3.datadoghq.com | 美国3 |
| 美国5 | us5.datadoghq.com | 美国5 |
| EU1 | datadoghq.eu | 欧洲 |
| AP1 | ap1.datadoghq.com | 亚太地区(日本) |
| 美国1-美联储 | ddog-gov.com | 美国政府 |
欧盟地区示例:
export DD_SITE="datadoghq.eu"
export DD_API_KEY="your-api-key"
export DD_APP_KEY="your-app-key"
uvx --from git+https://github.com/shelfio/datadog-mcp.git datadog-mcp看 Datadog网站入门指南 了解更多信息。
获取Datadog凭据
- 登录您的Datadog帐户
- 首选 组织设置 → API密钥
- 创建或复制您的 API密钥 (这是你的
DD_API_KEY) - 首选 组织设置 → 应用程序密钥
- 创建或复制您的 程序键 (这是你的
DD_APP_KEY)
注: 这是两个不同的键:
- API密钥:用于使用Datadog的API进行身份验证
- 程序键:用于授权,并绑定到特定的用户帐户
