A Model Context Protocol (MCP) server for Datadog integration, enabling AI assistants to interact with Datadog Logs, Monitors, Metrics, Incidents, and Dashboards.
Get up and running in 3 steps:
git clone https://github.com/viamus/mcp-datadog.git
cd mcp-datadogCopy and edit the environment file with your Datadog credentials:
cp .env.example .envEdit .env with your Datadog API keys:
DATADOG_API_KEY=your-api-key-here
DATADOG_APPLICATION_KEY=your-application-key-here
DATADOG_SITE=datadoghq.comNeed API Keys? See Creating Datadog API Keys below.
Option A - Docker (recommended):
docker compose up -d
# Server runs at http://localhost:8081Option B - .NET CLI:
dotnet run --project src/Viamus.DataDog.Mcp.Server
# Server runs at http://localhost:5100# Docker
curl http://localhost:8081/health
# .NET CLI
curl http://localhost:5100/healthYou should see: Healthy
This project implements an MCP server that exposes tools for querying and managing Logs, Monitors, Metrics, Incidents, and Dashboards in Datadog. It can be used with any compatible MCP client, such as Claude Desktop, Claude Code, or other assistants that support the protocol.
| Tool | Description |
|---|---|
search_logs |
Search logs using Datadog query syntax with time range and pagination |
| Tool | Description |
|---|---|
list_monitors |
Lists all monitors with optional filters (name, tags, state) |
get_monitor |
Gets details of a specific monitor by ID including thresholds and state |
| Tool | Description |
|---|---|
query_metrics |
Query time-series metric data using Datadog query syntax |
list_metrics |
Lists available metric names, optionally filtered by host |
get_metric_metadata |
Gets metadata for a specific metric (type, description, unit) |
| Tool | Description |
|---|---|
list_incidents |
Lists incidents with pagination |
get_incident |
Gets detailed information about a specific incident |
| Tool | Description |
|---|---|
list_dashboards |
Lists all dashboards with basic information |
get_dashboard |
Gets detailed dashboard configuration including widgets |
| Requirement | Version | Notes |
|---|---|---|
| .NET SDK | 10.0+ | Required for local development |
| Docker | Latest | Recommended for running |
| Datadog Account | - | With API and Application Keys |
- Go to your Datadog organization settings:
https://app.datadoghq.com/organization-settings/api-keys - Click + New Key to create an API Key
- Go to Application Keys:
https://app.datadoghq.com/organization-settings/application-keys - Click + New Key to create an Application Key
Required Scopes:
| Scope | Permission | Required for |
|---|---|---|
| Logs | Read | Log search operations |
| Monitors | Read | Monitor listing and details |
| Metrics | Read | Metric queries and metadata |
| Incidents | Read | Incident listing and details |
| Dashboards | Read | Dashboard listing and details |
- Copy both keys immediately (you won't see them again!)
Datadog Sites:
| Region | Site URL |
|---|---|
| US1 (default) | datadoghq.com |
| US3 | us3.datadoghq.com |
| US5 | us5.datadoghq.com |
| EU | datadoghq.eu |
| AP1 | ap1.datadoghq.com |
Best for: Production use, quick setup without .NET installed
docker compose up -dServer URL: http://localhost:8081
Useful commands:
docker compose logs -f # View logs
docker compose down # Stop the server
docker compose up -d --build # Rebuild and startBest for: Development, debugging
# Set environment variables
export Datadog__ApiKey="your-api-key"
export Datadog__ApplicationKey="your-application-key"
# Run the server
dotnet run --project src/Viamus.DataDog.Mcp.ServerServer URL: http://localhost:5100
Best for: Deployment without .NET runtime
# Windows
dotnet publish src/Viamus.DataDog.Mcp.Server -c Release -r win-x64 -o ./publish/win-x64
# Linux
dotnet publish src/Viamus.DataDog.Mcp.Server -c Release -r linux-x64 -o ./publish/linux-x64
# macOS (Intel)
dotnet publish src/Viamus.DataDog.Mcp.Server -c Release -r osx-x64 -o ./publish/osx-x64
# macOS (Apple Silicon)
dotnet publish src/Viamus.DataDog.Mcp.Server -c Release -r osx-arm64 -o ./publish/osx-arm64Then run the executable directly:
# Windows
./publish/win-x64/Viamus.DataDog.Mcp.Server.exe
# Linux/macOS
./publish/linux-x64/Viamus.DataDog.Mcp.ServerOption A - Using CLI (recommended):
claude mcp add datadog --transport http http://localhost:8081Option B - Manual configuration:
Edit claude_desktop_config.json:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"datadog": {
"url": "http://localhost:8081"
}
}
}Run from your project directory:
claude mcp add datadog --transport http http://localhost:8081Or add manually to .claude/settings.json:
{
"mcpServers": {
"datadog": {
"type": "http",
"url": "http://localhost:8081"
}
}
}Note: Use port
5100if running with .NET CLI, or8081if running with Docker.
After configuring the MCP client, you can ask questions like:
- "Search for error logs in the last hour"
- "Find logs with status:error from service:api"
- "Show me the latest logs containing 'timeout'"
- "Search for logs from host:web-server-01 in the last 15 minutes"
- "List all monitors that are currently alerting"
- "Show me monitors tagged with env:production"
- "Get details of monitor #12345"
- "What monitors are in a warning state?"
- "Find monitors with 'CPU' in the name"
- "Query the average CPU usage across all hosts in the last hour"
- "Show me memory usage for host:web-01"
- "List all available metrics"
- "Get metadata for the system.cpu.user metric"
- "Query request latency by service for the last 24 hours"
- "List all active incidents"
- "Show me incidents from the last week"
- "Get details of incident INC-123"
- "What's the current incident affecting production?"
- "List all available dashboards"
- "Show me the details of the 'Production Overview' dashboard"
- "What widgets are on dashboard abc-123?"
| Variable | Required | Default | Description |
|---|---|---|---|
Datadog__ApiKey |
Yes | - | Your Datadog API Key |
Datadog__ApplicationKey |
Yes | - | Your Datadog Application Key |
Datadog__Site |
No | datadoghq.com |
Datadog site/region |
{
"Datadog": {
"ApiKey": "your-api-key",
"ApplicationKey": "your-application-key",
"Site": "datadoghq.com"
}
}cd src/Viamus.DataDog.Mcp.Server
dotnet user-secrets set "Datadog:ApiKey" "your-api-key"
dotnet user-secrets set "Datadog:ApplicationKey" "your-application-key"Health check returns error or connection refused
-
Verify the server is running:
# Docker docker compose ps # Check if port is in use netstat -an | grep 8081 # or 5100
-
Check logs for errors:
# Docker docker compose logs # .NET CLI - errors appear in terminal
Authentication failed / 403 Forbidden
- Verify your API Key and Application Key are correct
- Check keys haven't been revoked in Datadog
- Ensure keys have required scopes/permissions
- Verify the Datadog site is correct for your region
No data returned from queries
- Verify the time range includes data
- Check your query syntax matches Datadog's query language
- Ensure your API key has access to the requested data
Docker: Container exits immediately
- Check if
.envfile exists and has the required credentials - View logs:
docker compose logs - Ensure port 8081 is not in use by another application
.NET CLI: dotnet run fails
- Verify .NET 10 SDK is installed:
dotnet --version - Restore packages:
dotnet restore - Check environment variables are set correctly
mcp-datadog/
├── src/
│ └── Viamus.DataDog.Mcp.Server/
│ ├── Configuration/ # App configuration classes
│ ├── Models/ # DTOs and data models
│ ├── Services/ # Datadog API client
│ ├── Tools/ # MCP tool implementations
│ ├── Program.cs # Entry point
│ ├── appsettings.json # App settings
│ └── Dockerfile # Container definition
├── tests/
│ └── Viamus.DataDog.Mcp.Server.Tests/
├── .github/ # GitHub templates
├── .env.example # Environment template
├── docker-compose.yml # Docker orchestration
└── LICENSE # MIT License
Search results containing log entries with metadata and pagination cursor.
Individual log entry with Id, Type, and Attributes (timestamp, status, service, host, message, tags).
Complete monitor details including Id, Name, Type, Query, Message, OverallState, Tags, Priority, Options, and State.
Monitor configuration including thresholds (Critical, Warning, Ok), notification settings, and timeouts.
Query results containing time-series data with status, query, time range, and series data.
Individual metric series with metric name, display name, unit, scope, tags, aggregation, and data points.
Metric metadata including type, description, unit, and statsd interval.
Incident details including Id, Title, Severity, State, CustomerImpacted, timestamps (Created, Detected, Resolved), and time metrics (TimeToDetect, TimeToResolve).
Dashboard overview with Id, Title, Description, LayoutType, URL, and author information.
Complete dashboard with all configuration including Widgets, TemplateVariables, and NotifyList.
Widget configuration including Definition (type, title, requests/queries) and Layout (position and size).
# Run all tests
dotnet test
# Run with coverage
dotnet test --collect:"XPlat Code Coverage"# Debug build
dotnet build
# Release build
dotnet build -c ReleaseThis project is licensed under the MIT License.