Skip to content

Commit 2ee653d

Browse files
authored
Merge branch 'main' into feature/dql-rules-improvements
2 parents a0bb615 + dcd01a7 commit 2ee653d

12 files changed

+102
-100
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
run: npm run prettier
3232

3333
- name: Run tests
34-
run: npm run test
34+
run: npm run test:unit
3535

3636
- name: Build
3737
run: npm run build

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@
22

33
## Unreleased changes
44

5-
- Added support for Authorization via Platform Tokens via environment variable `DT_PLATFORM_TOKENS`
5+
- Removed unneeded scopes `environment-api:slo:read` (no tool is using this) and `environment-api:metrics:read` (anyway handled via execute DQL tool)
6+
7+
## 0.5.0 (Release Candidate 2)
8+
9+
- Improved "List Problems" tool to use a DQL statement to retrieve data from Dynatrace, and provide better next steps
10+
- Removed "Get Problem Details" tool, as the same can be achieved with a simple "execute_dql" call
11+
- Removed scope `environment-api:problems:read` as it's no longer needed
12+
13+
## 0.5.0 (Release Candidate 1)
14+
15+
- Added support for Authorization via Platform Tokens via environment variable `DT_PLATFORM_TOKEN`
616
- Added tools to translate between natural language and DQL via Davis CoPilot
717
- Added tool to chat with Davis CoPilot
818

README.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Dynatrace MCP Server
22

