Table of contents

Thousands of companies trust Merge to accelerate AI from PoC to production.
Get a demo

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

Jon Gitlin
Senior Content Marketing Manager
at Merge

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 connects Claude Code to Datadog's observability data through a single CLI setup. You install the Merge CLI, authenticate once, and register the connection with one command. Agent Handler manages your Datadog credentials centrally so you don't store API keys locally or embed them into your codebase.

Here's the command that registers the connection:

merge setup claude-code

Prerequisites

Before getting started, you'll need the following:

  • A Merge Agent Handler account
  • Claude Code installed (run claude --version to confirm)
  • pipx installed (run pipx --version to confirm, or install via pip install pipx)
  • A Datadog account with access to the environments you want to monitor

If you want to connect Merge Agent Handler's Datadog MCP with internal or customer-facing agentic products, you can follow the steps in our docs.

1. Install the Merge CLI

Install with pipx: pipx install merge-api

How to add pipx install merge-api in Claude Code

Confirm the install completed: merge --version

2. Configure the CLI and log in

Log in to connect the CLI to your Merge Agent Handler account: merge login

The CLI is now authenticated and ready to make authorized requests on your behalf.

3. Add Agent Handler to Claude Code

Register the Agent Handler MCP server with Claude Code:

merge setup claude-code

Or manually:

claude mcp add 
--transport http agent-handler https://ah-api.merge.dev/mcp

Verify the connection registered. Open Claude Code and run: /mcp

agent-handler should appear under Local MCPs with a connected status.

Verifying the connection registered

4. Authenticate Datadog

Open Claude Code and test the connection with a prompt like: "Show me all monitors currently in an alert state and summarize the top metric spike from the past hour."

A Magic Link will appear on first use to complete connector authentication.

Authenticating the Datadog connector in Agent Handler

You should then see an output that looks like the following:

how an output can look in Claude Code using the Datadog MCP

{{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.

Jon Gitlin
Senior Content Marketing Manager
@Merge

Jon Gitlin is the Managing Editor of Merge's blog. He has several years of experience in the integration and automation space; before Merge, he worked at Workato, an integration platform as a service (iPaaS) solution, where he also managed the company's blog. In his free time he loves to watch soccer matches, go on long runs in parks, and explore local restaurants.

Read more

Agent Handler’s Quartr connector is live! Here's how your AI can securely use it 

Company

Employee agents: overview, use cases, and implementation steps

AI

How to connect a Jira MCP with Codex (4 steps)

AI

Subscribe to the Merge Blog

Get stories from Merge straight to your inbox

Subscribe

Connect your agents to thousands of tools in minutes

Use Merge Agent Handler’s 150+ connectors (including Datadog) to power reliable, secure, and powerful agents.

Get started for free
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text