ddmcproxy

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2026 License: CC0-1.0 Imports: 10 Imported by: 0

README

ddmcproxy

CI codecov AI Generated

A multi-org proxy for the Datadog MCP Server.

The Datadog MCP server does not support multiple organizations in a single connection. ddmcproxy sits in front of it, mirrors all of its tools, and adds an org argument to each tool. When a tool is called, the proxy picks the matching org's credentials and forwards the request to the Datadog MCP server.

Claude Code ──stdio──▶ ddmcproxy ──HTTP(token or DD_API_KEY/DD_APPLICATION_KEY)──▶ Datadog MCP
                          │
                          ├─ org=foo ─▶ foo's credentials
                          └─ org=bar ─▶ bar's credentials

Install

go install github.com/winebarrel/ddmcproxy/cmd/ddmcproxy@latest

Configuration

Create a YAML config file. Values are passed through os.ExpandEnv, so secrets can be referenced as ${ENV_VAR} instead of being written in plain text.

# ddmcproxy.yml

# Optional. Default: https://mcp.datadoghq.com/api/unstable/mcp-server/mcp
# endpoint: https://mcp.datadoghq.com/api/unstable/mcp-server/mcp

orgs:
  # Each org authenticates with EITHER a token (a PAT or SAT) OR the legacy
  # api_key + app_key pair -- not both.
  - name: foo
    token: ${FOO_DD_TOKEN}
  - name: bar
    api_key: ${BAR_DD_API_KEY}
    app_key: ${BAR_DD_APP_KEY}
    # Optional per-org endpoint override (e.g. for a different Datadog site).
    # endpoint: https://mcp.datadoghq.eu/api/unstable/mcp-server/mcp

Authentication per org is one of:

Usage

Usage: ddmcproxy --config=STRING [flags]

Flags:
  -h, --help             Show help.
  -c, --config=STRING    Config file path ($DDMCPROXY_CONFIG).
      --version
Claude Code

Register it as an MCP server:

{
  "mcpServers": {
    "datadog": {
      "command": "ddmcproxy",
      "args": ["--config", "/path/to/ddmcproxy.yml"]
    }
  }
}

Then call a tool with the target org, e.g.:

Using the foo org, search Datadog logs for errors in the last hour.

Every proxied tool gains a required org argument whose allowed values are the org names from your config.

How it works

  • On startup the proxy connects to the Datadog MCP server as the first configured org and lists the available tools. All orgs are assumed to expose the same set of tools.
  • Each upstream tool is re-registered with a required org string argument (enumerated over the configured org names).
  • On a tool call, the proxy strips the org argument, looks up that org's credentials, connects (lazily, then cached) to the Datadog MCP server -- with an Authorization: Bearer token, or the DD_API_KEY / DD_APPLICATION_KEY headers -- and forwards the call.

Documentation

Index

Constants

View Source
const DefaultEndpoint = "https://mcp.datadoghq.com/api/unstable/mcp-server/mcp"

DefaultEndpoint is the Datadog MCP server endpoint used when a config or an org does not override it. See https://docs.datadoghq.com/bits_ai/mcp_server/setup/

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Endpoint is the default Datadog MCP endpoint for every org.
	Endpoint string       `yaml:"endpoint,omitempty"`
	Orgs     []*OrgConfig `yaml:"orgs"`
}

Config is the ddmcproxy configuration file.

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig reads and validates the config file at path.

The file content is passed through os.ExpandEnv so that secrets can be referenced as ${DD_API_KEY} instead of being written in plain text.

func (*Config) Org

func (config *Config) Org(name string) *OrgConfig

Org returns the config for the named org, or nil if it is not configured.

func (*Config) OrgNames

func (config *Config) OrgNames() []string

OrgNames returns the configured org names in file order.

type Options

type Options struct {
	Config string `short:"c" required:"" env:"DDMCPROXY_CONFIG" help:"Config file path."`
}

type OrgConfig

type OrgConfig struct {
	Name     string `yaml:"name"`
	Token    string `yaml:"token,omitempty"`
	APIKey   string `yaml:"api_key,omitempty"`
	AppKey   string `yaml:"app_key,omitempty"`
	Endpoint string `yaml:"endpoint,omitempty"`
}

OrgConfig holds the credentials for a single Datadog organization.

Authentication is either a token -- a Personal (ddpat_) or Service (ddsat_) Access Token, passed as a bearer token -- or the legacy API key + Application key pair. Exactly one of the two must be configured.

func (*OrgConfig) UseToken

func (org *OrgConfig) UseToken() bool

UseToken reports whether the org authenticates with a bearer token (a PAT or SAT) rather than the legacy API key + Application key pair.

type Proxy

type Proxy struct {
	// contains filtered or unexported fields
}

Proxy is a multi-org MCP proxy in front of the Datadog MCP server.

It exposes the upstream Datadog tools over stdio, injecting a required "org" argument into each tool. On a tool call the org is used to pick the matching API/APP keys, and the call is forwarded to the Datadog MCP server.

func NewProxy

func NewProxy(config *Config, version string) *Proxy

NewProxy creates a Proxy from the given config.

func (*Proxy) Run

func (proxy *Proxy) Run(ctx context.Context) error

Run builds the proxy server and serves it over stdio until the client disconnects or ctx is cancelled.

Directories

Path Synopsis
cmd
ddmcproxy command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL