Cover image
Try Now
2025-04-04

MCP服务器与官方的Datadog API互动

3 years

Works with Finder

2

Github Watches

1

Github Forks

10

Github Stars

Datadog MCP Server

A Model Context Protocol (MCP) server for interacting with the Datadog API.

Datadog MCP server

Features

  • Monitoring: Access monitor data and configurations
  • Dashboards: Retrieve and view dashboard definitions
  • Metrics: Query available metrics and their metadata
  • Events: Search and retrieve events within timeframes
  • Logs: Search logs with advanced filtering and sorting options
  • Incidents: Access incident management data
  • API Integration: Direct integration with Datadog's v1 and v2 APIs
  • Comprehensive Error Handling: Clear error messages for API and authentication issues

Prerequisites

  1. Node.js (version 16 or higher)
  2. Datadog account with:
    • API key - Found in Organization Settings > API Keys
    • Application key - Found in Organization Settings > Application Keys

Installation

Via npm (recommended)

npm install -g datadog-mcp-server

From Source

  1. Clone this repository
  2. Install dependencies:
    npm install
    
  3. Build the project:
    npm run build
    

Configuration

You can configure the Datadog MCP server using either environment variables or command-line arguments.

Environment Variables

Create a .env file with your Datadog credentials:

DD_API_KEY=your_api_key_here
DD_APP_KEY=your_app_key_here
DD_SITE=datadoghq.com

Command-line Arguments

datadog-mcp-server --apiKey=your_api_key --appKey=your_app_key --site=datadoghq.eu

Note: The site argument doesn't need https:// - it will be added automatically.

Usage with Claude Desktop

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "datadog": {
      "command": "npx",
      "args": [
        "datadog-mcp-server",
        "--apiKey",
        "<YOUR_API_KEY>",
        "--appKey",
        "<YOUR_APP_KEY>",
        "--site",
        "<YOUR_DD_SITE>(e.g us5.datadoghq.com)"
      ]
    }
  }
}

Locations for the Claude Desktop config file:

  • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%/Claude/claude_desktop_config.json

Usage with MCP Inspector

To use with the MCP Inspector tool:

npx @modelcontextprotocol/inspector datadog-mcp-server --apiKey=your_api_key --appKey=your_app_key

Available Tools

The server provides these MCP tools:

  • get-monitors: Fetch monitors with optional filtering
  • get-monitor: Get details of a specific monitor by ID
  • get-dashboards: List all dashboards
  • get-dashboard: Get a specific dashboard by ID
  • get-metrics: List available metrics
  • get-metric-metadata: Get metadata for a specific metric
  • get-events: Fetch events within a time range
  • get-incidents: List incidents with optional filtering
  • search-logs: Search logs with advanced query filtering
  • aggregate-logs: Perform analytics and aggregations on log data

Examples

Example: Get Monitors

{
  "method": "tools/call",
  "params": {
    "name": "get-monitors",
    "arguments": {
      "groupStates": ["alert", "warn"],
      "limit": 5
    }
  }
}

Example: Get a Dashboard

{
  "method": "tools/call",
  "params": {
    "name": "get-dashboard",
    "arguments": {
      "dashboardId": "abc-def-123"
    }
  }
}

Example: Search Logs

{
  "method": "tools/call",
  "params": {
    "name": "search-logs",
    "arguments": {
      "filter": {
        "query": "service:web-app status:error",
        "from": "now-15m",
        "to": "now"
      },
      "sort": "-timestamp",
      "limit": 20
    }
  }
}

Example: Aggregate Logs

{
  "method": "tools/call",
  "params": {
    "name": "aggregate-logs",
    "arguments": {
      "filter": {
        "query": "service:web-app",
        "from": "now-1h",
        "to": "now"
      },
      "compute": [
        {
          "aggregation": "count"
        }
      ],
      "groupBy": [
        {
          "facet": "status",
          "limit": 10,
          "sort": {
            "aggregation": "count",
            "order": "desc"
          }
        }
      ]
    }
  }
}

Example: Get Incidents

{
  "method": "tools/call",
  "params": {
    "name": "get-incidents",
    "arguments": {
      "includeArchived": false,
      "query": "state:active",
      "pageSize": 10
    }
  }
}

Troubleshooting

If you encounter a 403 Forbidden error, verify that:

  1. Your API key and Application key are correct
  2. The keys have the necessary permissions to access the requested resources
  3. Your account has access to the requested data

Debugging

If you encounter issues, check Claude Desktop's MCP logs:

# On macOS
tail -n 20 -f ~/Library/Logs/Claude/mcp*.log

# On Windows
Get-Content -Path "$env:APPDATA\Claude\Logs\mcp*.log" -Tail 20 -Wait

Common issues:

  • 403 Forbidden: Authentication issue with Datadog API keys
  • API key or App key format invalid: Ensure you're using the full key strings
  • Site configuration errors: Make sure you're using the correct Datadog domain

License

MIT

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • Lists Tailwind CSS classes in monospaced font

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • https://appia.in
  • Siri Shortcut Finder – your go-to place for discovering amazing Siri Shortcuts with ease

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • tomoyoshi hirata
  • Sony α7IIIマニュアルアシスタント

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • HiveNexus
  • 一个适用于中小型团队的AI聊天机器人,支持DeepSeek,Open AI,Claude和Gemini等车型。 专为中小团队设计的ai聊天应用,支持deepSeek,打开ai,claude,双子座等模型。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • JackKuo666
  • 🔍使AI助手可以通过简单的MCP接口搜索和访问PYPI软件包信息。

    Reviews

    5 (1)
    Avatar
    user_sfDlAld0
    2025-04-17

    As a loyal user of the mcp application, I have found the datadog-mcp-server by GeLi2001 to be an invaluable asset. It seamlessly integrates with my existing projects and offers a robust server solution. The setup is straightforward, and the support on the GitHub page is exceptional. I highly recommend checking it out!