Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ about: Create a report to help us improve
title: ''
labels: 'bug'
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Suggest an idea for this project
title: ''
labels: 'enhancement'
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
Expand Down
4 changes: 2 additions & 2 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ It is written in TypeScript and uses Node.js as its runtime. You need to underst
## Repo Structure

The repository is structured as follows:

- `src/`: Contains the source code for the MCP server.
- `src/index.ts`: Main entrypoint of the MCP server. Defines tools and OAuth clients.
- `src/capabilities/*.ts`: Contains the actual tool definition and implementation.
Expand All @@ -36,6 +37,7 @@ Please try to follow basic TypeScript and Node.js coding conventions. We will de
## Dependencies

The following dependencies are allowed:

- Core MCP SDK (`@modelcontextprotocol/sdk`),
- environment utilities (`dotenv`),
- ZOD schema validation (`zod-to-json-schema`),
Expand All @@ -61,5 +63,3 @@ The `dist/` folder contains the output of the build process.
- Use semantic versioning (major.minor.patch)
- Group changes by type (Added, Changed, Fixed, etc.)
- Keep entries concise but descriptive


22 changes: 11 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Use Node.js # will read version from .nvmrc
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Use Node.js # will read version from .nvmrc
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

- name: Install dependencies
run: npm ci
- name: Install dependencies
run: npm ci

- name: Test
run: npm run test
- name: Test
run: npm run test

- name: Build
run: npm run build
- name: Build
run: npm run build
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Release
on:
push:
tags:
- 'v*' # Triggers on version tags like v1.0.0, v2.1.3, etc.
- 'v*' # Triggers on version tags like v1.0.0, v2.1.3, etc.

permissions:
contents: write # Required for creating releases
contents: write # Required for creating releases

jobs:
release:
Expand All @@ -15,7 +15,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for changelog generation
fetch-depth: 0 # Fetch full history for changelog generation

- name: Use Node.js # will read version from .nvmrc
uses: actions/setup-node@v4
Expand Down
18 changes: 18 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"arrowParens": "always",
"bracketSameLine": false,
"bracketSpacing": true,
"embeddedLanguageFormatting": "auto",
"htmlWhitespaceSensitivity": "strict",
"insertPragma": false,
"jsxSingleQuote": true,
"printWidth": 120,
"proseWrap": "preserve",
"quoteProps": "consistent",
"requirePragma": false,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}
22 changes: 11 additions & 11 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand Down Expand Up @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
Expand Down
75 changes: 42 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,68 +110,77 @@ A **Dynatrace OAuth Client** is needed to communicate with your Dynatrace Enviro
[creating an Oauth Client in Dynatrace](https://docs.dynatrace.com/docs/manage/identity-access-management/access-tokens-and-oauth-clients/oauth-clients),
and set up the following environment variables in order for this MCP to work:

* `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`)
* `OAUTH_CLIENT_ID` (string, e.g., `dt0s02.SAMPLE`) - Dynatrace OAuth Client ID
* `OAUTH_CLIENT_SECRET` (string, e.g., `dt0s02.SAMPLE.abcd1234`) - Dynatrace OAuth Client Secret
* OAuth Client Scopes:
* `app-engine:apps:run` - needed for environmentInformationClient
* `app-engine:functions:run` - needed for environmentInformationClient
* `hub:catalog:read` - get details about installed Apps on Dynatrace Environment
* `environment-api:security-problems:read` - needed for reading security problems
* `environment-api:entities:read` - read monitored entities
* `environment-api:problems:read` - get problems
* `environment-api:metrics:read` - read metrics
* `environment-api:slo:read` - read SLOs
* `storage:buckets:read` - Read all system data stored on Grail
* `storage:logs:read` - Read logs for reliability guardian validations
* `storage:metrics:read` - Read metrics for reliability guardian validations
* `storage:bizevents:read` - Read bizevents for reliability guardian validations
* `storage:spans:read` - Read spans from Grail
* `storage:entities:read` - Read Entities from Grail
* `storage:events:read` - Read Events from Grail
* `storage:system:read` - Read System Data from Grail
* `storage:user.events:read` - Read User events from Grail
* `storage:user.sessions:read` - Read User sessions from Grail
* `settings:objects:read` - needed for reading ownership information and Guardians (SRG) from settings

