Dynatrace MCP server

  • Latest Dynatrace
  • Overview
  • 5-min read

This page provides an overview of the Dynatrace Model Context Protocol (MCP) server and how you can use it to maximize your efficiency and quickly complete a variety of tasks, such as generating, executing or explaining a DQL query, with the help of an MCP client (external agent).

Currently, the MCP server supports the following use cases:

  • Generating a DQL query with generative AI
  • Explaining a DQL query with generative AI
  • Using generative AI to quickly answer product-related questions
  • Running a generated DQL query
  • Investigating problems and vulnerabilities
  • Analyzing Kubernetes events
  • Forecasting and analyzing timeseries data
  • Finding documents and troubleshooting guides
  • Resolving entity names and IDs

What is MCP?

The Dynatrace MCP server is a server that hosts tools that can be used to fulfill specific use cases. An external agent, such as GitHub CoPilot VS Code integration or Claude desktop, can then make use of the MCP server and its tools to execute a series of calls when fulfilling a user request.

To learn more about MCP servers, see What is the Model Context Protocol (MCP)?.

Server and server tools

Dynatrace provides a dynatrace-mcp server that hosts a collection of tools designed for external connections. It currently hosts the following tools:

Connect to the MCP server

You can connect to an MCP server via a URL by using the following address:

https://{tenant-name}.apps.dynatrace.com/platform-reserved/mcp-gateway/v0.1/servers/dynatrace-mcp/mcp
  • You need to provide a bearer token in the authorization header for the request to work. You can obtain the token from a Platform Token or from an OAuth client. Dynatrace doesn't support using OAuth client directly when connecting to the MCP server, so you must generate a token from the client. To learn more about generating and authorizing a bearer token, see OAuth clients.
  • The token you created will only work within the scope of your user permissions. To use the Dynatrace MCP server, you need to have all of the necessary permissions. For more information, see Platform tokens or OAuth clients, depending on the type of the token you use.

In addition to the tool permissions mentioned in Server and server tools, both the user and the token must have the following permissions to access and invoke server tools:

  • mcp-gateway:servers:invoke
  • mcp-gateway:servers:read

You can setup connections by using VS Code and its chat integration, or by using any other tool of your choice.

Use the Dynatrace MCP server in Visual Studio Code

You can connect the Dynatrace MCP server to VS Code by using the MCP client support available through GitHub Copilot Chat or any MCP‑enabled extension. Additionally, you need to generate a bearer token, configure the VS Code, and validate the setup.

To set up a proper configuration and connect the Dynatrace MCP server to the VS Code, follow the steps below:

1. Configure VS Code to use the Dynatrace MCP server

To configure VS Code for using Dynatrace MCP server:

  1. Open your workspace in VS Code.

  2. In the .vscode folder, create or open mcp.json file in your project. The resulting path should look like this: .vscode/mcp.json.

  3. Add an MCP server configuration similar to the one below:

    {
    "servers": {
    "dynatrace-mcp": {
    "url": "https://{tenant-name}.apps.dynatrace.com/platform-reserved/mcp-gateway/v0.1/servers/dynatrace-mcp/mcp",
    "headers": {
    "Authorization": "Bearer YOUR_BEARER_TOKEN_HERE"
    }
    }
    }
    }

    Replace:

    • {tenant-name} with your Dynatrace tenant identifier.
    • YOUR_BEARER_TOKEN_HERE with the token you generated earlier.
  4. Save your file changes.

  5. Select Start above the server name.

VS Code doesn't automatically refresh expired tokens. When your old token expires, you need to generate a new one and update your configuration accordingly.

For a more detailed guide on how to set up a VS Code configuration, see the official Visual Studio Code guide.

2. Verify the setup

To confirm the connection works:

  1. Open Copilot Chat in VS Code.
  2. Use ctrl+# to open the list of contexts.
  3. Select Tools.
  4. Find and select dynatrace-mcp (All tools).
  5. Enter the following prompt: Show me last 10 logs.
  6. Run the prompt.

If your configuration is correct, you will receive a response from the Dynatrace MCP server.

Related tags
Dynatrace Platform