datadog

datadog

provide access to monitor and cluster logs from datadog

didlawowo

Monitoring
Visit Server

README

Datadog Model Context Protocol (MCP) 🔍

smithery badge

A Python-based tool to interact with Datadog API and fetch monitoring data from your infrastructure. This MCP provides easy access to monitor states and Kubernetes logs through a simple interface.

Datadog Features 🌟

  • Monitor State Tracking: Fetch and analyze specific monitor states
  • Kubernetes Log Analysis: Extract and format error logs from Kubernetes clusters

Prerequisites 📋

  • Python 3.11+
  • Datadog API and Application keys (with correct permissions)
  • Access to Datadog site

Installation 🔧

Installing via Smithery

To install Datadog for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @didlawowo/mcp-collection --client claude

Required packages:

datadog-api-client
fastmcp
loguru
icecream
python-dotenv
uv

Environment Setup 🔑

Create a .env file with your Datadog credentials:

DD_API_KEY=your_api_key
DD_APP_KEY=your_app_key

Setup Claude Desktop Setup for MCP 🖥️

  1. Install Claude Desktop
# Assuming you're on macOS
brew install claude-desktop

# Or download from official website
https://claude.ai/desktop
  1. Set up Datadog MCP config:
# on mac is 
~/Library/Application\ Support/Claude/claude_desktop_config.json


# Add this to your claude config json
```json
    "Datadog-MCP-Server": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "datadog-api-client",
        "--with",
        "fastmcp",
        "--with",
        "icecream",
        "--with",
        "loguru",
        "--with",
        "python-dotenv",
        "fastmcp",
        "run",
        "/your-path/mcp-collection/datadog/main.py"
      ],
      "env": {
        "DD_API_KEY": "xxxx",
        "DD_APP_KEY": "xxx"
      }
    },

Usage 💻

get logs

get monitor

Architecture 🏗

  • FastMCP Base: Utilizes FastMCP framework for tool management
  • Modular Design: Separate functions for monitors and logs
  • Type Safety: Full typing support with Python type hints
  • API Abstraction: Wrapped Datadog API calls with error handling

I'll add a section about MCP and Claude Desktop setup:

Model Context Protocol (MCP) Introduction 🤖

What is MCP?

Model Context Protocol (MCP) is a framework allowing AI models to interact with external tools and APIs in a standardized way. It enables models like Claude to:

  • Access external data
  • Execute commands
  • Interact with APIs
  • Maintain context across conversations

some examples of MCP servers

https://github.com/punkpeye/awesome-mcp-servers?tab=readme-ov-file

Tutorial for setup MCP

https://medium.com/@pedro.aquino.se/how-to-use-mcp-tools-on-claude-desktop-app-and-automate-your-daily-tasks-1c38e22bc4b0

How it works - Available Functions 🛠️

the LLM use provided function to get the data and use it

1. Get Monitor States

get_monitor_states(
    name: str,           # Monitor name to search
    timeframe: int = 1   # Hours to look back
)

Example:


response = get_monitor_states(name="traefik")

# Sample Output
{
    "id": "12345678",
    "name": "traefik",
    "status": "OK",
    "query": "avg(last_5m):avg:traefik.response_time{*} > 1000",
    "message": "Response time is too high",
    "type": "metric alert",
    "created": "2024-01-14T10:00:00Z",
    "modified": "2024-01-14T15:30:00Z"
}

2. Get Kubernetes Logs

get_k8s_logs(
    cluster: str,            # Kubernetes cluster name
    timeframe: int = 5,      # Hours to look back
    namespace: str = None    # Optional namespace filter
)

Example:

logs = get_k8s_logs(
    cluster="prod-cluster",
    timeframe=3,
    namespace="default"
)

# Sample Output
{
    "timestamp": "2024-01-14T22:00:00Z",
    "host": "worker-1",
    "service": "nginx-ingress",
    "pod_name": "nginx-ingress-controller-abc123",
    "namespace": "default",
    "container_name": "controller",
    "message": "Connection refused",
    "status": "error"
}
# Install as MCP extension
cd datadog
task install-mcp

4. Verify Installation

In Claude chat desktop

check datadog connection in claude

setup claude

5. Use Datadog MCP Tools

Security Considerations 🔒

  • Store API keys in .env
  • MCP runs in isolated environment
  • Each tool has defined permissions
  • Rate limiting is implemented

Troubleshooting 🔧

Using MCP Inspector

# Launch MCP Inspector for debugging
task run-mcp-inspector

The MCP Inspector provides:

  • Real-time view of MCP server status
  • Function call logs
  • Error tracing
  • API response monitoring

Common issues and solutions

  1. API Authentication Errors

    Error: (403) Forbidden
    

    ➡️ Check your DD_API_KEY and DD_APP_KEY in .env

  2. MCP Connection Issues

    Error: Failed to connect to MCP server
    

    ➡️ Verify your claude_desktop_config.json path and content

  3. Monitor Not Found

    Error: No monitor found with name 'xxx'
    

    ➡️ Check monitor name spelling and case sensitivity

  4. logs can be found here

alt text

Contributing 🤝

Feel free to:

  1. Open issues for bugs
  2. Submit PRs for improvements
  3. Add new features

Notes 📝

  • API calls are made to Datadog EU site
  • Default timeframe is 1 hour for monitor states
  • Page size limits are set to handle most use cases

Recommended Servers

Google Search Console MCP Server

Google Search Console MCP Server

A server that provides access to Google Search Console data through the Model Context Protocol, allowing users to retrieve and analyze search analytics data with customizable dimensions and reporting periods.

Featured
TypeScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
mixpanel

mixpanel

Connect to your Mixpanel data. Query events, retention, and funnel data from Mixpanel analytics.

Featured
TypeScript
mcp-server-datadog

mcp-server-datadog

The MCP server provides an interface to the Datadog API, enabling seamless management of incidents, monitoring, logs, dashboards, metrics, traces, and hosts. Its extensible design allows easy integration of additional Datadog APIs for future expansions.

Featured
TypeScript
PostHog MCP Server

PostHog MCP Server

A Model Context Protocol server that enables Claude Desktop users to interact directly with PostHog, allowing them to view projects and create annotations through natural language commands.

Official
Local
Python
metoro-mcp-server

metoro-mcp-server

Query and interact with kubernetes environments monitored by Metoro. Look at APM, metrics, traces, profiling information with LLMs.

Official
Local
Go
Raygun MCP Server

Raygun MCP Server

MCP Server for Raygun's API V3 endpoints for interacting with your Crash Reporting and Real User Monitoring applications. This server provides comprehensive access to Raygun's API features through the Model Context Protocol.

Official
TypeScript
systemd-coredump MCP Server

systemd-coredump MCP Server

Enables MCP-capable applications to access, manage, and analyze system core dumps through integration with systemd-coredump functionality.

Local
JavaScript
SQLite MCP Server

SQLite MCP Server

Enables querying log data stored in SQLite databases through the Model Context Protocol, allowing natural language interactions with log analysis.

Local
Python
Airbyte Status Checker

Airbyte Status Checker

An MCP server for Claude Desktop that allows users to check the status of their Airbyte connections.

Local
Python