Datadog Model Context Protocol Server

1.0.9 · active · verified Sun Apr 19

The `datadog-mcp-server` package provides a Model Context Protocol (MCP) server designed to interface with the Datadog API. Currently at version 1.0.9, this server acts as a comprehensive gateway for accessing various Datadog resources including monitors, dashboards, metrics, events, logs, and incidents. It offers direct integration with both Datadog's v1 and v2 APIs, featuring robust error handling and support for service-specific endpoints across different Datadog regional sites. The server is primarily distributed as a command-line interface (CLI) tool, configured via environment variables or CLI arguments, and is intended to run as a background service or be invoked by other MCP-compatible tools like Claude Desktop or MCP Inspector. Its main differentiator is providing a standardized MCP interface over the extensive Datadog API.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to programmatically launch the `datadog-mcp-server` CLI using `npx` with required Datadog API credentials, showing proper setup and process management.

import { spawn } from 'child_process';
import path from 'path';

// This demonstrates how to programmatically start the datadog-mcp-server CLI.
// In a typical setup, you would run this server globally or via npx.

const apiKey = process.env.DD_API_KEY ?? 'your_datadog_api_key';
const appKey = process.env.DD_APP_KEY ?? 'your_datadog_app_key';
const site = process.env.DD_SITE ?? 'datadoghq.com';

if (apiKey === 'your_datadog_api_key' || appKey === 'your_datadog_app_key') {
    console.warn("WARNING: Using placeholder Datadog API/App keys. Please set DD_API_KEY and DD_APP_KEY environment variables for actual use.");
}

const serverProcess = spawn('npx', [
  'datadog-mcp-server',
  '--apiKey', apiKey,
  '--appKey', appKey,
  '--site', site
], {
  stdio: 'inherit', // Pipe child process stdout/stderr to parent
  env: process.env, // Inherit environment variables
  cwd: path.resolve(__dirname), // Ensure context is correct
});

console.log(`Datadog MCP Server started with site: ${site}.`);
console.log('Use Ctrl+C to stop the server.');

serverProcess.on('error', (err) => {
  console.error('Failed to start Datadog MCP Server:', err);
});

serverProcess.on('exit', (code) => {
  console.log(`Datadog MCP Server exited with code ${code}.`);
});

// Example of how you might stop it programmatically after some time (optional)
// setTimeout(() => {
//   console.log('Stopping Datadog MCP Server...');
//   serverProcess.kill('SIGTERM');
// }, 60000);

view raw JSON →