Guide for configuring dtctl and the Dynatrace MCP server for use with the O11y Engineer.
dtctl is a kubectl-style CLI for managing Dynatrace configuration as code.
# Install via npm
npm install -g @dynatrace-oss/dtctl
# Or via brew
brew install dynatrace-oss/tap/dtctl
# Set up a Dynatrace environment context
dtctl config set-context production \
--url "https://abc12345.live.dynatrace.com" \
--token "dt0s16.YOUR_API_TOKEN"
# Switch to the context
dtctl config use-context production
# Verify connection
dtctl get dashboards
| Scope | Purpose |
|---|---|
ReadConfig |
Read dashboards, settings |
WriteConfig |
Create/update dashboards, settings |
entities.read |
Read entity data |
metrics.read |
Read metrics |
logs.read |
Read log data |
openpipeline.events |
Read events |
automation.workflows.read |
Read workflows |
automation.workflows.write |
Create workflows |
slo.read |
Read SLOs |
slo.write |
Create SLOs |
syntheticMonitoring.read |
Read synthetic monitors |
syntheticMonitoring.write |
Create synthetic monitors |
project/
dynatrace/
dashboards/
service-overview.yaml
notebooks/
incident-analysis.yaml
workflows/
auto-remediation.yaml
slos/
service-slos.yaml
# Validate
dtctl apply -f dynatrace/ --dry-run
# Deploy all
dtctl apply -f dynatrace/
# Deploy specific
dtctl apply -f dynatrace/dashboards/service-overview.yaml
The Dynatrace MCP server enables AI-driven discovery and context-aware DQL generation.
Add to your AI assistant’s MCP configuration:
=== “Claude Code”
Add to `~/.claude/settings.json` or project `.claude/settings.json`:
```json
{
"mcpServers": {
"dynatrace": {
"command": "npx",
"args": ["-y", "@dynatrace-oss/dynatrace-mcp-server"],
"env": {
"DT_ENVIRONMENT": "https://abc12345.apps.dynatrace.com",
"DT_PLATFORM_TOKEN": "dt0s16.YOUR_TOKEN"
}
}
}
}
```
=== “Cursor”
Add to `.cursor/settings.json`:
```json
{
"mcpServers": {
"dynatrace": {
"command": "npx",
"args": ["-y", "@dynatrace-oss/dynatrace-mcp-server"],
"env": {
"DT_ENVIRONMENT": "https://abc12345.apps.dynatrace.com",
"DT_PLATFORM_TOKEN": "dt0s16.YOUR_TOKEN"
}
}
}
}
```
=== “Windsurf”
Add to `.windsurfrules/mcp.json`:
```json
{
"mcpServers": {
"dynatrace": {
"command": "npx",
"args": ["-y", "@dynatrace-oss/dynatrace-mcp-server"],
"env": {
"DT_ENVIRONMENT": "https://abc12345.apps.dynatrace.com",
"DT_PLATFORM_TOKEN": "dt0s16.YOUR_TOKEN"
}
}
}
}
```
After configuring, restart your AI assistant and verify the MCP connection. If MCP is available, you’ll see:
Dynatrace MCP server is configured and connected.
Available capabilities:
- Execute DQL queries
- Discover services and entities
- Analyze logs, metrics, and traces
- Create dashboards and notebooks
| Menu Code | Purpose |
|---|---|
PD |
Project Discovery — find services, metrics in Dynatrace |
DB |
Dashboard Builder — build dashboard from real metrics |
SW |
Suggest Workflows — get AI-suggested automations |
DN |
Diagnostic Notebook — build troubleshooting notebook |
| Scope | Purpose |
|---|---|
storage:logs:read |
Query logs |
storage:spans:read |
Query spans |
storage:metrics:read |
Query metrics |
storage:entities:read |
Discover entities |
storage:events:read |
Query events |
automation:workflows:read |
Read workflows |
Run SD (Setup Dynatrace via /o11y-engineer) to get an interactive guide through the complete setup process:
SD
This covers: