Connect Azure SRE Agent to Dynatrace using the official MCP server integration for real-time observability data.
Overview
Dynatrace provides a hosted MCP server that enables Azure SRE Agent to interact with the Dynatrace observability platform via SSE (Server-Sent Events) transport. Query logs, investigate problems, analyze security vulnerabilities, and execute DQL (Dynatrace Query Language), and generate timeseries forecasts directly from your SRE Agent conversations.
Key capabilities
| Capability | Description |
|---|---|
| Create DQL query | Generate DQL queries from natural language prompts |
| Explain DQL query | Get plain English explanations of DQL queries |
| Ask Dynatrace | Ask general Dynatrace questions (workflows, alerts, etc.) |
| Run DQL query | Execute DQL and get results (up to 1000 records) |
| Query problems | List active or closed Davis Problems |
| Get problem by ID | Get detailed problem information |
| Get vulnerabilities | List open security vulnerabilities by risk level |
| Timeseries forecast | Predict future values using statistical models |
NOTE: This is the official Dynatrace-hosted MCP server. For the community OSS version, see the alternate configuration section.
Prerequisites
- Azure SRE Agent resource
- Dynatrace Platform account (SaaS)
- Platform Token or OAuth Client with required scopes
- Your Dynatrace environment URL (e.g.,
https://abc12345.apps.dynatrace.com)
Step 1: Get your Dynatrace credentials
Create a Platform Token
- Go to My Platform Tokens
- Click + Create token
- Add the token name, expiration date, and required scopes (see below). For more details on creating platform tokens click here
- Copy the generated token
Required scopes
| Tool | Required Scopes |
|---|---|
| MCP Gateway access | mcp-gateway:servers:invoke, mcp-gateway:servers:read |
| Create DQL query | davis-copilot:nl2dql:execute |
| Explain DQL query | davis-copilot:dql2nl:execute |
| Ask Dynatrace | davis-copilot:conversations:execute |
| Run DQL query | storage:buckets:read |
| Query problems | storage:buckets:read, storage:events:read |
| Get vulnerabilities | storage:security.events:read |
| Timeseries forecast | davis:analyzers:read, davis:analyzers:execute |
IMPORTANT: The
mcp-gateway:servers:invokeandmcp-gateway:servers:readscopes are required for SSE transport to the Dynatrace-hosted MCP server.
Step 2: Add the MCP connector
- Navigate to your Azure SRE Agent at sre.azure.com
- Select your agent from the list
- In the left navigation, expand Builder > Connectors
- Select Add connector
- In "Choose a connector", select MCP server (User provided connector)
- Click Next and configure:
For Streamable-HTTP connection (Dynatrace-hosted MCP):
| Field | Value |
|---|---|
| Name | dynatrace-mcp |
| Connection type | Streamable-HTTP |
| URL | https://abc12345.apps.dynatrace.com/platform-reserved/mcp-gateway/v0.1/servers/dynatrace-mcp/mcp |
| Authentication method | Bearer token |
| Token | Your Dynatrace Platform Token |
TIP: Replace
abc12345with your Dynatrace tenant name from your environment URL.
- Click Next to review, then Add to save
Equivalent mcp.json configuration
For reference, here's the equivalent configuration in mcp.json format (used by VS Code and other MCP clients):
{
"mcpServers": {
"dynatrace-mcp": {
"url": "https://abc12345.apps.dynatrace.com/platform-reserved/mcp-gateway/v0.1/servers/dynatrace-mcp/mcp",
"transport": "streamable-http",
"headers": {
"Authorization": "Bearer YOUR_PLATFORM_TOKEN"
}
}
}
}
Step 3: Create a Dynatrace subagent
Create a specialized agent focused on Dynatrace observability:
- In the left navigation, select Builder > Subagent builder
- Click + Create
- Switch to the YAML tab and paste this configuration:
api_version: azuresre.ai/v1
kind: AgentConfiguration
spec:
name: DynatraceExpert
system_prompt: |
You are a Dynatrace observability expert with access to real-time monitoring data via the Dynatrace MCP server.
## Capabilities
You can help users with:
- Creating DQL queries from natural language descriptions
- Explaining existing DQL queries in plain English
- Running DQL queries to fetch logs, events, and metrics
- Investigating active and closed Davis Problems
- Analyzing security vulnerabilities by risk level
- Getting Kubernetes cluster events
- Generating timeseries forecasts
## Best Practices
When working with DQL:
- Use the Create DQL query tool to generate queries from natural language
- Use the Explain DQL query tool to help users understand complex queries
- Start with smaller timeframes (last 1h or 12h) to optimize query performance
- Always explain what data your queries will return
When investigating problems:
- First query problems to understand the active issue landscape
- Get detailed problem info including root cause analysis
- Correlate with related logs and events
agent_type: Autonomous
enable_skills: true
- Click Create to save the subagent
- Click on the newly created subagent named "DynatraceExpert" and scroll down to the Tools section
- Under Tools select "Choose Tools"
- Filter for the "MCP Tool" and select your Dynatrace MCP Server Tools
- Click Save
Step 4: Test the integration
- Open a new chat session with your SRE Agent
- Try these example prompts:
DQL queries
Create a DQL query to find all error logs from the last hour
Explain this DQL query: fetch logs | filter loglevel == "ERROR" | limit 10
Run a DQL query to show me the top 10 slowest requests in the last 24 hours
Problem investigation
List active problems in my Dynatrace environment
Get details for problem P-12345
Query problems from the last 7 days that are now closed
Available tools
| Tool | Description | Required Scopes |
|---|---|---|
| Create DQL query | Generate DQL from natural language | davis-copilot:nl2dql:execute |
| Explain DQL query | Get plain English explanation of DQL | davis-copilot:dql2nl:execute |
| Ask Dynatrace | General Dynatrace questions and guidance | davis-copilot:conversations:execute |
| Run DQL query | Execute DQL and get results (max 1000 records) | storage:buckets:read |
| Query problems | List active or closed Davis Problems | storage:buckets:read, storage:events:read |
| Get problem by ID | Get detailed problem information | storage:buckets:read, storage:events:read |
| Get vulnerabilities | List open security vulnerabilities by risk | storage:security.events:read |
| Get K8s cluster events | Get events for Kubernetes clusters | storage:buckets:read |
| Timeseries forecast | Predict future values using statistical models | davis:analyzers:read, davis:analyzers:execute |
Troubleshooting
Connection issues
| Error | Cause | Solution |
|---|---|---|
401 Unauthorized | Invalid or expired token | Generate a new Platform Token |
403 Forbidden | Missing scopes | Add mcp-gateway:servers:invoke and mcp-gateway:servers:read scopes |
Could not connect | Wrong tenant URL | Verify your tenant name in the URL |
Timeout | Network issues | Check network access to *.apps.dynatrace.com |
Verify your token
Test your token with this curl command:
curl -X GET https://abc12345.apps.dynatrace.com/platform/management/v1/environment -H Authorization: Bearer YOUR_PLATFORM_TOKEN -H accept: application/json
Alternate: OSS MCP server
Dynatrace also provides an open-source MCP server with additional capabilities like entity management, workflows, and document creation. This version uses Stdio transport and requires Node.js.
NOTE: The OSS MCP server is community-supported. For help, use GitHub Issues.
Setup in Azure SRE Agent
- Navigate to Builder > Connectors > Add connector
- Select MCP server and click Next
- Configure the Stdio connection:
| Field | Value |
|---|---|
| Name | dynatrace-mcp-oss |
| Connection type | Stdio |
| Command | npx |
| Arguments | -y, @dynatrace-oss/dynatrace-mcp-server@latest |
| Environment variables | See table below |
Environment variables:
| Key | Value |
|---|---|
DT_ENVIRONMENT | Your Dynatrace environment URL |
DT_PLATFORM_TOKEN | Your Platform Token with required scopes |
DT_GRAIL_QUERY_BUDGET_GB | 100 (optional, limits query costs) |
- Click Next to review, then Add to save
Equivalent mcp.json configuration
{
"mcpServers": {
"dynatrace-mcp-oss": {
"command": "npx",
"args": ["-y", "@dynatrace-oss/dynatrace-mcp-server@latest"],
"env": {
"DT_ENVIRONMENT": "https://abc12345.apps.dynatrace.com",
"DT_PLATFORM_TOKEN": "YOUR_PLATFORM_TOKEN",
"DT_GRAIL_QUERY_BUDGET_GB": "100"
}
}
}
}
OSS server scopes
| Feature | Required Scopes |
|---|---|
| Read logs | storage:logs:read |
| Read metrics | storage:metrics:read |
| Read entities | storage:entities:read |
| Workflows | automation:workflows:read, automation:workflows:write |
| Documents | document:documents:read, document:documents:write |
| Slack | app-settings:objects:read |