How to connect to the Datadog MCP with Claude Code (5 steps)

When an alert fires, engineers follow a predictable loop: open Datadog, find the failing monitor, cross-reference the APM trace, then switch back to the terminal to dig into the code. Every context switch adds friction when speed matters most.
To help developers query Datadog monitors, metrics, and logs without leaving their coding session, we'll show you how to connect Datadog with Merge Agent Handler's Datadog MCP server.
How it works
Merge Agent Handler acts as a secure bridge between Claude Code and Datadog's API. When you configure a Tool Pack and Registered User, Merge generates a unique MCP URL that Claude Code accesses via HTTP, combined with an API key for authentication.
Here's how the command looks before you add your specific MCP URL and API key:
Claude Code sends requests to that MCP URL, and Merge handles authentication and API calls to Datadog on the backend. You don't manage Datadog API keys or application keys locally. Merge handles credential storage from here on.
Prerequisites
Before getting started, you'll need the following:
- A Merge Agent Handler account
- Claude Code installed
- A Datadog account with access to the environments you want to monitor
Related: A guide to connecting the Sentry MCP to Claude Code
1. Create a Tool Pack
Log into Merge Agent Handler and navigate to Tool Packs. Click Create Tool Pack and give it a name tied to the use case, like Infra monitor agent.

Under connectors, select Datadog. Choose which tools to enable.

For most debugging and incident workflows, enabling monitor retrieval, metric queries, and log search covers the common cases. Enable write tools if you want your agent to mute monitors or create events directly.
Save the Tool Pack. You'll return here in step 4 to copy your MCP URL.
2. Add a Registered User
Inside your Tool Pack, create a Registered User. This is the identity context under which your agent operates: the account it acts on behalf of when calling Datadog's API.

Give it a name that maps to your environment, like <code class="blog_inline-code">dev-local</code> or your own name. Once created, Merge generates a unique MCP URL scoped to this user.
3. Authenticate Datadog
From the Registered User detail page, click Add Connector and select Datadog.
Complete the authentication flow to grant your agent access to the Datadog organization you want to connect.

Once authenticated, Merge stores and manages the credentials. You won't need to re-authenticate unless you revoke access.
4. Gather your credentials
You need two things before configuring Claude Code:
1. MCP URL: found on the Tool Pack detail page under the Registered User you just created. It looks like the following:
2. API key: found in Settings > API Keys in your Merge Agent Handler dashboard. Create one if you don't have one yet.
Keep both handy for the next step.
5. Configure Claude Code with Datadog
Run the following command in your terminal, substituting your actual MCP URL and API key:
You can verify the connection registered with the command <code class="blog_inline-code">claude mcp list</code>
<code class="blog_inline-code">agent-handler</code> should appear in the output with a connected status.
To confirm the connector is accessible, open a Claude Code session and ask something like "Show me all monitors currently in an alert state and summarize the top metric spike from the past hour."
You should then see an output that looks like the following:

{{this-blog-only-cta}}
Datadog MCP FAQ
In case you have more questions on setting up and using the Datadog MCP in Claude Code, we've addressed several more commonly-asked questions below.
What can you do once the Datadog MCP is connected to Claude Code?
With Datadog connected, Claude Code can:
- List and inspect monitors: retrieve all monitors in a given state (alert, warn, ok) across your environments without opening a browser
- Query metrics: pull time-series data for any metric to understand trends or spikes while you're debugging in the terminal
- Search logs: surface recent log events by service, environment, or query string to trace errors back to their source
- Read APM traces: fetch trace data for slow or failing requests to identify latency bottlenecks directly alongside your code
- Check dashboard data: retrieve widget data from existing dashboards to get a snapshot of system health mid-incident
Why use Merge Agent Handler vs. a self-hosted Datadog MCP server?
You can build a self-hosted MCP server that calls Datadog's API directly. For a solo developer on a single team, that works.
It breaks down when your team grows. Self-hosting means distributing Datadog API keys and application keys across developers, rotating them manually when someone offboards, and maintaining the server yourself as Datadog's API changes. There's also no central audit trail: if an agent queries or modifies a monitor during an incident, you have no record of what it accessed.
Merge Agent Handler is a managed MCP layer. It centralizes credential management, scopes access at the Tool Pack and Registered User level so each developer or agent only sees the monitors and metrics you choose to expose, and logs every tool call. When you need to know what your agent queried at 2am during an incident, the audit trail is there.
For teams running agents against production observability data, Merge Agent Handler handles the credential overhead and adds the access controls that matter at scale.
Why connect Datadog to Claude Code?
Datadog is where your production health data lives. Claude Code is where you debug the code causing the problem. Right now those two environments don't talk: engineers copy metric values, paste log snippets, and screenshot dashboards to get context into their terminal.
With the Datadog MCP connected, Claude Code can query monitors, pull metrics, and search logs without leaving the session. That means you can describe an anomaly to Claude, have it retrieve the relevant Datadog data, and reason about the root cause alongside your codebase.
Engineers responding to a latency spike can ask Claude to pull the APM trace, correlate it with a recent deploy, and identify the slow function, all without a single browser tab.
.png)


.png)
