The local Dynatrace MCP server allows AI Assistants to interact with the Dynatrace observability platform, bringing real-time observability data directly into your development workflow. If you need help, please contact us via GitHub Issues if you have feature requests, questions, or need help. You can add this MCP server to your MCP Client like VSCode, Claude, Cursor, Amazon Q, Windsurf, ChatGPT,
Add this skill
npx mdskills install dynatrace-oss/dynatrace-mcpComprehensive observability integration with excellent setup docs and rich capabilities
1# Dynatrace MCP Server23<h4 align="center">4 <a href="https://github.com/dynatrace-oss/dynatrace-mcp/releases">5 <img src="https://img.shields.io/github/release/dynatrace-oss/dynatrace-mcp" />6 </a>7 <a href="https://github.com/dynatrace-oss/dynatrace-mcp/blob/main/LICENSE">8 <img src="https://img.shields.io/badge/license-mit-blue.svg" alt="Dynatrace MCP Server is released under the MIT License" />9 </a>10 <a href="https://vscode.dev/redirect/mcp/install?name=dynatrace-mcp-server&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40dynatrace-oss%2Fdynatrace-mcp-server%22%5D%2C%22env%22%3A%7B%7D%7D">11 <img src="https://img.shields.io/badge/Install_in-VS_Code-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white" />12 </a>13 <a href="[https://vscode.dev/redirect/mcp/install?name=dynatrace-mcp-server&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40dynatrace-oss%2Fdynatrace-mcp-server%22%5D%2C%22env%22%3A%7B%7D%7D](https://cursor.com/en/install-mcp?name=dynatrace-mcp-server&config=eyJuYW1lIjoiZHluYXRyYWNlLW1jcC1zZXJ2ZXIiLCJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBkeW5hdHJhY2Utb3NzL2R5bmF0cmFjZS1tY3Atc2VydmVyIl0sImVudiI6e319)">14 <img src="https://img.shields.io/badge/Install_in-Cursor-000000?style=flat-square&logoColor=white" />15 </a>16 <a href="https://www.npmjs.com/package/@dynatrace-oss/dynatrace-mcp-server">17 <img src="https://img.shields.io/npm/dm/@dynatrace-oss/dynatrace-mcp-server?logo=npm&style=flat&color=red" alt="npm" />18 </a>19 <a href="https://github.com/dynatrace-oss/dynatrace-mcp">20 <img src="https://img.shields.io/github/stars/dynatrace-oss/dynatrace-mcp" alt="Dynatrace MCP Server Stars on GitHub" />21 </a>22 <a href="https://github.com/dynatrace-oss/dynatrace-mcp">23 <img src="https://img.shields.io/github/contributors/dynatrace-oss/dynatrace-mcp?color=green" alt="Dynatrace MCP Server Contributors on GitHub" />24 </a>25</h4>2627> 🚀 **Try out our brand new [Remote Dynatrace MCP Server](https://www.dynatrace.com/hub/detail/dynatrace-mcp-server/)!** Now available - no local setup required, connect instantly to your Dynatrace environment from any MCP-compatible client.2829The local _Dynatrace MCP server_ allows AI Assistants to interact with the [Dynatrace](https://www.dynatrace.com/) observability platform,30bringing real-time observability data directly into your development workflow.3132> Note: This product is not officially supported by Dynatrace.3334If you need help, please contact us via [GitHub Issues](https://github.com/dynatrace-oss/dynatrace-mcp/issues) if you have feature requests, questions, or need help.3536https://github.com/user-attachments/assets/25c05db1-8e09-4a7f-add2-ed486ffd4b5a3738## Quickstart3940You can add this MCP server to your MCP Client like VSCode, Claude, Cursor, Amazon Q, Windsurf, ChatGPT, or Github Copilot via the command is `npx -y @dynatrace-oss/dynatrace-mcp-server` (type: `stdio`). For more details, please refer to the [configuration section below](#configuration).4142Furthermore, you need to configure the URL to a Dynatrace environment:4344- `DT_ENVIRONMENT` (string, e.g., `https://abc12345.apps.dynatrace.com`) - URL to your Dynatrace Platform (do not use Dynatrace classic URLs like `abc12345.live.dynatrace.com`)4546Authentication will be handled via Authorization Code Flow in your browser, you don't need to define a Platform Token nor an OAuth Client to get started.4748Once you are done, we recommend looking into [example prompts](#-example-prompts-), like `Get all details of the entity 'my-service'` or `Show me error logs`. Please mind that these prompts lead to executing DQL statements which may incur [costs](#costs) in accordance to your licence.4950**VSCode**5152```json53{54 "servers": {55 "npx-dynatrace-mcp-server": {56 "command": "npx",57 "args": ["-y", "@dynatrace-oss/dynatrace-mcp-server@latest"],58 "env": {59 "DT_ENVIRONMENT": "https://abc12345.apps.dynatrace.com"60 }61 }62 }63}64```6566## Architecture67686970## Use cases7172- **Real-time observability** - Fetch production-level data for early detection and proactive monitoring73- **Contextual debugging** - Fix issues with full context from monitored exceptions, logs, and anomalies74- **Security insights** - Get detailed vulnerability analysis and security problem tracking75- **Natural language queries** - Use AI-powered DQL generation and explanation76- **Multi-phase incident investigation** - Systematic 4-phase approach with automated impact assessment77- **Advanced transaction analysis** - Precise root cause identification with file/line-level accuracy78- **Cross-data source correlation** - Connect problems → spans → logs with trace ID correlation79- **DevOps automation** - Deployment health gates with automated promotion/rollback logic80- **Security compliance monitoring** - Multi-cloud compliance assessment with evidence-based investigation8182## Capabilities8384- List and get [problem](https://www.dynatrace.com/hub/detail/problems/) details from your services (for example Kubernetes)85- List and get security problems / [vulnerability](https://www.dynatrace.com/hub/detail/vulnerabilities/) details86- Execute DQL (Dynatrace Query Language) and retrieve logs, events, spans and metrics87- Send Slack messages (via Slack Connector)88- Set up notification Workflow (via Dynatrace [AutomationEngine](https://docs.dynatrace.com/docs/discover-dynatrace/platform/automationengine))89- Get more information about a monitored entity90- Get Ownership of an entity91- Create, list, and read documents (Notebooks, Dashboards, Launchpads, and other Dynatrace documents)9293### Costs9495**Important:** While this local MCP server is provided for free, using certain capabilities to access data in Dynatrace Grail may incur additional costs based96on your Dynatrace consumption model. This affects `execute_dql` tool and other capabilities that **query** Dynatrace Grail storage, and costs97depend on the volume (GB scanned).9899**Before using this MCP server extensively, please:**1001011. Review your current Dynatrace consumption model and pricing1022. Understand the cost implications of the specific data you plan to query (logs, events, metrics) - see [Dynatrace Pricing and Rate Card](https://www.dynatrace.com/pricing/)1033. Start with smaller timeframes (e.g., 12h-24h) and make use of [buckets](https://docs.dynatrace.com/docs/discover-dynatrace/platform/grail/data-model#built-in-grail-buckets) to reduce the cost impact1044. Set an appropriate `DT_GRAIL_QUERY_BUDGET_GB` environment variable (default: 1000 GB) to control and monitor your Grail query consumption105106**Grail Budget Tracking:**107108The MCP server includes built-in budget tracking for Grail queries to help you monitor and control costs:109110- Set `DT_GRAIL_QUERY_BUDGET_GB` (default: 1000 GB) to define your session budget limit111- The server tracks bytes scanned across all Grail queries in the current session112- You'll receive warnings when approaching 80% of your budget113- Budget exceeded alerts help prevent unexpected high consumption114- Budget resets when you restart the MCP server session115116**To understand costs that occured:**117118Execute the following DQL statement in a notebook to see how much bytes have been queried from Grail (Logs, Events, etc...):119120```121fetch dt.system.events122| filter event.kind == "QUERY_EXECUTION_EVENT" and contains(client.client_context, "dynatrace-mcp")123| sort timestamp desc124| fields timestamp, query_id, query_string, scanned_bytes, table, bucket, user.id, user.email, client.client_context125| maketimeSeries sum(scanned_bytes), by: { user.email, user.id, table }126```127128### AI-Powered Assistance (Preview)129130- **Natural Language to DQL** - Convert plain English queries to Dynatrace Query Language131- **DQL Explanation** - Get plain English explanations of complex DQL queries132- **AI Chat Assistant** - Get contextual help and guidance for Dynatrace questions133- **Feedback System** - Provide feedback to improve AI responses over time134135> **Note:** While Davis CoPilot AI is generally available (GA), the Davis CoPilot APIs are currently in preview. For more information, visit the [Davis CoPilot Preview Community](https://dt-url.net/copilot-community).136137## Configuration138139You can add this MCP server (using STDIO) to your MCP Client like VS Code, Claude, Cursor, Amazon Q Developer CLI, Windsurf Github Copilot via the package `@dynatrace-oss/dynatrace-mcp-server`.140141We recommend to always set it up for your current workspace instead of using it globally.142143**VS Code**144145```json146{147 "servers": {148 "npx-dynatrace-mcp-server": {149 "command": "npx",150 "args": ["-y", "@dynatrace-oss/dynatrace-mcp-server@latest"],151 "env": {152 "DT_ENVIRONMENT": "https://abc12345.apps.dynatrace.com"153 }154 }155 }156}157```158159**Claude Desktop**160161```json162{163 "mcpServers": {164 "dynatrace-mcp-server": {165 "command": "npx",166 "args": ["-y", "@dynatrace-oss/dynatrace-mcp-server@latest"],167 "env": {168 "DT_ENVIRONMENT": "https://abc12345.apps.dynatrace.com"169 }170 }171 }172}173```174175**Amazon Q Developer CLI**176177The [Amazon Q Developer CLI](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-mcp-configuration.html) provides an interactive chat experience directly in your terminal. You can ask questions, get help with AWS services, troubleshoot issues, and generate code snippets without leaving your command line environment.178179```json180{181 "mcpServers": {182 "dynatrace-mcp-server": {183 "command": "npx",184 "args": ["-y", "@dynatrace-oss/dynatrace-mcp-server@latest"],185 "env": {186 "DT_ENVIRONMENT": "https://abc12345.apps.dynatrace.com"187 }188 }189 }190}191```192193This configuration should be stored in `<your-repo>/.amazonq/mcp.json`.194195**Amazon Kiro**196197The [Amazon Kiro](https://kiro.dev/) is an agentic IDE that helps you do your best work with features such as specs, steering, and hooks.198199```json200{201 "mcpServers": {202 "dynatrace-mcp-server": {203 "command": "npx",204 "args": ["-y", "@dynatrace-oss/dynatrace-mcp-server@latest"],205 "env": {206 "DT_ENVIRONMENT": "https://abc12345.apps.dynatrace.com"207 }208 }209 }210}211```212213This configuration should be stored in `<your-repo>/.kiro/settings/mcp.json`.214215**Google Gemini CLI**216217The [Google Gemini CLI](https://github.com/google-gemini/gemini-cli) is Google's official command-line AI assistant that supports MCP server integration. You can add the Dynatrace MCP server using either the built-in management commands or manual configuration.218219Using `gemini` CLI directly (recommended):220221```bash222gemini extensions install https://github.com/dynatrace-oss/dynatrace-mcp223export DT_PLATFORM_TOKEN=... # optional224```225226The command will ask for the value Dynatrace Environment.227228Verify that the server is running via229230```bash231gemini mcp list232```233234Or manually in your `~/.gemini/settings.json` or `.gemini/settings.json`:235236```json237{238 "mcpServers": {239 "dynatrace": {240 "command": "npx",241 "args": ["@dynatrace-oss/dynatrace-mcp-server@latest"],242 "env": {243 "DT_ENVIRONMENT": "https://abc12345.apps.dynatrace.com"244 },245 "timeout": 30000,246 "trust": false247 }248 }249}250```251252### HTTP Server Mode (Alternative)253254For scenarios where you need to run the MCP server as an HTTP service instead of using stdio (e.g., for stateful sessions, load balancing, or integration with web clients), you can use the HTTP server mode:255256**Running as HTTP server:**257258```bash259# Get help and see all available options260npx -y @dynatrace-oss/dynatrace-mcp-server@latest --help261262# Run with HTTP server on default port 3000263npx -y @dynatrace-oss/dynatrace-mcp-server@latest --http264265# Run with custom port (using short or long flag)266npx -y @dynatrace-oss/dynatrace-mcp-server@latest --server -p 8080267npx -y @dynatrace-oss/dynatrace-mcp-server@latest --http --port 3001268269# Run with custom host/IP (using short or long flag)270npx -y @dynatrace-oss/dynatrace-mcp-server@latest --http --host 127.0.0.1 # recommended for local computers271npx -y @dynatrace-oss/dynatrace-mcp-server@latest --http --host 0.0.0.0 # recommended for container272npx -y @dynatrace-oss/dynatrace-mcp-server@latest --http -H 192.168.0.1 # recommended when sharing connection over a local network273274# Check version275npx -y @dynatrace-oss/dynatrace-mcp-server@latest --version276```277278**Configuration for MCP clients that support HTTP transport:**279280```json281{282 "mcpServers": {283 "dynatrace-http": {284 "url": "http://localhost:3000",285 "transport": "http"286 }287 }288}289```290291### Rule File292293For efficient result retrieval from Dynatrace, please consider creating a rule file (e.g., [.github/copilot-instructions.md](https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions), [.amazonq/rules/](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/context-project-rules.html)), instructing coding agents on how to get more details for your component/app/service. Here is an example for [easytrade](https://github.com/Dynatrace/easytrade), please adapt the names and filters to fit your use-cases and components:294295```296# Observability297298We use Dynatrace as an Observability solution. This document provides instructions on how to get data for easytrade from Dynatrace using DQL.299300## How to get any data for my App301302Depending on the query and tool used, the following filters can be applied to narrow down results:303304* `contains(entity.name, "easytrade")`305* `contains(affected_entity.name, "easytrade")`306* `contains(container.name, "easytrade")`307308For best results, you can combine these filters with an `OR` operator.309310## Logs311312To fetch logs for easytrade, execute `fetch logs | filter contains(container.name, "easyatrade")`.313For fetching just error-logs, add `| filter loglevel == "ERROR"`.314```315316## Environment Variables317318> **Breaking Change in v1.0.0:** The MCP server no longer automatically loads `.env` files. To use environment variables from a `.env` file, you need to configure your MCP client to load environment variables using the native `envFile` configuration option. See the [configuration examples](#configuration) below for details.319320- `DT_ENVIRONMENT` (**required**, string, e.g., `https://abc12345.apps.dynatrace.com`) - URL to your Dynatrace Platform (do not use Dynatrace classic URLs like `abc12345.live.dynatrace.com`)321- `DT_PLATFORM_TOKEN` (optional, string, e.g., `dt0s16.SAMPLE.abcd1234`) - Dynatrace Platform Token322- `OAUTH_CLIENT_ID` (optional, string, e.g., `dt0s02.SAMPLE`) - Alternative: Dynatrace OAuth Client ID (for advanced use cases)323- `OAUTH_CLIENT_SECRET` (optional, string, e.g., `dt0s02.SAMPLE.abcd1234`) - Alternative: Dynatrace OAuth Client Secret (for advanced use cases)324- `DT_SSO_URL` (optional, string, e.g., `https://sso.dynatrace.com`) - Override the SSO URL for OAuth authentication. By default, the SSO URL is automatically discovered from your Dynatrace environment.325- `DT_GRAIL_QUERY_BUDGET_GB` (optional, number, default: `1000`) - Budget limit in GB (base 1000) for Grail query bytes scanned per session. The MCP server tracks your Grail usage and warns when approaching or exceeding this limit.326327When just providing `DT_ENVIRONMENT`, the local MCP server will try to open a browser window to authenticate against the Dynatrace SSO.328329For more information about the other authentication methods, please have a look at the documentation about330[creating a Platform Token in Dynatrace](https://docs.dynatrace.com/docs/manage/identity-access-management/access-tokens-and-oauth-clients/platform-tokens), as well as331[creating an OAuth Client in Dynatrace](https://docs.dynatrace.com/docs/manage/identity-access-management/access-tokens-and-oauth-clients/oauth-clients) for advanced scenarios (service-users, backend-to-backend communication).332333In addition, depending on the features you use, the following variables can be configured:334335- `SLACK_CONNECTION_ID` (string) - connection ID of a [Slack Connection](https://docs.dynatrace.com/docs/analyze-explore-automate/workflows/actions/slack)336337### Proxy Configuration338339The MCP server honors system proxy settings for corporate environments:340341- `https_proxy` or `HTTPS_PROXY` (optional, string, e.g., `http://proxy.example.com:8080`) - Proxy server URL for HTTPS requests342- `http_proxy` or `HTTP_PROXY` (optional, string, e.g., `http://proxy.example.com:8080`) - Proxy server URL for HTTP requests343- `no_proxy` or `NO_PROXY` (optional, string, e.g., `localhost,127.0.0.1,.local`) - Comma-separated list of hostnames or domains that should bypass the proxy344- `NODE_EXTRA_CA_CERTS` (optional, string, e.g., `C:\some-path\certificate.pem`) - When set, the well known "root" CAs (like VeriSign) will be extended with the extra certificates345346**Note:** The `no_proxy` environment variable is currently logged for informational purposes but not fully enforced by the underlying HTTP client. If you need to bypass the proxy for specific hosts, consider configuring your proxy server to handle these exclusions.347348Example configuration with proxy:349350```bash351export HTTPS_PROXY=http://proxy.company.com:8080352export NO_PROXY=localhost,127.0.0.1,.company.local353export DT_ENVIRONMENT=https://abc12345.apps.dynatrace.com354```355356### Scopes for Authentication357358Depending on the features you are using, the following scopes are needed:359360**Available for both Platform Tokens and OAuth Clients:**361362- `app-engine:apps:run` - needed for almost all tools363- `automation:workflows:read` - read Workflows364- `automation:workflows:write` - create and update Workflows365- `automation:workflows:run` - run Workflows366- `app-settings:objects:read` - read app-settings - needed for `send_slack_message` tool to read connection details from App-Settings367- `storage:buckets:read` - needed for `execute_dql` tool to read all system data stored on Grail368- `storage:logs:read` - needed for `execute_dql` tool to read logs for reliability guardian validations369- `storage:metrics:read` - needed for `execute_dql` tool to read metrics for reliability guardian validations370- `storage:bizevents:read` - needed for `execute_dql` tool to read bizevents for reliability guardian validations371- `storage:spans:read` - needed for `execute_dql` tool to read spans from Grail372- `storage:entities:read` - needed for `execute_dql` tool to read Entities from Grail373- `storage:events:read` - needed for `execute_dql` tool to read Events from Grail374- `storage:security.events:read`- needed for `execute_dql` tool to read Security Events from Grail375- `storage:system:read` - needed for `execute_dql` tool to read System Data from Grail376- `storage:user.events:read` - needed for `execute_dql` tool to read User events from Grail377- `storage:user.sessions:read` - needed for `execute_dql` tool to read User sessions from Grail378- `storage:smartscape:read` - needed for `execute_dql` tool to read Smartscape Data379- `storage:events:write` - needed for `send_event` tool to send event data to Dynatrace380- `davis-copilot:conversations:execute` - execute conversational skill (chat with Copilot)381- `davis-copilot:nl2dql:execute` - execute Davis Copilot Natural Language (NL) to DQL skill382- `davis-copilot:dql2nl:execute` - execute DQL to Natural Language (NL) skill383- `davis:analyzers:read` - needed for listing and getting Davis analyzer definitions384- `davis:analyzers:execute` - needed for executing Davis analyzers385- `email:emails:send` - needed for `send_email` tool to send emails386- `document:documents:read` - needed for `list_documents` and `read_document` tools to list and read Dynatrace documents (Notebooks, Dashboards, Launchpads, etc.)387- `document:documents:write` - needed for `create_document` tool to create new documents388389**Notes**:390391- Versions before 0.12.0 required the scope `app-engine:functions:run`, which is no longer required.392- Versions before 0.13.0 required the scopes `settings:objects:read` and `environment-api:entities:read`, which are no longer required.393394## ✨ Example prompts ✨395396You can start with something as simple as "Is my component monitored by Dynatrace?", and follow up with more sophisticated [examples](examples/).397398## Troubleshooting399400### Authentication Issues401402In most cases, authentication issues are related to missing scopes or invalid tokens. Please ensure that you have added all required scopes as listed above.403404**For Platform Tokens:**4054061. Verify your Platform Token has all the necessary scopes listed in the "Scopes for Authentication" section4072. Ensure your token is valid and not expired4083. Check that your user has the required permissions in your Dynatrace Environment409410**For OAuth Clients:**411In case of OAuth-related problems, you can troubleshoot SSO/OAuth issues based on our [Dynatrace Developer Documentation](https://developer.dynatrace.com/develop/access-platform-apis-from-outside/#get-bearer-token-and-call-app-function).412413It is recommended to test access with the following API (which requires minimal scopes `app-engine:apps:run` and, e.g., `storage:logs:read`):4144151. Use OAuth Client ID and Secret to retrieve a Bearer Token (only valid for a couple of minutes):416417```bash418curl --request POST 'https://sso.dynatrace.com/sso/oauth2/token' \419 --header 'Content-Type: application/x-www-form-urlencoded' \420 --data-urlencode 'grant_type=client_credentials' \421 --data-urlencode 'client_id={your-client-id}' \422 --data-urlencode 'client_secret={your-client-secret}' \423 --data-urlencode 'scope=app-engine:apps:run storage:logs:read'424```4254262. Use `access_token` from the response of the above call as the bearer-token in the next call:427428```bash429curl -X GET https://abc12345.apps.dynatrace.com/platform/management/v1/environment \430 -H 'accept: application/json' \431 -H 'Authorization: Bearer {your-bearer-token}'432```4334343. You should retrieve a result like this:435436```json437{438 "environmentId": "abc12345",439 "createTime": "2023-01-01T00:10:57.123Z",440 "blockTime": "2025-12-07T00:00:00Z",441 "state": "ACTIVE"442}443```444445### Problem accessing data on Grail446447Grail has a dedicated section about permissions in the Dynatrace Docs. Please refer to https://docs.dynatrace.com/docs/discover-dynatrace/platform/grail/data-model/assign-permissions-in-grail for more details.448449## Telemetry450451The Dynatrace MCP Server sends telemetry data using Dynatrace OpenKit BizEvents to help improve the product. This includes:452453- Server start events (`com.dynatrace-oss.mcp.server-start`)454- Client initialization events (`com.dynatrace-oss.mcp.client-initialization`) - which MCP client is connecting (e.g., VS Code, Claude Desktop, Cursor)455- Tool usage events (`com.dynatrace-oss.mcp.tool-usage`) - which tools are called, success/failure, execution duration456- Error events (`com.dynatrace-oss.mcp.error`) - error tracking for debugging and improvement457458All telemetry data is sent as **Business Events** and is accessible via Grail for analysis:459460```dql461fetch bizevents462| filter startsWith(event.type, "com.dynatrace-oss.mcp")463| sort timestamp DESC464```465466**Privacy and Opt-out:**467468- Telemetry is **enabled by default** but can be disabled by setting `DT_MCP_DISABLE_TELEMETRY=true`469- No sensitive data from your Dynatrace environment is tracked470- Only anonymous usage statistics and error information are collected471- Usage statistics and error data are transmitted to Dynatrace’s analytics endpoint472473**Configuration options:**474475- `DT_MCP_DISABLE_TELEMETRY` (boolean, default: `false`) - Disable Telemetry476- `DT_MCP_TELEMETRY_APPLICATION_ID` (string, default: `dynatrace-mcp-server`) - Application ID for tracking477- `DT_MCP_TELEMETRY_ENDPOINT_URL` (string, default: Dynatrace endpoint) - OpenKit endpoint URL478- `DT_MCP_TELEMETRY_DEVICE_ID` (string, default: auto-generated) - Device identifier for tracking479480To disable usage tracking, add this to your environment:481482```bash483DT_MCP_DISABLE_TELEMETRY=true484```485
Full transparency — inspect the skill content before installing.