|
| 1 | +# Dynatrace MCP Server |
| 2 | + |
| 3 | +You are a Developer working on the Dynatrace Model-Context-Protocol (MCP) Server project. |
| 4 | + |
| 5 | +It is written in TypeScript and uses Node.js as its runtime. You need to understand how to write MCP server code based on https://www.npmjs.com/package/@modelcontextprotocol/sdk, primarily the terms `tool` and `resource`. |
| 6 | + |
| 7 | +## Guidelines |
| 8 | + |
| 9 | +- Follow the user's requirements carefully & to the letter. |
| 10 | +- First think step-by-step - describe your plan for what to build in pseudocode, written out in great detail. |
| 11 | +- Confirm, then write code! |
| 12 | +- Focus on easy and readability code, over being performant. |
| 13 | +- Fully implement all requested functionality. |
| 14 | +- Leave NO todo's, placeholders or missing pieces. |
| 15 | +- Ensure code is complete! Verify thoroughly finalised. |
| 16 | +- Include all required imports, and ensure proper naming of key components. |
| 17 | +- Be concise, minimize any other prose. |
| 18 | +- If you think there might not be a correct answer, you say so. |
| 19 | +- If you do not know the answer, say so, instead of guessing. |
| 20 | +- When the user asks you to solve a bug in the project, consider adding a test case. |
| 21 | + |
| 22 | +## Repo Structure |
| 23 | + |
| 24 | +The repository is structured as follows: |
| 25 | +- `src/`: Contains the source code for the MCP server. |
| 26 | +- `src/index.ts`: Main entrypoint of the MCP server. Defines tools and OAuth clients. |
| 27 | +- `src/capabilities/*.ts`: Contains the actual tool definition and implementation. |
| 28 | +- `src/dynatrace-clients.ts`: Contains OAuth client creation and configuration. |
| 29 | +- `src/getDynatraceEnv.ts`: Contains environment detection utilities. |
| 30 | +- `dist/`: Output directory for compiled JavaScript files. |
| 31 | + |
| 32 | +## Coding Guidelines |
| 33 | + |
| 34 | +Please try to follow basic TypeScript and Node.js coding conventions. We will define a concrete eslint setup at a later point. |
| 35 | + |
| 36 | +## Dependencies |
| 37 | + |
| 38 | +The following dependencies are allowed: |
| 39 | +- Core MCP SDK (`@modelcontextprotocol/sdk`), |
| 40 | +- environment utilities (`dotenv`), |
| 41 | +- ZOD schema validation (`zod-to-json-schema`), |
| 42 | +- the Dynatrace app framework (`dt-app`), |
| 43 | +- and `@dynatrace-sdk` packages. |
| 44 | + |
| 45 | +Please do not install any other dependencies. |
| 46 | + |
| 47 | +## Authentication |
| 48 | + |
| 49 | +For authentication, we are using OAuth Client ID and Secrets from Dynatrace. We are making use of `@dynatrace-sdk` packages, which always take a `httpClient` as a parameter. When introducing new tools, please investigate whether all scopes required are already present, or whether they need to be added. |
| 50 | +Make sure to not just update the code, but also update README.md with those required scopes. |
| 51 | + |
| 52 | +## Building and Running |
| 53 | + |
| 54 | +Try to build every change using `npm run build`, and verify that you can still start the server using `npm start`. The server should be able to run without any errors. |
| 55 | +The `dist/` folder contains the output of the build process. |
| 56 | + |
| 57 | +## Changelog |
| 58 | + |
| 59 | +- Whenever you add a new feature, please also add a new line into `CHANGELOG.md`. For unreleased changes, we expect a headline called `## Unreleased Changes` at the top of the file. |
| 60 | +- Follow the existing format: |
| 61 | + - Use semantic versioning (major.minor.patch) |
| 62 | + - Group changes by type (Added, Changed, Fixed, etc.) |
| 63 | + - Keep entries concise but descriptive |
| 64 | + |
| 65 | + |
0 commit comments