4. Dynatrace integration
Dynatrace MCP integration & Observability
This section explains how the Dynatrace MCP Server operates within your environment and how Dynatrace Observability is activated to monitor any application running in the enablement repositories.
MCP Server Integration#
The Dynatrace MCP (Model Context Protocol) Server enables AI Assistants to seamlessly interact with the Dynatrace observability platform, delivering real-time data directly into your enablement workflows—no manual configuration required. It is automatically embedded in all repositories within the Framework for VS Code, ensuring consistent access to monitoring and automation capabilities across development environments.
Prerequisites#
- The repository is opened in VS Code (Web and Desktop versions).
- You have defined the
DT_ENVIRONMENT
Single Sign-On (SSO) Support
The MCP Server supports Single Sign-On (SSO) in Dynatrace, enabling seamless authentication across environments. Any Dynatrace environment the user can connect to is automatically accessible via MCP—no additional authentication required.
Optional Control Variables
| Variable | Default Value | Description |
|---|---|---|
DT_PLATFORM_TOKEN |
Optional | Authentication token for Dynatrace MCP Server, supports Single Sign-On. For full list of supported scopes and use cases, refer to Dynatrace MCP documentation |
DT_GRAIL_QUERY_BUDGET_GB |
1000 GB | Budget limit for Grail queries in GB. Server tracks bytes scanned across all queries in current session. Warnings at 80% usage, alerts when exceeded. Resets on server restart |
DT_MCP_DISABLE_TELEMETRY |
false |
Controls telemetry collection, when true, disables telemetry. Only anonymous usage statistics and error information are collected. No sensitive Dynatrace environment data is tracked |
Environment Configuration#
Before you begin working with the MCP-enabled agent, you'll need to tell the agent to which Dynatrace environment it should connect to. The MCP Server supports SSO via VS Code Desktop and Web 🚀.
Playground as default environment
By default if no environment is set, the DT_ENVIRONMENT variable will point to the playground https://wkf10640.apps.dynatrace.com
Step 1:Connecting the MCP Server#
Steps to establish an MCP Server Connection
- On the IDE go to the left pane >
Extensions > MCP Servers Installed > dynatrace-mcp-server - Open dynatrace-mcp-server click on the configuration wheel > Start server
- The server should start, it'll read the environment file located in .devcontainer/runlocal/.env and will read the variable DT_ENVIRONMENT
- In the Server output (click on Show Output in the configuration wheel )
- A link for the SSO authentication should open automatically (if not then click on it).
- "✅ Successfully retrieved token from SSO!" is what you should see if you have access to the environment. Now let the agents communicate with the environment.
Steps to connect to another Dynatrace environment
- There is a comfort function that helps you set the DT_ENVIRONMENT variable called
selectEnvironment. - Type
selectEnvironmentin the terminal, select an environment or enter your own environment. - Restart the MCP Server by going to
Extensions > MCP Servers Installed > dynatrace-mcp-server > restart server
Step 2: Start Chatting with the Agent#
After successfully connecting to the MCP server, you can now interact with the AI agent!
The agent has access to:
- Code Analysis: Analyze the application code in this repository
- Dynatrace Insights: Query logs, metrics, traces, and events from the monitoring tenant
- Davis CoPilot: Get intelligent recommendations and problem analysis
- Observability Data: Access real-time monitoring data and application behavior
Ask the agent what can you do with the MCP Server
A very useful question is to ask the agent what can you do with Dynatrace's MCP Server. The MCP Server is pulling from latest meaning every week you'll get more features. In order to check the latest stand, just ask the agent and it'll give you a comprenhensive list of what you can do depending on the tools installed at that time.
Comfort Functions for Environment Management#
To simplify MCP server configuration, two convenience functions are available:
1. selectEnvironment#
selectEnvironment
- Available environments: Playground, demo.live, or tacocorp
- Actions: Exports the environment variable and writes it to the
.envfile - Usage: Use this when you want to change the default environment for all operations
Starting the MCP Server
#
On VS Code, on the left pane, click on the Extensions tab Shift + ⌘ + X. You should be able at the bottom to see a dynatrace-mcp-server installed under MCP servers.
- Click on the wheel icon (settings) and click on Start Server
- The output should show automatically (if not then click on
show output). You should be able to see a similar output:
Yay! the AI Agent (by default in VS Code is GPT) should be able now to fetch information from the Dynatrace environment.
Verify that the connection is active. Ask the agent, "what can I do with my dynatrace mcp server? give me a comprenhensive list"
Example Prompts#
Example Prompts 💬
| Use Case | Prompt |
|---|---|
| Find a monitored entity | Get all details of the entity 'my-service' |
| Find error logs | Show me error logs |
| Write a DQL query from natural language | Show me error rates for the payment service in the last hour |
| Explain a DQL query | What does this DQL do? fetch logs | filter dt.source_entity == 'SERVICE-123' | summarize count(), by:{severity} | sort count() desc |
| Chat with Davis CoPilot | How can I investigate slow database queries in Dynatrace? |
| Send email notifications | Send an email notification about the incident to the responsible team at team@example.com with CC to manager@example.com |
| Multi-phase incident response | Our checkout service is experiencing high error rates. Start a systematic 4-phase incident investigation 1. Detect and triage the active problems 2. Assess user impact and affected services. 3. Perform cross-data source analysis (problems → spans → logs) 4. Identify root cause with file/line-level precision |
For more prompts read the full documentation
Configure Model Access#
If you want to give access to other AI Agents and premium models, click in the Settings of the Dynatrace MCP Server, and select Configure Model Access, then select the models you want to give access to.

Dynatrace Observability#
All repositories using the Enablement Framework can automatically activate Dynatrace Full-Stack Observability or Application Monitoring, enabling seamless monitoring of the Kubernetes cluster and all deployed applications—no manual setup required.
Prerequisites#
- The following environment variables are set
DT_ENVIRONMENTDT_OPERATOR_TOKENDT_INGEST_TOKEN. These 3 variables are needed for monitoring the Kubernetes Cluster.
Monitoring a Kubernetes Cluster automatically#
Let's say we want to create an enablement where we deploy a Kubernetes Cluster and we want to deploy and monitor Astroshop also automatically when the enablement starts. Our post-create.sh file can look like this:
| .devcontainer/post-create.sh | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
Now let's break it down.
- Line 1 - 6: This code is needed for loading the framework and setting up the terminal for the container.
- Line 8 and 10:
startKindClusterandinstallK9screates the Kubernetes Cluster and installs k9s for easy management of your Kubernetes Cluster. For learning more go to Kubernetes Cluster section of the Framework section. - Line 13:
dynatraceDeployOperatorchecks for the needed credentials and deploys teh Dynatrace Operator with its´'s components (CSI Driver and Webhook) - Line 16:
deployCloudNativedeploys CloudNativeFullstack for Kubernetes. - Line 20:
deployApp astroshopwill call the deployApp repository and deploy Astroshop.
Race conditions safeguard
The framework includes logic to manage resources efficiently and prevent race conditions. For example, deployCloudNative will not start while the Dynatrace Operator is being created. Once the Operator is ready, the CloudNative Full-Stack resources are deployed, followed by the application itself. This ensures that Dynatrace components are fully operational before any application deployment begins.
Undeploying Dynakube#
Now, let's say you want to undeploy the Dynakubes, there is a comfort function for you to do so, just type undeployDynakube and this will undeploy the Dynakubes. For changing the monitoring mode to ApplicationMonitoring just type deployApplicationMonitoring and this will deploy the Application Monitoring mode in the cluster.