Dynatrace Managed

by dynatrace-oss

Not rated
GitHub

About

An MCP server for self-hosted Dynatrace Managed platform

Details

Author
dynatrace-oss
Categories
Cloud Service, Infrastructure

Method 1: Configuration File (Recommended for Local Development)

The easiest way to configure multiple environments is by using a configuration file (JSON or YAML). This method supports:

- ✅Clean, readable format- No quote escaping needed
- ✅Comments(YAML only) - Document your configuration
- ✅Environment variable interpolation- Keep tokens secure with${VAR_NAME}syntax
- ✅Version control friendly- Commit config files without tokens

# Production environment - dynatraceUrl: https://my-dashboard.company.com/ apiEndpointUrl: https://my-api.company.com/ environmentId: abc-123 alias: production # Token is injected from an environment variable at runtime apiToken: ${DT_PROD_TOKEN} httpProxyUrl: http://proxy.company.com:8080 # Staging environment - dynatraceUrl: https://staging-dashboard.company.com/ apiEndpointUrl: https://staging-api.company.com/ environmentId: xyz-789 alias: staging apiToken: ${DT_STAGING_TOKEN}
](#configuration)[ { "dynatraceUrl": "https://my-dashboard.company.com/", "apiEndpointUrl": "https://my-api.company.com/", "environmentId": "abc-123", "alias": "production", "apiToken": "${DT_PROD_TOKEN}", "httpProxyUrl": "http://proxy.company.com:8080" } ]

Usage in MCP configuration (e.g.,claude_desktop_config.json):

Option A: Using npx (Recommended - no installation required)

{ "mcpServers": { "dynatrace-managed": { "command": "npx", "args": ["-y", "@dynatrace-oss/dynatrace-managed-mcp-server@latest"], "env": { "DT_CONFIG_FILE": "./dt-config.yaml", "DT_PROD_TOKEN": "dt0c01.ABC123...", "DT_STAGING_TOKEN": "dt0c01.XYZ789...", "LOG_LEVEL": "info" } } } }

Option B: Local development (requires cloning the repository)

{ "mcpServers": { "dynatrace-managed": { "command": "node", "args": ["./dist/index.js"], "env": { "DT_CONFIG_FILE": "./dt-config.yaml", "DT_PROD_TOKEN": "dt0c01.ABC123...", "DT_STAGING_TOKEN": "dt0c01.XYZ789...", "LOG_LEVEL": "info" } } } }

Note:Option B requires cloning this repository and runningnpm install && npm run buildfirst.

Security Best Practice:Use environment variable interpolation (${TOKEN_NAME}) in your config files so you can commit them to version control without exposing secrets!

Seeexamples/dt-config.yamlandexamples/dt-config.jsonfor complete examples.

Method 2: Environment Variable (Docker/Kubernetes)

For Kubernetes deployments or if you prefer environment variables, you can setDT_ENVIRONMENT_CONFIGSwith a JSON string:

DT_ENVIRONMENT_CONFIGS='[{"apiEndpointUrl":"https://api.example.com/","environmentId":"abc-123","alias":"production","apiToken":"dt0c01.ABC123"}]'

- ✅ Kubernetes ConfigMaps/Secrets
- ✅ Docker containers
- ✅ CI/CD pipelines
- ⚠️ Not ideal for local development (quote escaping is cumbersome)

While you can use a.envfile, multiline values don't work reliably.Use Method 1 (config file) insteadfor cleaner local development.

If multiple configuration methods are set, the MCP server uses this priority:
- DT_CONFIG_FILE- External file (highest priority)
- DT_ENVIRONMENT_CONFIGS- JSON string
- Error- If neither is set

You need to configure the connection to your Dynatrace Managed environment(s). Each environment requires:

[ { "dynatraceUrl": "https://my-dashboard-endpoint.com/", "apiEndpointUrl": "https://my-api-endpoint.com/", "environmentId": "my-env-id-1", "alias": "alias-env", "apiToken": "my-api-token", "httpProxyUrl": "", "httpsProxyUrl": "" } ]

- dynatraceUrl: base URL for Dynatrace Managed dashboard, to which the environment ID will be appended (e.g.https://dmz123.dynatrace-managed.com). If not specified, will default to use the same value asDT_API_ENDPOINT_URL.
- apiEndpointUrl: base URL for Dynatrace Managed API, to which the environment ID will be appended (e.g.https://abc123.dynatrace-managed.com:9999)
- environmentId: ID of the managed environment, used for constructing URL for API and dashboards (e.g., of the form01234567-89ab-cdef-abcd-ef0123456789)
- alias: a friendly/human-readable name for the environment
- apiToken: API token with required scopes (seeAuthentication)
- (optional)httpProxyUrl/httpsProxyUrl: URL of proxy server for requests (see
Environment Variables)

If you are using multiple environments, we strongly recommend that you set up rules (seeRules) to guide your LLM in better understanding each environment.

Changes to the environment configuration will need an MCP server restart/reload. Changes won't be picked up until a fresh reload.

Once configured, you can start usingexample promptslikeGet all details of the Dynatrace entity 'my-service'orWhat problems has Dynatrace identified? Give details of the first problem..

These queries use V2 REST APIs and incur no additional costs beyond your standard Managed license.

Minimum supported version: Dynatrace Managed 1.328.0

In HTTP mode the server holdsnoDynatrace API tokens. Each request must carry the caller's per-environment tokens in a singleX-Dynatrace-Tokensheader, formatted as analias=tokenmap separated by semicolons:

X-Dynatrace-Tokens: prod=dt0c01.AAA;staging=dt0c01.BBB

The server uses the caller's token for the environment named byenvironment_alias, so each user only accesses the data their token allows. A request that targets an environment with no supplied token is rejected with a message naming the missing alias.

Because tokens are sent in a header, run the HTTP serverbehind TLS(for example, terminate TLS at a reverse proxy in front of it). The server itself binds to127.0.0.1by default and does not terminate TLS.

Environment config in HTTP mode does not includeapiToken— onlyalias+ URLs, which are non-secret. Seeexamples/dt-config-http.yamland[examples/mcp-config-http.json.

The Configuration Methods described above (server-sideapiTokenvalues) apply tostdio / local mode. In HTTP mode, tokens come from theX-Dynatrace-Tokensheader instead.

The localDynatrace Managed MCP serverallows AI Assistants to interact with one or more self-hostedDynatrace Manageddeployments, bringing observability data directly into your AI-assisted workflow.

- Local mode:Runs on your machine for development and testing.
- Remote mode:Connects over HTTP/SSE for distributed or production-like setups.

[!TIP] This MCP server is specifically designed for Dynatrace Managed (self-hosted) deployments. For Dynatrace SaaS environments, please use theDynatrace MCP.

[!NOTE] This open source product is supported by the community. For feature requests, questions, or assistance, please useGitHub Issues.

You can add this MCP server to your AI Assistant, such as VSCode, Claude, Cursor, Kiro, Windsurf, ChatGPT, or Github Copilot. For more details, please refer to theconfiguration section below.

There arethree waysto configure your Dynatrace Managed environments. Choose the method that works best for your use case:

Method 1: Configuration File (Recommended for Local Development)

The easiest way to configure multiple environments is by using a configuration file (JSON or YAML). This method supports:

- ✅Clean, readable format- No quote escaping needed
- ✅Comments(YAML only) - Document your configuration
- ✅Environment variable interpolation- Keep tokens secure with${VAR_NAME}syntax
- ✅Version control friendly- Commit config files without tokens

# Production environment - dynatraceUrl: https://my-dashboard.company.com/ apiEndpointUrl: https://my-api.company.com/ environmentId: abc-123 alias: production # Token is injected from an environment variable at runtime apiToken: ${DT_PROD_TOKEN} httpProxyUrl: http://proxy.company.com:8080 # Staging environment - dynatraceUrl: https://staging-dashboard.company.com/ apiEndpointUrl: https://staging-api.company.com/ environmentId: xyz-789 alias: staging apiToken: ${DT_STAGING_TOKEN}
[ { "dynatraceUrl": "https://my-dashboard.company.com/", "apiEndpointUrl": "https://my-api.company.com/", "environmentId": "abc-123", "alias": "production", "apiToken": "${DT_PROD_TOKEN}", "httpProxyUrl": "http://proxy.company.com:8080" } ]

Usage in MCP configuration (e.g.,claude_desktop_config.json):

Option A: Using npx (Recommended - no installation required)

{ "mcpServers": { "dynatrace-managed": { "command": "npx", "args": ["-y", "@dynatrace-oss/dynatrace-managed-mcp-server@latest"], "env": { "DT_CONFIG_FILE": "./dt-config.yaml", "DT_PROD_TOKEN": "dt0c01.ABC123...", "DT_STAGING_TOKEN": "dt0c01.XYZ789...", "LOG_LEVEL": "info" } } } }

Option B: Local development (requires cloning the repository)

{ "mcpServers": { "dynatrace-managed": { "command": "node", "args": ["./dist/index.js"], "env": { "DT_CONFIG_FILE": "./dt-config.yaml", "DT_PROD_TOKEN": "dt0c01.ABC123...", "DT_STAGING_TOKEN": "dt0c01.XYZ789...", "LOG_LEVEL": "info" } } } }

Note:Option B requires cloning this repository and runningnpm install && npm run buildfirst.

Security Best Practice:Use environment variable interpolation (${TOKEN_NAME}) in your config files so you can commit them to version control without exposing secrets!

Seeexamples/dt-config.yamlandexamples/dt-config.jsonfor complete examples.

Method 2: Environment Variable (Docker/Kubernetes)

For Kubernetes deployments or if you prefer environment variables, you can setDT_ENVIRONMENT_CONFIGSwith a JSON string:

DT_ENVIRONMENT_CONFIGS='[{"apiEndpointUrl":"https://api.example.com/","environmentId":"abc-123","alias":"production","apiToken":"dt0c01.ABC123"}]'

- ✅ Kubernetes ConfigMaps/Secrets
- ✅ Docker containers
- ✅ CI/CD pipelines
- ⚠️ Not ideal for local development (quote escaping is cumbersome)

While you can use a.envfile, multiline values don't work reliably.Use Method 1 (config file) insteadfor cleaner local development.

If multiple configuration methods are set, the MCP server uses this priority:
- DT_CONFIG_FILE- External file (highest priority)
- DT_ENVIRONMENT_CONFIGS- JSON string
- Error- If neither is set

You need to configure the connection to your Dynatrace Managed environment(s). Each environment requires:

[ { "dynatraceUrl": "https://my-dashboard-endpoint.com/", "apiEndpointUrl": "https://my-api-endpoint.com/", "environmentId": "my-env-id-1", "alias": "alias-env", "apiToken": "my-api-token", "httpProxyUrl": "", "httpsProxyUrl": "" } ]

- dynatraceUrl: base URL for Dynatrace Managed dashboard, to which the environment ID will be appended (e.g.https://dmz123.dynatrace-managed.com). If not specified, will default to use the same value asDT_API_ENDPOINT_URL.
- apiEndpointUrl: base URL for Dynatrace Managed API, to which the environment ID will be appended (e.g.https://abc123.dynatrace-managed.com:9999)
- environmentId: ID of the managed environment, used for constructing URL for API and dashboards (e.g., of the form01234567-89ab-cdef-abcd-ef0123456789)
- alias: a friendly/human-readable name for the environment
- apiToken: API token with required scopes (seeAuthentication)
- (optional)httpProxyUrl/httpsProxyUrl: URL of proxy server for requests (see
Environment Variables)

If you are using multiple environments, we strongly recommend that you set up rules (seeRules) to guide your LLM in better understanding each environment.

Changes to the environment configuration will need an MCP server restart/reload. Changes won't be picked up until a fresh reload.

Once configured, you can start usingexample promptslikeGet all details of the Dynatrace entity 'my-service'orWhat problems has Dynatrace identified? Give details of the first problem..

These queries use V2 REST APIs and incur no additional costs beyond your standard Managed license.

Minimum supported version: Dynatrace Managed 1.328.0

In HTTP mode the server holdsnoDynatrace API tokens. Each request must carry the caller's per-environment tokens in a singleX-Dynatrace-Tokensheader, formatted as analias=tokenmap separated by semicolons:

X-Dynatrace-Tokens: prod=dt0c01.AAA;staging=dt0c01.BBB

The server uses the caller's token for the environment named byenvironment_alias, so each user only accesses the data their token allows. A request that targets an environment with no supplied token is rejected with a message naming the missing alias.

Because tokens are sent in a header, run the HTTP serverbehind TLS(for example, terminate TLS at a reverse proxy in front of it). The server itself binds to127.0.0.1by default and does not terminate TLS.

Environment config in HTTP mode does not includeapiToken— onlyalias+ URLs, which are non-secret. Seeexamples/dt-config-http.yamlandexamples/mcp-config-http.json.

The Configuration Methods described above (server-sideapiTokenvalues) apply tostdio / local mode. In HTTP mode, tokens come from theX-Dynatrace-Tokensheader instead.

Large numbers of environments and header size limits

TheX-Dynatrace-Tokensheader grows with the number of environments. Each entry is roughlyalias=dt0c01.<token>;(~110 characters). Node.js enforces a default HTTP header size limit of16 KB, which accommodates approximately 140–150 environments before requests are rejected.

If you need more environments, increase the limit at server startup with the--max-http-header-sizeflag:

node --max-http-header-size=65536 ./dist/index.js --http

If you are running areverse proxy(such as nginx) in front of the MCP server, the proxy also enforces its own limit. nginx defaults to 8 KB (large_client_header_buffers), which fits roughly 70 environments. Raise it in your nginx configuration:

There are two ways that Dynatrace Managed, and thus the MCP, may be used:
- Your Dynatrace Managed environment(s) is/are the primary Observability system, containing all live data; or
- There has been a migration from a Dynatrace Managed environment to a Dynatrace Saas environment; however, historical observability data has not been migrated and can still be accessed via a Dynatrace Managed environment. The Dynatrace Managed MCP is used to access historical data, and a separate Dynatrace SaaS MCP is used to access live and more recent data.

Specific use cases for the Dynatrace Managed MCP include:

- Real-time observability- Fetch production-level data for early detection and proactive monitoring
- Contextual debugging- Fix issues with full context from monitored exceptions, logs, and anomalies
- Security insights- Get detailed vulnerability analysis and security problem tracking. This can include multicloud compliance assessment with evidence-based investigation.
- Natural language queries- Queries are mapped to MCP tool usage, and thus API queries, with guidance for the next step
- Multiphase incident investigation- Systematic impact assessment and troubleshooting
- Multienvironment support- Query multiple Dynatrace Managed environments from the same MCP server

- Problems- List and getproblemdetails from your services (for example Kubernetes)
- Security- List and get security problems /
vulnerabilitydetails
- Entities- Get more information about a monitored entity, including relationship mappings
- SLO- List and get Service Level Objective details, including evaluation and error budgets
- Event Tracking- List and get system events
- Log Investigation- Search and filter logs with advanced content and time-based queries
- Metrics Analysis- Query and analyze performance metrics using V2 Metrics API

Important:This MCP server makes API calls to the Dynatrace Managed environment(s). It is designed for efficient usage (e.g., limiting the response sizes), but care should be taken not to overload the Dynatrace Managed environment(s) with large queries.
- Use specific time ranges (e.g., 1-2 hours) rather than large historical queries.
- Use specific filters to limit the scope of queries as much as possible, for example, entity selectors that specify the entity ID.
- If using multiple environments, be specific about which one to query, where applicable. If querying multiple at once, be mindful of how much data will be returned to the LLM, e.g. top 10 problems from 2 envs = 20 problems, versus top 10 problems from 10 envs = 100 problems.

You can add this MCP server (using STDIO or HTTP) to your AI Assistant.

We recommend always setting it up for your current workspace instead of using it globally.

{ "servers": { "npx-dynatrace-managed-mcp": { "command": "npx", "cwd": "${workspaceFolder}", "args": ["-y", "@dynatrace-oss/dynatrace-managed-mcp-server@latest"], "envFile": "${workspaceFolder}/.env" } } }

Please note: In this config,the${workspaceFolder}variableis used. This only works if the config is stored in the current workspace, e.g.,<your-repo>/.vscode/mcp.json. Alternatively, this can also be stored in user settings, and you can defineenvas follows:

{ "servers": { "npx-dynatrace-managed-mcp": { "command": "npx", "args": ["-y", "@dynatrace-oss/dynatrace-managed-mcp-server@latest"], "env": { "DT_ENVIRONMENT_CONFIGS": "[{\"dynatraceUrl\":\"https://my-dashboard-endpoint.com/\",\"apiEndpointUrl\":\"https://my-api-endpoint.com/\",\"environmentId\":\"my-env-id-1\",\"alias\":\"alias-env\",\"apiToken\":\"my-api-token\"},{\"dynatraceUrl\":\"https://my-dashboard2-endpoint.com/\",\"apiEndpointUrl\":\"https://my-api2-endpoint.com/\",\"environmentId\":\"my-env-id-2\",\"alias\":\"alias-env-2\",\"apiToken\":\"my-api-token-2\"}]" } } } }
{ "mcpServers": { "dynatrace-managed-mcp": { "command": "npx", "args": ["-y", "@dynatrace-oss/dynatrace-managed-mcp-server@latest"], "env": { "DT_ENVIRONMENT_CONFIGS": "[{\"dynatraceUrl\":\"https://my-dashboard-endpoint.com/\",\"apiEndpointUrl\":\"https://my-api-endpoint.com/\",\"environmentId\":\"my-env-id-1\",\"alias\":\"alias-env\",\"apiToken\":\"my-api-token\"},{\"dynatraceUrl\":\"https://my-dashboard2-endpoint.com/\",\"apiEndpointUrl\":\"https://my-api2-endpoint.com/\",\"environmentId\":\"my-env-id-2\",\"alias\":\"alias-env-2\",\"apiToken\":\"my-api-token-2\"}]" } } } }

Amazon Kirois an agentic IDE, andKiro CLIprovides an interactive chat experience directly in your terminal.

{ "mcpServers": { "dynatrace-managed-mcp": { "command": "npx", "args": ["-y", "@dynatrace-oss/dynatrace-managed-mcp-server@latest"], "env": { "DT_ENVIRONMENT_CONFIGS": "[{\"dynatraceUrl\":\"https://my-dashboard-endpoint.com/\",\"apiEndpointUrl\":\"https://my-api-endpoint.com/\",\"environmentId\":\"my-env-id-1\",\"alias\":\"alias-env\",\"apiToken\":\"my-api-token\"},{\"dynatraceUrl\":\"https://my-dashboard2-endpoint.com/\",\"apiEndpointUrl\":\"https://my-api2-endpoint.com/\",\"environmentId\":\"my-env-id-2\",\"alias\":\"alias-env-2\",\"apiToken\":\"my-api-token-2\"}]" } } } }

This configuration should be stored in<project-root>/.kiro/settings/mcp.json, or in user-level settings (~/.kiro/settings/mcp.json).

TheGoogle Gemini CLIis Google's official command-line AI assistant that supports integration with MCP servers. You can add the Dynatrace MCP server using either the built-in management commands or manual configuration.

UsinggeminiCLI directly (recommended):

gemini extensions install https://github.com/dynatrace-oss/dynatrace-managed-mcp export DT_ENVIRONMENT_CONFIGS="[{\"dynatraceUrl\":\"https://my-dashboard-endpoint.com/\",\"apiEndpointUrl\":\"https://my-api-endpoint.com/\",\"environmentId\":\"my-env-id-1\",\"alias\":\"alias-env\",\"apiToken\":\"my-api-token\"},{\"dynatraceUrl\":\"https://my-dashboard2-endpoint.com/\",\"apiEndpointUrl\":\"https://my-api2-endpoint.com/\",\"environmentId\":\"my-env-id-2\",\"alias\":\"alias-env-2\",\"apiToken\":\"my-api-token-2\"}]"

and verify that the server is running via

Or manually in your~/.gemini/settings.jsonor.gemini/settings.json:

{ "mcpServers": { "dynatrace-managed-mcp": { "command": "npx", "args": ["@dynatrace-oss/dynatrace-managed-mcp-server@latest"], "env": { "DT_ENVIRONMENT_CONFIGS": "[{\"dynatraceUrl\":\"https://my-dashboard-endpoint.com/\",\"apiEndpointUrl\":\"https://my-api-endpoint.com/\",\"environmentId\":\"my-env-id-1\",\"alias\":\"alias-env\",\"apiToken\":\"my-api-token\"},{\"dynatraceUrl\":\"https://my-dashboard2-endpoint.com/\",\"apiEndpointUrl\":\"https://my-api2-endpoint.com/\",\"environmentId\":\"my-env-id-2\",\"alias\":\"alias-env-2\",\"apiToken\":\"my-api-token-2\"}]" }, "timeout": 30000, "trust": false } } }

The default mode for this local MCP uses stdio for transport.

For scenarios where you need to run the MCP server as an HTTP service instead, you can use the HTTP server mode (e.g., for stateful sessions, load balancing, or integration with web clients):

# Get help and see all available options npx -y @dynatrace-oss/dynatrace-managed-mcp-server@latest --help # Run with HTTP server on default port 3000 npx -y @dynatrace-oss/dynatrace-managed-mcp-server@latest --http # Run with custom port npx -y @dynatrace-oss/dynatrace-managed-mcp-server@latest --http --port 3001 # Run with custom host/IP npx -y @dynatrace-oss/dynatrace-mcp-server@latest --http --host 127.0.0.1 # recommended for local computers npx -y @dynatrace-oss/dynatrace-mcp-server@latest --http --host 0.0.0.0 # recommended for container npx -y @dynatrace-oss/dynatrace-mcp-server@latest --http --host 192.168.0.1 # recommended when sharing connection over a local network # Check version npx -y @dynatrace-oss/dynatrace-managed-mcp-server@latest --version

Configuration for MCP clients that support HTTP transport:

{ "mcpServers": { "dynatrace-managed-mcp": { "url": "http://localhost:3000", "transport": "http" } } }

For efficient result retrieval from Dynatrace, please consider creating a rule file (e.g.,.github/copilot-instructions.md,.amazonq/rules/), instructing coding agents on how to get more details for your component/app/service.

Here is an example for someone responsible for theeasytradesystem, who wants to focus on entities and problems related to easytrade.

Please adapt the names and filters to fit your use-cases, components, tagging strategy, deployment environment, etc.

# Dynatrace We use Dynatrace Managed as our Observability solution. This document provides instructions for retrieving data for the EasyTrade system from Dynatrace using the Dynatrace Managed MCP. ## Best Practices 1. Always use specific time ranges, keeping these narrow (e.g. now-1h, now-24h), to avoid large data queries. 2. For entity selectors, consider using criteria for tags for more precise filtering (if the tagging strategy and naming are understood). ## Entity Selectors for easytrade Consider using these criteria in the entitySelector to filter data for our easytrade application: Services: - type(SERVICE),entityName.contains("easytrade") - type(SERVICE),tag("app:easytrade") Process Groups & Containers: - type(PROCESS_GROUP),entityName.contains("easytrade") - type(CONTAINER_GROUP_INSTANCE),entityName.contains("easytrade") Hosts: - type(HOST),tag("environment:production"),tag("app:easytrade") AWS Lambda Functions: - type(AWS_LAMBDA_FUNCTION),entityName.contains("easytrade") - type(AWS_LAMBDA_FUNCTION),tag("AWS_REGION:us-west-2"),tag("app:easytrade")`

-

DT_CONFIG_FILE(optional): Path to configuration file (JSON or YAML).Recommended for local development.

- Supports relative paths (e.g.,./dt-config.yaml)
- Supports absolute paths (e.g.,
/etc/dynatrace/config.yaml)
- Supports
~expansion (e.g.,~/dt-config.yaml)
- Supports environment variable interpolation in file content (
${VAR_NAME})
- Example:
DT_CONFIG_FILE=./dt-config.yaml

DT_ENVIRONMENT_CONFIGS`(optional): JSON string with environment configurations.Useful for Kubernetes/Docker.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.