Skip to content

Commit d2f682b

Browse files
Fix duplicated open statement
1 parent 8ba28f4 commit d2f682b

File tree

3 files changed

+12
-34
lines changed

3 files changed

+12
-34
lines changed

README.md

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,11 @@ https://github.com/user-attachments/assets/25c05db1-8e09-4a7f-add2-ed486ffd4b5a
2929

3030
## Quickstart
3131

32-
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 type `stdio`.
33-
You can find more details about the configuration for different AI Assistants, Agents and MCP Clients in the [Configuration section below](#configuration).
32+
You 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).
3433

35-
Furthermore, you need your Dynatrace environment URL, e.g., `https://abc12345.apps.dynatrace.com`, as well as a [Platform Token](https://docs.dynatrace.com/docs/manage/identity-access-management/access-tokens-and-oauth-clients/platform-tokens), e.g., `dt0s16.SAMPLE.abcd1234`, with [required scopes](#scopes-for-authentication).
36-
37-
Depending on your MCP Client, you need to configure these as environment variables or as settings in the UI:
34+
Furthermore, you need to configure the URL to a Dynatrace environment:
3835

3936
- `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`)
40-
- `DT_PLATFORM_TOKEN` (string, e.g., `dt0s16.SAMPLE.abcd1234`) - **Recommended**: Dynatrace Platform Token
4137

4238
Once 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.
4339

@@ -142,7 +138,6 @@ This only works if the config is stored in the current workspaces, e.g., `<your-
142138
"command": "npx",
143139
"args": ["-y", "@dynatrace-oss/dynatrace-mcp-server@latest"],
144140
"env": {
145-
"DT_PLATFORM_TOKEN": "",
146141
"DT_ENVIRONMENT": ""
147142
}
148143
}
@@ -159,7 +154,6 @@ This only works if the config is stored in the current workspaces, e.g., `<your-
159154
"command": "npx",
160155
"args": ["-y", "@dynatrace-oss/dynatrace-mcp-server@latest"],
161156
"env": {
162-
"DT_PLATFORM_TOKEN": "",
163157
"DT_ENVIRONMENT": ""
164158
}
165159
}
@@ -178,7 +172,6 @@ The [Amazon Q Developer CLI](https://docs.aws.amazon.com/amazonq/latest/qdevelop
178172
"command": "npx",
179173
"args": ["-y", "@dynatrace-oss/dynatrace-mcp-server@latest"],
180174
"env": {
181-
"DT_PLATFORM_TOKEN": "",
182175
"DT_ENVIRONMENT": ""
183176
}
184177
}
@@ -196,7 +189,7 @@ Using `gemini` CLI directly (recommended):
196189

197190
```bash
198191
gemini extensions install https://github.com/dynatrace-oss/dynatrace-mcp
199-
export DT_PLATFORM_TOKEN=...
192+
export DT_PLATFORM_TOKEN=... # optional
200193
export DT_ENVIRONMENT=https://...
201194
```
202195

@@ -215,7 +208,6 @@ Or manually in your `~/.gemini/settings.json` or `.gemini/settings.json`:
215208
"command": "npx",
216209
"args": ["@dynatrace-oss/dynatrace-mcp-server@latest"],
217210
"env": {
218-
"DT_PLATFORM_TOKEN": "",
219211
"DT_ENVIRONMENT": ""
220212
},
221213
"timeout": 30000,
@@ -290,17 +282,15 @@ For fetching just error-logs, add `| filter loglevel == "ERROR"`.
290282

291283
## Environment Variables
292284

293-
You can set up authentication via **Platform Tokens** (recommended) or **OAuth Client** via the following environment variables:
294-
295-
- `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`)
296-
- `DT_PLATFORM_TOKEN` (string, e.g., `dt0s16.SAMPLE.abcd1234`) - **Recommended**: Dynatrace Platform Token
297-
- `OAUTH_CLIENT_ID` (string, e.g., `dt0s02.SAMPLE`) - Alternative: Dynatrace OAuth Client ID (for advanced use cases)
298-
- `OAUTH_CLIENT_SECRET` (string, e.g., `dt0s02.SAMPLE.abcd1234`) - Alternative: Dynatrace OAuth Client Secret (for advanced use cases)
299-
- `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.
285+
- `DT_ENVIRONMENT` (requierd, string, e.g., `https://abc12345.apps.dynatrace.com`) - URL to your Dynatrace Platform (do not use Dynatrace classic URLs like `abc12345.live.dynatrace.com`)
286+
- `DT_PLATFORM_TOKEN` (optional, string, e.g., `dt0s16.SAMPLE.abcd1234`) - Dynatrace Platform Token
287+
- `OAUTH_CLIENT_ID` (optional, string, e.g., `dt0s02.SAMPLE`) - Alternative: Dynatrace OAuth Client ID (for advanced use cases)
288+
- `OAUTH_CLIENT_SECRET` (optional, string, e.g., `dt0s02.SAMPLE.abcd1234`) - Alternative: Dynatrace OAuth Client Secret (for advanced use cases)
289+
- `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.
300290

301-
**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.
291+
When just providing `DT_ENVIRONMENT`, the local MCP server will try to open a browser window to authenticate against the Dynatrace SSO.
302292

303-
For more information, please have a look at the documentation about
293+
For more information about the other authentication methods, please have a look at the documentation about
304294
[creating a Platform Token in Dynatrace](https://docs.dynatrace.com/docs/manage/identity-access-management/access-tokens-and-oauth-clients/platform-tokens), as well as
305295
[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.
306296

server.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,6 @@
1919
"type": "stdio"
2020
},
2121
"environmentVariables": [
22-
{
23-
"description": "Your Dynatrace Platform Token",
24-
"isRequired": true,
25-
"format": "string",
26-
"isSecret": true,
27-
"name": "DT_PLATFORM_TOKEN"
28-
},
2922
{
3023
"description": "The URL of your Dynatrace environment (e.g. 'https://abc12345.apps.dynatrace.com')",
3124
"isRequired": true,

src/authentication/dynatrace-oauth-auth-code-flow.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ export async function performOAuthAuthorizationCodeFlow(
216216
console.error('🔐 OAuth Authorization Required');
217217
console.error('='.repeat(60));
218218
console.error('');
219+
219220
// Open the authorization URL in the default browser
220221
console.error('Trying to open the authorization URL in your default browser...');
221222
try {
@@ -226,20 +227,14 @@ export async function performOAuthAuthorizationCodeFlow(
226227
error.message,
227228
);
228229
}
230+
229231
console.error('');
230232
console.error('👉 ' + authorizationUrl);
231233
console.error('');
232234
console.error('After authorization, you will be redirected back and the server will continue automatically.');
233235
console.error('');
234236
console.error('='.repeat(60) + '\n');
235237

236-
// Open the authorization URL in the default browser
237-
try {
238-
open(authorizationUrl);
239-
} catch (error: any) {
240-
console.error('Failed to open browser automatically. Please open the URL manually:', error.message);
241-
}
242-
243238
// Wait for the authorization code
244239
const { code, state: receivedState } = await waitForAuthorizationCode();
245240

0 commit comments

Comments
 (0)