3-
This remote MCP server allows interaction with the [Dynatrace](https://www.dynatrace.com/) observability platform.
3+
This local MCP server allows interaction with the [Dynatrace](https://www.dynatrace.com/) observability platform.
44
Bring real-time observability data directly into your development workflow.
55

66
<img width="1046" alt="image" src="/assets/dynatrace-mcp-arch.png" />
@@ -113,12 +113,12 @@ This configuration should be stored in `<your-repo>/.amazonq/mcp.json`.
113113

114114
## Environment Variables
115115

116-
You can set up authentication via **OAuth Client** or **Platform Tokens** via the following environment variables:
116+
You can set up authentication via **OAuth Client** or **Platform Tokens** (v0.5.0 and newer) via the following environment variables:
117117

118118
- `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`)
119119
- `OAUTH_CLIENT_ID` (string, e.g., `dt0s02.SAMPLE`) - Dynatrace OAuth Client ID
120120
- `OAUTH_CLIENT_SECRET` (string, e.g., `dt0s02.SAMPLE.abcd1234`) - Dynatrace OAuth Client Secret
121-
- `DT_PLATFORM_TOKEN` (string, e.g., `dt0s16.SAMPLE.abcd1234`) - Dynatrace Platform Token (limited support as not all scopes are available)
121+
- With v0.5.0 and newer: `DT_PLATFORM_TOKEN` (string, e.g., `dt0s16.SAMPLE.abcd1234`) - Dynatrace Platform Token (limited support, as not all scopes are available; see below)
122122

123123
For more information, please have a look at the documentation about
124124
[creating an Oauth Client in Dynatrace](https://docs.dynatrace.com/docs/manage/identity-access-management/access-tokens-and-oauth-clients/oauth-clients), as well as
@@ -134,11 +134,8 @@ Depending on the features you are using, the following scopes are needed:
134134

135135
- `app-engine:apps:run` - needed for almost all tools
136136
- `app-engine:functions:run` - needed for for almost all tools
137-
- `environment-api:security-problems:read` - needed for reading security problems (currently not available for Platform Tokens)
138-
- `environment-api:entities:read` - read monitored entities (currently not available for Platform Tokens)
139-
- `environment-api:problems:read` - get problems (currently not available for Platform Tokens)
140-
- `environment-api:metrics:read` - read metrics (currently not available for Platform Tokens)
141-
- `environment-api:slo:read` - read SLOs (currently not available for Platform Tokens)
137+
- `environment-api:security-problems:read` - needed for reading security problems (_currently not available for Platform Tokens_)
138+
- `environment-api:entities:read` - read monitored entities (_currently not available for Platform Tokens_)
142139
- `automation:workflows:read` - read Workflows
143140
- `automation:workflows:write` - create and update Workflows
144141
- `automation:workflows:run` - run Workflows
@@ -184,7 +181,7 @@ fetch logs | filter dt.source_entity == 'SERVICE-123' | summarize count(), by:{s
184181
How can I investigate slow database queries in Dynatrace?
185182
```
186183

187-
**Find open vulnerabilities on production, setup alert.**
184+
**Find open vulnerabilities on production, setup alert:**
188185

189186
```
190187
I have this code snippet here in my IDE, where I get a dependency vulnerability warning for my code.
@@ -193,7 +190,7 @@ Analyze a specific production problem.
193190
Setup a workflow that sends Slack alerts to the #devops-alerts channel when availability problems occur.
194191
```
195192

196-
**Debug intermittent 503 errors.**
193+
**Debug intermittent 503 errors:**
197194

198195
```
199196
Our load balancer is intermittently returning 503 errors during peak traffic.
@@ -202,23 +199,23 @@ run a query to correlate error rates with service instance health indicators.
202199
I suspect we have circuit breakers triggering, but need confirmation from the telemetry data.
203200
```
204201

205-
**Correlate memory issue with logs.**
202+
**Correlate memory issue with logs:**
206203

207204
```
208205
There's a problem with high memory usage on one of our hosts.
209206
Get the problem details and then fetch related logs to help understand
210207
what's causing the memory spike? Which file in this repo is this related to?
211208
```
212209

213-
**Trace request flow analysis.**
210+
**Trace request flow analysis:**
214211

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

221-
**Analyze Kubernetes cluster events.**
218+
**Analyze Kubernetes cluster events:**
222219

223220
```
224221
Our application deployments seem to be failing intermittently.
@@ -285,7 +282,7 @@ First, enable Copilot for your Workspace `.vscode/settings.json`:
285282
}
286283
```
287284

288-
and make sure that you are using Agent Mode in CoPilot.
285+
and make sure that you are using Agent Mode in Copilot.
289286

290287
Second, add the MCP to `.vscode/mcp.json`:
291288

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@dynatrace-oss/dynatrace-mcp-server",
3-
"version": "0.4.0",
3+
"version": "0.5.0-rc.2",
44
"description": "Model Context Protocol (MCP) server for Dynatrace",
55
"keywords": [
66
"Dynatrace",

src/capabilities/execute-dql.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { HttpClient } from '@dynatrace-sdk/http-client';
2-
import { QueryExecutionClient, QueryAssistanceClient, QueryResult } from '@dynatrace-sdk/client-query';
2+
import { QueryExecutionClient, QueryAssistanceClient, QueryResult, ExecuteRequest } from '@dynatrace-sdk/client-query';
33

44
export const verifyDqlStatement = async (dtClient: HttpClient, dqlStatement: string) => {
55
const queryAssistanceClient = new QueryAssistanceClient(dtClient);
@@ -13,17 +13,21 @@ export const verifyDqlStatement = async (dtClient: HttpClient, dqlStatement: str
1313
return response;
1414
};
1515

16+
/**
17+
* Execute a DQL statement against the Dynatrace API.
18+
* If the result is immediately available, it will be returned.
19+
* If the result is not immediately available, it will poll for the result until it is available.
20+
* @param dtClient
21+
* @param body - Contains the DQL statement to execute, and optional parameters like maxResultRecords and maxResultBytes
22+
* @returns the result without metadata and without notifications, or undefined if the query failed or no result was returned.
23+
*/
1624
export const executeDql = async (
1725
dtClient: HttpClient,
18-
dqlStatement: string,
26+
body: ExecuteRequest,
1927
): Promise<QueryResult['records'] | undefined> => {
2028
const queryExecutionClient = new QueryExecutionClient(dtClient);
2129

22-
const response = await queryExecutionClient.queryExecute({
23-
body: {
24-
query: dqlStatement,
25-
},
26-
});
30+
const response = await queryExecutionClient.queryExecute({ body });
2731

2832
if (response.result) {
2933
// return response result immediately

src/capabilities/find-monitored-entity-by-name.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const findMonitoredEntityByName = async (dtClient: HttpClient, entityName
88
| append [fetch dt.entity.process_group | search "*${entityName}*" | fieldsAdd entity.type]
99
| append [fetch dt.entity.cloud_application | search "*${entityName}*" | fieldsAdd entity.type]`;
1010

11-
const dqlResponse = await executeDql(dtClient, dql);
11+
const dqlResponse = await executeDql(dtClient, { query: dql });
1212

1313
if (dqlResponse && dqlResponse.length > 0) {
1414
let resp = 'The following monitored entities were found:\n';

src/capabilities/get-events-for-cluster.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ export const getEventsForCluster = async (dtClient: HttpClient, clusterId: strin
99
dql = `fetch events | filter isNotNull(k8s.cluster.uid)`;
1010
}
1111

12-
return executeDql(dtClient, dql);
12+
return executeDql(dtClient, { query: dql });
1313
};

src/capabilities/get-logs-for-entity.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import { executeDql } from './execute-dql';
44
export const getLogsForEntity = async (dtClient: HttpClient, entityId: string) => {
55
const dql = `fetch logs | filter dt.source_entity == "${entityId}"`;
66

7-
return executeDql(dtClient, dql);
7+
return executeDql(dtClient, { query: dql });
88
};

src/capabilities/get-problem-details.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)