Datadog Model Context Protocol (MCP) 🔍
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 🖥️
- Install Claude Desktop
# Assuming you're on macOS
brew install claude-desktop
# Or download from official website
https://claude.ai/desktop
- 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 💻
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
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
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
-
API Authentication Errors
Error: (403) Forbidden
➡️ Check your DD_API_KEY and DD_APP_KEY in .env
-
MCP Connection Issues
Error: Failed to connect to MCP server
➡️ Verify your claude_desktop_config.json path and content
-
Monitor Not Found
Error: No monitor found with name 'xxx'
➡️ Check monitor name spelling and case sensitivity
-
logs can be found here
Contributing 🤝
Feel free to:
- Open issues for bugs
- Submit PRs for improvements
- 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
Metadata
Release files for iflow-mcp_didlawowo-datadog-mcp 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| iflow_mcp_didlawowo_datadog_mcp-1.0.1.tar.gz | 17.6 MB | Without provenance | Details for iflow_mcp_didlawowo_datadog_mcp-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| iflow_mcp_didlawowo_datadog_mcp-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for iflow_mcp_didlawowo_datadog_mcp-1.0.1-py3-none-any.whl |
Total release size: 17.6 MB
Release files / iflow_mcp_didlawowo_datadog_mcp-1.0.1.tar.gz
| Download URL | iflow_mcp_didlawowo_datadog_mcp-1.0.1.tar.gz |
|---|---|
| Size | 17.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8be44927c552ef99ad40a02d044d3eab2dcc5532ace6b787e3c4bc7d2be1121d
|
|
BLAKE2b-256 checksum How to use checksums |
ddafdbec7be596808307cc6be701930371fb6cdf4984bacec4fd756118d04d6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / iflow_mcp_didlawowo_datadog_mcp-1.0.1-py3-none-any.whl
| Download URL | iflow_mcp_didlawowo_datadog_mcp-1.0.1-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7adb9f00ea145b6e33a72f5f5ab6b16235bd19aa4a3da0f6c0bacbc800b4ab15
|
|
BLAKE2b-256 checksum How to use checksums |
b6a6d29b420d5ef5477d02ab6493baeb236447fc06c746af098601453dd21b67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for iflow-mcp_didlawowo-datadog-mcp 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.