Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
Dynatrace logo

Dynatrace

Bydynatrace-oss·148

Manage and interact with the Dynatrace Platform for real-time observability and monitoring.

Dynatrace MCP Server is released under the MIT LicensenpmDynatrace MCP Server Stars on GitHubDynatrace MCP Server Contributors on GitHub

The localDynatrace MCP server allows AI Assistants to interact with theDynatrace observability platform,bringing real-time observability data directly into your development workflow.

Note: This product is not officially supported by Dynatrace.

If you need help, please contact us viaGitHub Issues if you have feature requests, questions, or need help.

easytrade-recording-1.mp4

Quickstart

You can add this MCP server to your MCP Client like VSCode, Claude, Cursor, Amazon Q, Windsurf, ChatGPT, or Github Copilot via the npmjs package@dynatrace-oss/dynatrace-mcp-server, and typestdio.You can find more details about the configuration for different AI Assistants, Agents and MCP Clients in theConfiguration section below.

Furthermore, you need your Dynatrace environment URL, e.g.,https://abc12345.apps.dynatrace.com, as well as aPlatform Token, e.g.,dt0s16.SAMPLE.abcd1234, withrequired scopes.

Depending on your MCP Client, you need to configure these as environment variables or as settings in the UI:

  • DT_ENVIRONMENT (string, e.g.,https://abc12345.apps.dynatrace.com) - URL to your Dynatrace Platform (do not use Dynatrace classic URLs likeabc12345.live.dynatrace.com)
  • DT_PLATFORM_TOKEN (string, e.g.,dt0s16.SAMPLE.abcd1234) -Recommended: Dynatrace Platform Token

Once you are done, we recommend looking intoexample prompts, likeGet all details of the entity 'my-service' orShow me error logs. Please mind that these prompts lead to executing DQL statements which may incurcosts in accordance to your licence.

Architecture

Architecture

Use cases

  • Real-time observability - Fetch production-level data for early detection and proactive monitoring
  • Contextual debugging - Fix issues with full context from monitored exceptions, logs, and anomalies
  • Security insights - Get detailed vulnerability analysis and security problem tracking
  • Natural language queries - Use AI-powered DQL generation and explanation
  • Multi-phase incident investigation - Systematic 4-phase approach with automated impact assessment
  • Advanced transaction analysis - Precise root cause identification with file/line-level accuracy
  • Cross-data source correlation - Connect problems → spans → logs with trace ID correlation
  • DevOps automation - Deployment health gates with automated promotion/rollback logic
  • Security compliance monitoring - Multi-cloud compliance assessment with evidence-based investigation

Capabilities

  • List and getproblem details from your services (for example Kubernetes)
  • List and get security problems /vulnerability details
  • Execute DQL (Dynatrace Query Language) and retrieve logs, events, spans and metrics
  • Send Slack messages (via Slack Connector)
  • Set up notification Workflow (via DynatraceAutomationEngine)
  • Get more information about a monitored entity
  • Get Ownership of an entity

Costs

Important: While this local MCP server is provided for free, using certain capabilities to access data in Dynatrace Grail may incur additional costs basedon your Dynatrace consumption model. This affectsexecute_dql tool and other capabilities thatquery Dynatrace Grail storage, and costsdepend on the volume (GB scanned).

Before using this MCP server extensively, please:

  1. Review your current Dynatrace consumption model and pricing
  2. Understand the cost implications of the specific data you plan to query (logs, events, metrics) - seeDynatrace Pricing and Rate Card
  3. Start with smaller timeframes (e.g., 12h-24h) and make use ofbuckets to reduce the cost impact
  4. Set an appropriateDT_GRAIL_QUERY_BUDGET_GB environment variable (default: 1000 GB) to control and monitor your Grail query consumption

Grail Budget Tracking:

The MCP server includes built-in budget tracking for Grail queries to help you monitor and control costs:

  • SetDT_GRAIL_QUERY_BUDGET_GB (default: 1000 GB) to define your session budget limit
  • The server tracks bytes scanned across all Grail queries in the current session
  • You'll receive warnings when approaching 80% of your budget
  • Budget exceeded alerts help prevent unexpected high consumption
  • Budget resets when you restart the MCP server session

To understand costs that occured:

Execute the following DQL statement in a notebook to see how much bytes have been queried from Grail (Logs, Events, etc...):

fetch dt.system.events| filter event.kind == "QUERY_EXECUTION_EVENT" and contains(client.client_context, "dynatrace-mcp")| sort timestamp desc| fields timestamp, query_id, query_string, scanned_bytes, table, bucket, user.id, user.email, client.client_context| maketimeSeries sum(scanned_bytes), by: { user.email, user.id, table }

AI-Powered Assistance (Preview)

  • Natural Language to DQL - Convert plain English queries to Dynatrace Query Language
  • DQL Explanation - Get plain English explanations of complex DQL queries
  • AI Chat Assistant - Get contextual help and guidance for Dynatrace questions
  • Feedback System - Provide feedback to improve AI responses over time

Note: While Davis CoPilot AI is generally available (GA), the Davis CoPilot APIs are currently in preview. For more information, visit theDavis CoPilot Preview Community.

Configuration

You 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.

We recommend to always set it up for your current workspace instead of using it globally.

VS Code

{"servers": {"npx-dynatrace-mcp-server": {"command":"npx","cwd":"${workspaceFolder}","args": ["-y","@dynatrace-oss/dynatrace-mcp-server@latest"],"envFile":"${workspaceFolder}/.env"    }  }}

Please note: In this config,the${workspaceFolder} variable is used.This only works if the config is stored in the current workspaces, e.g.,<your-repo>/.vscode/mcp.json. Alternatively, this can also be stored in user-settings, and you can defineenv as follows:

{"servers": {"npx-dynatrace-mcp-server": {"command":"npx","args": ["-y","@dynatrace-oss/dynatrace-mcp-server@latest"],"env": {"DT_PLATFORM_TOKEN":"","DT_ENVIRONMENT":""      }    }  }}

Claude Desktop

{"mcpServers": {"dynatrace-mcp-server": {"command":"npx","args": ["-y","@dynatrace-oss/dynatrace-mcp-server@latest"],"env": {"DT_PLATFORM_TOKEN":"","DT_ENVIRONMENT":""      }    }  }}

Amazon Q Developer CLI

TheAmazon Q Developer CLI 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.

{"mcpServers": {"dynatrace-mcp-server": {"command":"npx","args": ["-y","@dynatrace-oss/dynatrace-mcp-server@latest"],"env": {"DT_PLATFORM_TOKEN":"","DT_ENVIRONMENT":""      }    }  }}

This configuration should be stored in<your-repo>/.amazonq/mcp.json.

Google Gemini CLI

TheGoogle 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.

Usinggemini CLI directly (recommended):

gemini extensions install https://github.com/dynatrace-oss/dynatrace-mcpexport DT_PLATFORM_TOKEN=...export DT_ENVIRONMENT=https://...

and verify that the server is running via

gemini mcp list

Or manually in your~/.gemini/settings.json or.gemini/settings.json:

{"mcpServers": {"dynatrace": {"command":"npx","args": ["@dynatrace-oss/dynatrace-mcp-server@latest"],"env": {"DT_PLATFORM_TOKEN":"","DT_ENVIRONMENT":""      },"timeout":30000,"trust":false    }  }}

HTTP Server Mode (Alternative)

For 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:

Running as HTTP server:

# Get help and see all available optionsnpx -y @dynatrace-oss/dynatrace-mcp-server@latest --help# Run with HTTP server on default port 3000npx -y @dynatrace-oss/dynatrace-mcp-server@latest --http# Run with custom port (using short or long flag)npx -y @dynatrace-oss/dynatrace-mcp-server@latest --server -p 8080npx -y @dynatrace-oss/dynatrace-mcp-server@latest --http --port 3001# Run with custom host/IP (using short or long flag)npx -y @dynatrace-oss/dynatrace-mcp-server@latest --http --host 127.0.0.1npx -y @dynatrace-oss/dynatrace-mcp-server@latest --http -H 192.168.0.1# Check versionnpx -y @dynatrace-oss/dynatrace-mcp-server@latest --version

Configuration for MCP clients that support HTTP transport:

{"mcpServers": {"dynatrace-http": {"url":"http://localhost:3000","transport":"http"    }  }}

Rule File

For efficient result retrieval from Dynatrace, please consider creating a rule file (e.g.,.github/copilot-instructions.md,.amazonq/rules/), instructing coding agents on how to get more details for your component/app/service. Here is an example foreasytrade, please adapt the names and filters to fit your use-cases and components:

# ObservabilityWe use Dynatrace as an Observability solution. This document provides instructions on how to get data for easytrade from Dynatrace using DQL.## How to get any data for my AppDepending on the query and tool used, the following filters can be applied to narrow down results:* `contains(entity.name, "easytrade")`* `contains(affected_entity.name, "easytrade")`* `contains(container.name, "easytrade")`For best results, you can combine these filters with an `OR` operator.## LogsTo fetch logs for easytrade, execute `fetch logs | filter contains(container.name, "easyatrade")`.For fetching just error-logs, add `| filter loglevel == "ERROR"`.

Environment Variables

You can set up authentication viaPlatform Tokens (recommended) orOAuth Client via the following environment variables:

  • DT_ENVIRONMENT (string, e.g.,https://abc12345.apps.dynatrace.com) - URL to your Dynatrace Platform (do not use Dynatrace classic URLs likeabc12345.live.dynatrace.com)
  • DT_PLATFORM_TOKEN (string, e.g.,dt0s16.SAMPLE.abcd1234) -Recommended: Dynatrace Platform Token
  • OAUTH_CLIENT_ID (string, e.g.,dt0s02.SAMPLE) - Alternative: Dynatrace OAuth Client ID (for advanced use cases)
  • OAUTH_CLIENT_SECRET (string, e.g.,dt0s02.SAMPLE.abcd1234) - Alternative: Dynatrace OAuth Client Secret (for advanced use cases)
  • DT_GRAIL_QUERY_BUDGET_GB (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.

Platform Tokens are recommended for most use cases as they provide a simpler authentication flow. OAuth Clients should only be used when specific OAuth features are required.

For more information, please have a look at the documentation aboutcreating a Platform Token in Dynatrace, as well ascreating an OAuth Client in Dynatrace for advanced scenarios.

In addition, depending on the features you use, the following variables can be configured:

Scopes for Authentication

Depending on the features you are using, the following scopes are needed:

Available for both Platform Tokens and OAuth Clients:

  • app-engine:apps:run - needed for almost all tools

  • app-engine:functions:run - needed for for almost all tools

  • environment-api:entities:read - for retrieving ownership details from monitored entities (currently not available for Platform Tokens)

  • automation:workflows:read - read Workflows

  • automation:workflows:write - create and update Workflows

  • automation:workflows:run - run Workflows

  • storage:buckets:read - needed forexecute_dql tool to read all system data stored on Grail

  • storage:logs:read - needed forexecute_dql tool to read logs for reliability guardian validations

  • storage:metrics:read - needed forexecute_dql tool to read metrics for reliability guardian validations

  • storage:bizevents:read - needed forexecute_dql tool to read bizevents for reliability guardian validations

  • storage:spans:read - needed forexecute_dql tool to read spans from Grail

  • storage:entities:read - needed forexecute_dql tool to read Entities from Grail

  • storage:events:read - needed forexecute_dql tool to read Events from Grail

  • storage:security.events:read- needed forexecute_dql tool to read Security Events from Grail

  • storage:system:read - needed forexecute_dql tool to read System Data from Grail

  • storage:user.events:read - needed forexecute_dql tool to read User events from Grail

  • storage:user.sessions:read - needed forexecute_dql tool to read User sessions from Grail

  • davis-copilot:conversations:execute - execute conversational skill (chat with Copilot)

  • davis-copilot:nl2dql:execute - execute Davis Copilot Natural Language (NL) to DQL skill

  • davis-copilot:dql2nl:execute - execute DQL to Natural Language (NL) skill

  • email:emails:send - needed forsend_email tool to send emails

  • settings:objects:read - needed for reading ownership information and Guardians (SRG) from settings

    Note: Please ensure thatsettings:objects:read is used, andnot the similarly named scopeapp-settings:objects:read.

Important: Some features requiringenvironment-api:entities:read will only work with OAuth Clients. For most use cases, Platform Tokens provide all necessary functionality.

✨ Example prompts ✨

Use these example prompts as a starting point. Just copy them into your IDE or agent setup, adapt them to your services/stack/architecture,and extend them as needed. They're here to help you imagine how real-time observability and automation work together in the MCP context in your IDE.

Basic Queries & AI Assistance

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

Advanced Incident Investigation

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 problems2. Assess user impact and affected services3. Perform cross-data source analysis (problems → spans → logs)4. Identify root cause with file/line-level precision

Cross-service failure analysis:

We have cascading failures across our microservices architecture.Analyze the entity relationships and trace the failure propagation from the initial problemthrough all downstream services. Show me the correlation timeline.

Security & Compliance Analysis

Latest-scan vulnerability assessment:

Perform a comprehensive security analysis using the latest scan data:- Check for new vulnerabilities in our production environment- Focus on critical and high-severity findings- Provide evidence-based remediation paths- Generate risk scores with team-specific guidance

Multi-cloud compliance monitoring:

Run a compliance assessment across our AWS, Azure, and Kubernetes environments.Check for configuration drift and security posture changes in the last 24 hours.

DevOps & SRE Automation

Deployment health gate analysis:

Our latest deployment is showing performance degradation.Run deployment health gate analysis with:- Golden signals monitoring (Rate, Errors, Duration, Saturation)- SLO/SLI validation with error budget calculations- Generate automated rollback recommendation if needed

Infrastructure as Code remediation:

Generate Infrastructure as Code templates to remediate the current alert patterns.Include automated scaling policies and resource optimization recommendations.

Deep Transaction Analysis

Business logic error investigation:

Our payment processing is showing intermittent failures.Perform advanced transaction analysis:- Extract exception details with full stack traces- Correlate with deployment events and ArgoCD changes- Identify the exact code location causing the issue

Performance correlation analysis:

Analyze the performance impact across our distributed system for the slow checkout flow.Show me the complete trace analysis with business context and identify bottlenecks.

Traditional Use Cases (Enhanced)

Find open vulnerabilities on production, setup alert:

I have this code snippet here in my IDE, where I get a dependency vulnerability warning for my code.Check if I see any open vulnerability/cve on production.Analyze a specific production problem.Setup a workflow that sends Slack alerts to the #devops-alerts channel when availability problems occur.

Debug intermittent 503 errors:

Our load balancer is intermittently returning 503 errors during peak traffic.Pull all recent problems detected for our front-end services andrun a query to correlate error rates with service instance health indicators.I suspect we have circuit breakers triggering, but need confirmation from the telemetry data.

Correlate memory issue with logs:

There's a problem with high memory usage on one of our hosts.Get the problem details and then fetch related logs to help understandwhat's causing the memory spike? Which file in this repo is this related to?

Trace request flow analysis:

Our users are experiencing slow checkout processes.Can you execute a DQL query to show me the full request trace for our checkout flow,so I can identify which service is causing the bottleneck?

Analyze Kubernetes cluster events:

Our application deployments seem to be failing intermittently.Can you fetch recent events from our "production-cluster"to help identify what might be causing these deployment issues?

Troubleshooting

Authentication Issues

In most cases, authentication issues are related to missing scopes or invalid tokens. Please ensure that you have added all required scopes as listed above.

For Platform Tokens:

  1. Verify your Platform Token has all the necessary scopes listed in the "Scopes for Authentication" section
  2. Ensure your token is valid and not expired
  3. Check that your user has the required permissions in your Dynatrace Environment

For OAuth Clients:In case of OAuth-related problems, you can troubleshoot SSO/OAuth issues based on ourDynatrace Developer Documentation.

It is recommended to test access with the following API (which requires minimal scopesapp-engine:apps:run andapp-engine:functions:run):

  1. Use OAuth Client ID and Secret to retrieve a Bearer Token (only valid for a couple of minutes):
curl --request POST'https://sso.dynatrace.com/sso/oauth2/token' \  --header'Content-Type: application/x-www-form-urlencoded' \  --data-urlencode'grant_type=client_credentials' \  --data-urlencode'client_id={your-client-id}' \  --data-urlencode'client_secret={your-client-secret}' \  --data-urlencode'scope=app-engine:apps:run app-engine:functions:run'
  1. Useaccess_token from the response of the above call as the bearer-token in the next call:
curl -X GET https://abc12345.apps.dynatrace.com/platform/management/v1/environment \  -H'accept: application/json' \  -H'Authorization: Bearer {your-bearer-token}'
  1. You should retrieve a result like this:
{"environmentId":"abc12345","createTime":"2023-01-01T00:10:57.123Z","blockTime":"2025-12-07T00:00:00Z","state":"ACTIVE"}

Problem accessing data on Grail

Grail has a dedicated section about permissions in the Dynatrace Docs. Please refer tohttps://docs.dynatrace.com/docs/discover-dynatrace/platform/grail/data-model/assign-permissions-in-grail for more details.

Telemetry

The Dynatrace MCP Server includes sending Telemetry Data via Dynatrace OpenKit to help improve the product. This includes:

  • Server start events
  • Tool usage (which tools are called, success/failure, execution duration)
  • Error tracking for debugging and improvement

Privacy and Opt-out:

  • Telemetry isenabled by default but can be disabled by settingDT_MCP_DISABLE_TELEMETRY=true
  • No sensitive data from your Dynatrace environment is tracked
  • Only anonymous usage statistics and error information are collected
  • Usage statistics and error data are transmitted to Dynatrace’s analytics endpoint

Configuration options:

  • DT_MCP_DISABLE_TELEMETRY (boolean, default:false) - Disable Telemetry
  • DT_MCP_TELEMETRY_APPLICATION_ID (string, default:dynatrace-mcp-server) - Application ID for tracking
  • DT_MCP_TELEMETRY_ENDPOINT_URL (string, default: Dynatrace endpoint) - OpenKit endpoint URL
  • DT_MCP_TELEMETRY_DEVICE_ID (string, default: auto-generated) - Device identifier for tracking

To disable usage tracking, add this to your environment:

DT_MCP_DISABLE_TELEMETRY=true

About

Dynatrace logo

Dynatrace

Bydynatrace-oss·148

Manage and interact with the Dynatrace Platform for real-time observability and monitoring.


[8]ページ先頭

©2009-2025 Movatter.jp