**Note**: Please ensure that `settings:objects:read` is used, and *not* the similarly named scope `app-settings:objects:read`.
- `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`)
- `OAUTH_CLIENT_ID` (string, e.g., `dt0s02.SAMPLE`) - Dynatrace OAuth Client ID
- `OAUTH_CLIENT_SECRET` (string, e.g., `dt0s02.SAMPLE.abcd1234`) - Dynatrace OAuth Client Secret
- OAuth Client Scopes:
- `app-engine:apps:run` - needed for environmentInformationClient
- `app-engine:functions:run` - needed for environmentInformationClient
- `hub:catalog:read` - get details about installed Apps on Dynatrace Environment
- `environment-api:security-problems:read` - needed for reading security problems
- `environment-api:entities:read` - read monitored entities
- `environment-api:problems:read` - get problems
- `environment-api:metrics:read` - read metrics
- `environment-api:slo:read` - read SLOs
- `storage:buckets:read` - Read all system data stored on Grail
- `storage:logs:read` - Read logs for reliability guardian validations
- `storage:metrics:read` - Read metrics for reliability guardian validations
- `storage:bizevents:read` - Read bizevents for reliability guardian validations
- `storage:spans:read` - Read spans from Grail
- `storage:entities:read` - Read Entities from Grail
- `storage:events:read` - Read Events from Grail
- `storage:system:read` - Read System Data from Grail
- `storage:user.events:read` - Read User events from Grail
- `storage:user.sessions:read` - Read User sessions from Grail
- `settings:objects:read` - needed for reading ownership information and Guardians (SRG) from settings

**Note**: Please ensure that `settings:objects:read` is used, and _not_ the similarly named scope `app-settings:objects:read`.

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

* `SLACK_CONNECTION_ID` (string) - connection ID of a [Slack Connection](https://docs.dynatrace.com/docs/analyze-explore-automate/workflows/actions/slack)
- `SLACK_CONNECTION_ID` (string) - connection ID of a [Slack Connection](https://docs.dynatrace.com/docs/analyze-explore-automate/workflows/actions/slack)

## ✨ 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.

**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 and
run 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 understand
what'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"
Expand All @@ -190,6 +199,7 @@ In case of any problems, you can troubleshoot SSO/OAuth issues based on our [Dyn
It is recommended to try access the following API (which requires minimal scopes `app-engine:apps:run` and `app-engine:functions:run`):

1. Use OAuth Client ID and Secret to retrieve a Bearer Token (only valid for a couple of minutes):

```bash
curl --request POST 'https://sso.dynatrace.com/sso/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
Expand All @@ -200,13 +210,15 @@ curl --request POST 'https://sso.dynatrace.com/sso/oauth2/token' \
```

2. Use `access_token` from the response of the above call as the bearer-token in the next call:

```bash
curl -X GET https://abc12345.apps.dynatrace.com/platform/management/v1/environment \
-H 'accept: application/json' \
-H 'Authorization: Bearer {your-bearer-token}'
```

3. You should retrieve a result like this:

```json
{
"environmentId": "abc12345",
Expand All @@ -216,35 +228,32 @@ curl -X GET https://abc12345.apps.dynatrace.com/platform/management/v1/environme
}
```


### Problem accessing data on Grail

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


## Development

For local development purposes, you can use VSCode and GitHub Copilot.

First, enable Copilot for your Workspace `.vscode/settings.json`:

```json
{
"github.copilot.enable": {
"*": true
}
}

```

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

```json
{
"servers": {
"my-dynatrace-mcp-server": {
"command": "node",
"args": [
"${workspaceFolder}/dist/index.js"
],
"args": ["${workspaceFolder}/dist/index.js"],
"envFile": "${workspaceFolder}/.env"
}
}
Expand All @@ -255,7 +264,7 @@ Third, create a `.env` file in this repository (you can copy from `.env.template

Last but not least, switch to Agent Mode in CoPilot and reload tools.


## Notes

This product is not officially supported by Dynatrace.
Please contact us via [GitHub Issues](https://github.com/dynatrace-oss/dynatrace-mcp/issues) if you have feature requests, questions, or need help.
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ git push origin vx.y.z
```

After pushing the tag, the workflow will automatically:

1. Run tests
2. Build the project
3. Generate release notes from commit history
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ["**/*.test.ts"],
testMatch: ['**/*.test.ts'],
};
Loading