Datadog MCP server

Integrates with Datadog monitoring platform to provide access to metrics, logs, dashboards, monitors, and incidents for DevOps and SRE workflows
Back to servers
Setup instructions
Provider
GeLi2001
Release date
Apr 04, 2025
Language
TypeScript
Package
Stats
2.3K downloads
50 stars

The Datadog MCP Server provides a Model Context Protocol implementation for interacting with the Datadog API, giving access to monitors, dashboards, metrics, events, logs, and incidents from your Datadog environment through a standardized protocol.

Prerequisites

  • Node.js (version 16 or higher)
  • 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

# Clone the repository
# Install dependencies
npm install

# Build the project
npm run build

Configuration

Configure the server using environment variables or command-line arguments.

Environment Variables

Create a .env file with your credentials:

DD_API_KEY=your_api_key_here
DD_APP_KEY=your_app_key_here
DD_SITE=datadoghq.com
DD_LOGS_SITE=datadoghq.com
DD_METRICS_SITE=datadoghq.com

Note: DD_LOGS_SITE and DD_METRICS_SITE are optional and default to DD_SITE if not specified.

Command-line Arguments

Basic usage with global site setting:

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

Advanced usage with service-specific endpoints:

datadog-mcp-server --apiKey=your_api_key --appKey=your_app_key --site=datadoghq.com --logsSite=logs.datadoghq.com --metricsSite=metrics.datadoghq.com

Regional Endpoints

Different Datadog regions have different endpoints:

  • US (Default): datadoghq.com
  • EU: datadoghq.eu
  • US3 (GovCloud): ddog-gov.com
  • US5: us5.datadoghq.com
  • AP1: ap1.datadoghq.com

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)"
      ]
    }
  }
}

For advanced configurations with separate endpoints:

{
  "mcpServers": {
    "datadog": {
      "command": "npx",
      "args": [
        "datadog-mcp-server",
        "--apiKey",
        "<YOUR_API_KEY>",
        "--appKey",
        "<YOUR_APP_KEY>",
        "--site",
        "<YOUR_DD_SITE>",
        "--logsSite",
        "<YOUR_LOGS_SITE>",
        "--metricsSite",
        "<YOUR_METRICS_SITE>"
      ]
    }
  }
}

Config file locations:

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

Usage with MCP Inspector

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"
          }
        }
      ]
    }
  }
}

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
  3. Your account has access to the requested data
  4. You're using the correct regional endpoint

Debugging

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 API keys
  • Invalid key format: Ensure using full key strings
  • Site configuration errors: Verify correct Datadog domain
  • Endpoint mismatches: Check service-specific endpoints if using separate domains

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

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

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "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)"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "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)"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later