home / mcp / dynatrace mcp server
MCP server for Dynatrace Observability
Configuration
View docs{
"mcpServers": {
"dynatrace-oss-dynatrace-mcp": {
"url": "http://localhost:3000",
"headers": {
"DT_SSO_URL": "https://sso.dynatrace.com",
"DT_ENVIRONMENT": "https://abc12345.apps.dynatrace.com",
"OAUTH_CLIENT_ID": "dt0s02.SAMPLE",
"DT_PLATFORM_TOKEN": "dt0s16.SAMPLE.abcd1234",
"OAUTH_CLIENT_SECRET": "dt0s02.SAMPLE.abcd1234",
"DT_GRAIL_QUERY_BUDGET_GB": ":"
}
}
}
}You can run Dynatrace MCP Server locally or connect remotely to a Dynatrace environment, enabling AI assistants to access real-time observability data and perform Dynatrace-driven actions from your MCP clients. This server supports standard STDIO usage as well as an HTTP server mode for web-based integrations, and it handles authentication via browser-based OAuth flows while guiding you through cost-aware data querying.
Set up the MCP server in your MCP client to start querying Dynatrace data, generate natural language to DQL translations, and execute queries to fetch rich observability data. You can run with an embedded STDIO configuration for local development or use the HTTP server mode for web-based clients. Typical workflows include real-time observability checks, contextual debugging with logs and traces, and natural language queries that produce executable DQL.
Prerequisites: ensure you have Node.js and npm installed on your machine.
Install and run the MCP server locally using STDIO configuration shown in the quickstart snippet.
{
"servers": {
"npx-dynatrace-mcp-server": {
"command": "npx",
"args": ["-y", "@dynatrace-oss/dynatrace-mcp-server@latest"],
"env": {
"DT_ENVIRONMENT": "https://abc12345.apps.dynatrace.com"
}
}
}
}Configuration covers environment variables, proxy settings, authentication scopes, and optional HTTP server mode. The server supports loading environment variables directly or via an envFile in clients that support it. The following environment variables are relevant when running in STDIO mode: DT_ENVIRONMENT (required), DT_PLATFORM_TOKEN (optional), OAUTH_CLIENT_ID (optional), OAUTH_CLIENT_SECRET (optional), DT_SSO_URL (optional), and DT_GRAIL_QUERY_BUDGET_GB (optional, default 1000). Use the Grail budget to control per-session query costs and monitor usage with built-in alerts.
Key variables you will configure include the following. These are used by the MCP server to connect to your Dynatrace environment, authenticate, and manage query budgets.
DT_ENVIRONMENT=https://abc12345.apps.dynatrace.com
# Optional tokens and credentials
DT_PLATFORM_TOKEN=YOUR_PLATFORM_TOKEN
OAUTH_CLIENT_ID=YOUR_CLIENT_ID
OAUTH_CLIENT_SECRET=YOUR_CLIENT_SECRET
DT_SSO_URL=https://sso.dynatrace.com
DT_GRAIL_QUERY_BUDGET_GB=1000If you prefer to run the MCP server as an HTTP service for stateful sessions or web clients, you can start it in HTTP mode and connect using a URL.
# Get help and see all available options
npx -y @dynatrace-oss/dynatrace-mcp-server@latest --help
# Run with HTTP server on default port 3000
npx -y @dynatrace-oss/dynatrace-mcp-server@latest --http
# Run with custom port
npx -y @dynatrace-oss/dynatrace-mcp-server@latest --server -p 8080
npx -y @dynatrace-oss/dynatrace-mcp-server@latest --http --port 3001
# Run with custom host
npx -y @dynatrace-oss/dynatrace-mcp-server@latest --http --host 127.0.0.1
npx -y @dynatrace-oss/dynatrace-mcp-server@latest --http --host 0.0.0.0
npx -y @dynatrace-oss/dynatrace-mcp-server@latest --http -H 192.168.0.1
# Check version
npx -y @dynatrace-oss/dynatrace-mcp-server@latest --versionYou can use natural language prompts to generate DQL, fetch logs, or locate issues across Dynatrace data sources. The server supports a range of capabilities including executing DQL, retrieving logs, spans, events, and metrics, as well as sending notifications and reading or creating Dynatrace documents.
Costs may apply when querying Dynatrace Grail data. Start with smaller timeframes and monitor your Grail query budget. A built-in Grail budget tracker lets you set a per-session limit and warns you as you approach the limit.
Authentication issues usually relate to missing or misconfigured scopes. Ensure your environment variables and tokens are valid and that you have the required scopes for the actions you perform.
Try questions like: Is my component monitored by Dynatrace? or Show me error logs. These prompts translate into DQL queries that fetch observability data.
The MCP server supports both local STDIO usage and HTTP server mode for diverse client scenarios. Use the STDIO flow for local tooling and the HTTP flow for web-based clients or load-balanced deployments.
Execute Dynatrace Query Language (DQL) queries and retrieve logs, events, spans, and metrics from Grail.
Send messages to Slack using an integrated Slack Connector.
Read documents such as Notebooks, Dashboards, and Launchpads from Dynatrace.
Create new documents in Dynatrace for collaboration and sharing.
List available Dynatrace documents across notebooks, dashboards, and launchpads.
Get detailed information about a monitored entity.
Get ownership information for a Dynatrace entity.
Convert natural language queries into Dynatrace Query Language.
Explain Dynatrace Query Language queries in plain language.