Quickstart in stdio (local) mode
You can add this MCP server to your AI Assistant, such as VSCode, Claude, Cursor, Kiro, Windsurf, ChatGPT, or GitHub Copilot.
To run this MCP server, you to have to configure four things:
- Dynatrace Managed API token
- Configuration file:
dt-config.yaml or dt-config.json file which is responsible for defining list of environments you intend to use
- MCP Server connection configuration file: local mcp configuration, which is dependent on tools you are using
- Set
DT_CONFIG_FILE to the path of your dt-config.yaml or dt-config.json file in the MCP server environment.
Dynatrace Managed API token
For information about creating API tokens in Managed deployments, refer to the Dynatrace Managed documentation.
Your API token must include the following scopes for full functionality:
- Access problem and event feed, metrics, and topology (
DataExport)
- Read entities (
entities.read)
- Read events (
events.read)
- Read logs (
logs.read)
- Read metrics (
metrics.read)
- Read problems (
problems.read)
- Read security problems (
securityProblems.read)
- Read SLO (
slo.read)
Configuration File
Configuration parameters
| Parameter | Required | Description | Example value |
|---|
| apiEndpointUrl | Yes | Base URL for Dynatrace Managed cluster API | https://dmz123.dynatrace-managed.com |
| environmentId | Yes | ID of the managed environment | 01234567-89ab-cdef-abcd-ef0123456789 |
| alias | Yes | Human-friendly name of the environment | MyEnvironment |
| apiToken | Only in stdio mode | API token of the cluster with required scopes created using the instruction above | dt0s01.ABCDEFGHIJK0123 |
| httpProxyUrl | No | URL of proxy server for requests. Do not use with the other proxy parameter | http://proxy.company.com:8080 |
| httpsProxyUrl | No | URL of proxy server for requests. Do not use with the other proxy parameter | https://proxy.company.com:8080 |
There are two ways to configure your Dynatrace Managed environments.
Method 1: Configuration File (Recommended for Local Development)
Example: dt-config.yaml
# Production environment
- apiEndpointUrl: https://my-api.company.com/
environmentId: abc-123
alias: production
# Token is injected from an environment variable at runtime
apiToken: ${DT_PROD_TOKEN}
# You can also use the token directly
# apiToken: dt0s01.ABCDEFGHIJK0123
# Staging environment
- apiEndpointUrl: https://staging-api.company.com/
environmentId: xyz-789
alias: staging
apiToken: ${DT_STAGING_TOKEN}
Example: dt-config.json
[
{
"apiEndpointUrl": "https://my-api.company.com/",
"environmentId": "abc-123",
"alias": "production",
"apiToken": "${DT_PROD_TOKEN}"
}
]
Method 2: Environment Variable (Docker/Kubernetes)
For Kubernetes deployments or if you prefer environment variables, you can set DT_ENVIRONMENT_CONFIGS with a JSON string in either your .env file or directly in MCP Server connection configuration file
DT_ENVIRONMENT_CONFIGS='[{"apiEndpointUrl":"https://api.example.com/","environmentId":"abc-123","alias":"production","apiToken":"dt0s01.ABCDEFGHIJK0123"}]'
MCP Server connection configuration file
To actually connect to the MCP server you have to configure your MCP connection in your AI Assistant
We recommend always setting it up for your current workspace instead of using it globally.
VS Code
{
"servers": {
"npx-dynatrace-managed-mcp": {
"command": "npx",
"cwd": "${workspaceFolder}",
"args": ["-y", "@dynatrace-oss/dynatrace-managed-mcp-server@latest"],
"envFile": "${workspaceFolder}/.env"
}
}
}
Alternatively, this can also be stored in user settings, and you can define env as follows:
{
"servers": {
"npx-dynatrace-managed-mcp": {
"command": "npx",
"args": ["-y", "@dynatrace-oss/dynatrace-managed-mcp-server@latest"],
"env": {
"DT_PROD_TOKEN": "dt0s01.ABCDEFGHIJK0123",
"DT_CONFIG_FILE": "dt-config.yaml"
}
}
}
}
Claude Desktop
{
"mcpServers": {
"dynatrace-managed-mcp": {
"command": "npx",
"args": ["-y", "@dynatrace-oss/dynatrace-managed-mcp-server@latest"],
"env": {
"DT_PROD_TOKEN": "dt0s01.ABCDEFGHIJK0123",
"DT_CONFIG_FILE": "dt-config.yaml"
}
}
}
}
Kiro
{
"mcpServers": {
"dynatrace-managed-mcp": {
"command": "npx",
"args": ["-y", "@dynatrace-oss/dynatrace-managed-mcp-server@latest"],
"env": {
"DT_PROD_TOKEN": "dt0s01.ABCDEFGHIJK0123",
"DT_CONFIG_FILE": "dt-config.yaml"
}
}
}
}
This configuration should be stored in <project-root>/.kiro/settings/mcp.json, or in user-level settings (~/.kiro/settings/mcp.json).
Google Gemini CLI
Using gemini CLI directly (recommended):
gemini extensions install https://github.com/dynatrace-oss/dynatrace-managed-mcp
export DT_ENVIRONMENT_CONFIGS="[{\"apiEndpointUrl\":\"https://my-api-endpoint.com/\",\"environmentId\":\"my-env-id-1\",\"alias\":\"alias-env\",\"apiToken\":\"my-api-token\"},{\"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
gemini mcp list
Or manually in your ~/.gemini/settings.json or .gemini/settings.json:
{
"mcpServers": {
"dynatrace-managed-mcp": {
"command": "npx",
"args": ["@dynatrace-oss/dynatrace-managed-mcp-server@latest"],
"env": {
"DT_ENVIRONMENT_CONFIGS": "[{\"apiEndpointUrl\":\"https://my-api-endpoint.com/\",\"environmentId\":\"my-env-id-1\",\"alias\":\"alias-env\",\"apiToken\":\"my-api-token\"},{\"apiEndpointUrl\":\"https://my-api2-endpoint.com/\",\"environmentId\":\"my-env-id-2\",\"alias\":\"alias-env-2\",\"apiToken\":\"my-api-token-2\"}]",
"DT_CONFIG_FILE": "dt-config.yaml"
},
"timeout": 30000,
"trust": false
}
}
}