How shashivj/dynatrace-mcp works
Project type and purpose
• This is a Node.js/TypeScript based “MCP server” that exposes Dynatrace observability data and automation workflows to MCP-aware clients (VS Code, Claude, Amazon Q CLI, etc.) over STDIO.
• It implements a small command-line microservice that routes incoming MCP requests to capability handlers, invokes the Dynatrace REST APIs (and optionally Slack) and returns results in the MCP protocol.
File structure
• Top-level files:
• package.json / tsconfig.json → Node/TypeScript config & dependencies
• .env.template → lists required OAuth and feature flags
• src/index.ts → main entrypoint that wires MCP server, parses STDIO messages, dispatches to handlers
• src/dynatrace-clients.ts → HTTP clients for Dynatrace APIs (authentication, fetch, execute DQL, workflows, etc.)
• src/capabilities/*.ts → one file per capability (list-problems, get-logs, send-slack-message, etc.)
• No database, no frontend – it’s purely a CLI microservice interacting with external APIs.
Key insights from README
• The project’s core responsibilities:
• Authenticate with Dynatrace OAuth
• Provide capabilities (problem/vulnerability listing, DQL queries, Slack notifications, workflow automation, ownership info)
• Integrate with Slack Connector and Dynatrace AutomationEngine
• Target environment: any MCP-aware client over STDIO.
• Environment variables control authentication and feature flags.
Main components
a. MCP Client (e.g., VS Code, Claude, Amazon Q CLI)
b. Dynatrace MCP Server
• Index.ts – MCP protocol handler
• Capability Handlers – individual modules under src/capabilities
• Dynatrace Clients – under src/dynatrace-clients.ts
c. External Services
• Dynatrace Platform APIs
• Slack API (optional, via Slack Connector)
• Dynatrace AutomationEngine (for workflows)
d. Configuration
• .env environment variables (OAuth credentials, DT_ENVIRONMENT, feature flags)
Relationships & data flow
• MCP Server → dispatch to Capability Handler → use Dynatrace Client
• Dynatrace Client ↔ Dynatrace Platform over HTTPS (OAuth token)
• If needed, Dynatrace Client → Slack Connector API or → AutomationEngine API
• Responses flow back up: Dynatrace → Capability Handler → MCP Server → STDIO → MCP Client
Architectural patterns and design principles
• Modular “Capability” pattern: one handler per feature, single-responsibility
• Adapter layer (dynatrace-clients.ts) isolates API calls & auth from business logic
• Environment-driven configuration keeps secrets outside code
• Thin protocol layer in index.ts – just routing and error handling
2. Inside, place:
• A “MCP Protocol Adapter (index.ts)” rectangle at the top
• Below it, a “Capability Handlers” cluster: show small rectangles for each handler file (list-problems, get-logs, send-slack-message, etc.)
• A shared “Dynatrace HTTP Clients” rectangle on the side