TalkO11yToMe: Learning MCP Servers with Dynatrace Integration

by chiefnamingofficer

286 downloads
Not rated
GitHub

About

Learning what it means to use MCP by trying to interact with Dynatrace MCP server.

Details

Author
chiefnamingofficer
Downloads
286
Categories
Other

- Six production-ready Dynatrace tools with shared configuration
- DQL Query Polling for async log and event queries
- OAuth authentication with 5-minute bearer token lifecycle
- Support for both Grail and Classic Dynatrace environments
- Clean architecture separating shared infrastructure from tools
- Comprehensive test suite with 8 validation tests and history tracking

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name TalkO11yToMe: Learning MCP Servers with Dynatrace Integration
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Prerequisites: Node.js 18+, a Dynatrace tenant, and either an API token or OAuth client credentials. Copy the environment template (cp env/env.template env/.env.dev), edit it with your credentials, then test the configuration with node lib/demo-dotenv.js. Run the appropriate tool for your environment: node tools/grail-log-query.js for Grail tenants or node tools/classic-log-query.js for Classic tenants. Use the test suite (node tests/test-suite.js) to validate all tools.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "talko11ytome: learning mcp servers with dynatrace integration": {
            "TalkO11yToMe": {
                "command": "node",
                "args": [
                    "lib/demo-dotenv.js"
                ]
            }
        }
    }
}

McpServers

{
    "TalkO11yToMe": {
        "command": "node",
        "args": [
            "lib/demo-dotenv.js"
        ]
    }
}

TalkO11yToMe: Learning MCP Servers with Dynatrace Integration

Welcome to your MCP (Model Context Protocol) learning journey! This project will help you understand MCP servers, their use cases, and specifically how to integrate with Dynatrace tenants for powerful observability-driven AI workflows.

πŸŽ‰ PROJECT STATUS: FULLY OPERATIONAL

All 6 Dynatrace tools are now production-ready with:
- βœ… Standardized Configuration: Shared dotenv-based config eliminates 200+ lines of duplicate code
- βœ… DQL Query Polling: Proper handling of async query execution (202 β†’ poll β†’ results)
- βœ… OAuth Authentication: Working across all tools with 5-minute bearer tokens
- βœ… Real Data Retrieval: Successfully finding production problems, logs, and metrics
- βœ… Clean Architecture: lib/ vs tools/ separation for maintainability

πŸ“Š Code Quality Improvements:
- Before: 40+ lines of environment parsing per tool Γ— 6 tools = 240+ lines
- After: 6 lines using shared config Γ— 6 tools = 36 lines
- Eliminated: 204+ lines of duplicate code with enhanced validation

---

🚨 IMPORTANT: Grail vs Classic Environment Support

Your Dynatrace environment type determines which tools and configuration you need:

πŸ†• Grail Environment (Recommended - Modern Platform)

- URL Pattern: https://xxx.apps.dynatrace.com - Authentication: OAuth Bearer tokens required - API Endpoints: /platform/classic/environment-api/v2/ - Primary Tool: grail-log-query.js βœ… Production Ready - MCP Server: βœ… Ready to Build - Complete Design Available

πŸ›οΈ Classic Environment (Legacy Platform)

- URL Pattern: https://xxx.live.dynatrace.com - Authentication: API tokens OR OAuth - API Endpoints: /api/v2/ - Primary Tool: classic-log-query.js βœ… Production Ready - MCP Server: βœ… Ready to Build - Complete Design Available

πŸ“– See Environment Detection Guide below for setup details.

---

πŸ“ Project Structure

TalkO11yToMe/
β”œβ”€β”€ lib/                    # πŸ”§ Shared Infrastructure
β”‚   β”œβ”€β”€ config.js          #    β†’ Standardized dotenv configuration
β”‚   └── demo-dotenv.js     #    β†’ Configuration demonstration
β”œβ”€β”€ tools/                  # πŸš€ Production Tools (6 tools)
β”‚   β”œβ”€β”€ grail-log-query.js        #    β†’ Primary tool for Grail environments
β”‚   β”œβ”€β”€ grail-business-analytics.js #  β†’ DQL and business events (Grail)
β”‚   β”œβ”€β”€ classic-log-query.js      #    β†’ Primary tool for Classic environments
β”‚   β”œβ”€β”€ classic-api-client.js     #    β†’ Comprehensive API client (both)
β”‚   β”œβ”€β”€ dynatrace-oauth-tool.js   #    β†’ Authentication testing
β”‚   └── dynatrace-monitor.js      #    β†’ Visual monitoring dashboard
β”œβ”€β”€ tests/                  # πŸ§ͺ Comprehensive Test Suite
β”‚   β”œβ”€β”€ test-suite.js      #    β†’ Main test runner with 8 validation tests
β”‚   β”œβ”€β”€ test-config.js     #    β†’ Test configuration and scenarios
β”‚   β”œβ”€β”€ test-history.js    #    β†’ Test history tracking and analysis
β”‚   β”œβ”€β”€ results/           #    β†’ Organized timestamped test results
β”‚   └── README.md          #    β†’ Complete testing documentation
β”œβ”€β”€ docs/                   # πŸ“š Documentation
β”‚   β”œβ”€β”€ FIXES_SUMMARY.md          #    β†’ Complete technical solution summary
β”‚   β”œβ”€β”€ TOOLS_GUIDE.md            #    β†’ Detailed tool usage and examples
β”‚   β”œβ”€β”€ DYNATRACE_LOGS_SOLUTION.md #  β†’ Environment setup guide
β”‚   └── [additional guides...]
└── env/                    # πŸ” Environment Configuration
    └── .env.dev                  #    β†’ Your Dynatrace credentials

---

πŸ“š Documentation

Quick Reference

- πŸš€ Tools Guide - Complete tool documentation and usage examples - πŸ”§ Technical Solution - Detailed environment setup and troubleshooting - πŸ“Š Implementation Summary - Complete project transformation details - 🎯 AI Integration Demo - Step-by-step AI analysis examples - ⚑ Cursor IDE Integration - Practical workflows and AI-powered development patterns - πŸ€– MCP Server Design - Complete architecture and implementation plan with official TypeScript SDK

Key Sections

1. What is MCP? 2. Understanding MCP Architecture 3. Dynatrace MCP Server 4. Setup Instructions 5. Environment Detection 6. Quick Start Demo 7. Real-World Use Cases 8. Resources 9. Project Roadmap

πŸ€– What is MCP?

The Model Context Protocol (MCP) is an open standard that enables AI systems (like Claude, Cursor, VS Code Copilot) to securely connect to the tools and data your business already uses. Think of it as a "universal adapter" for AI.

Key Benefits:

- Standardized Integration: No more custom integrations for each AI tool - Secure Data Access: Controlled access to your systems - Real-time Context: AI gets up-to-date information from your production systems - Extensible: Easy to add new capabilities and data sources

πŸ—οΈ Understanding MCP Architecture

MCP consists of three main components:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚    Host     │◄────   Client    │◄────   Server    β”‚
β”‚ (AI Agent)  β”‚    β”‚(Translator) β”‚    β”‚ (Data/Tool) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

- Host: Your AI application (Claude Desktop, VS Code, etc.)
- Client: Handles communication and translates requests
- Server: Provides specific functionality (Dynatrace data, file access, APIs, etc.)

MCP Features:

1. Tools: Functions that AI can call (query metrics, create alerts, etc.)
2. Resources: Data sources AI can read (logs, dashboards, configurations)
3. Prompts: Templates for common AI interactions

πŸ” Dynatrace MCP Server

The official Dynatrace MCP server enables AI assistants to interact with your Dynatrace environment for real-time observability insights.

Capabilities:

- Problem Management: List and analyze production problems - Security Issues: Access vulnerability and security problem details - DQL Queries: Execute Dynatrace Query Language for logs and events - Slack Integration: Send alerts via Slack connectors - Workflow Automation: Set up notification workflows - Entity Ownership: Get ownership information for services

Use Cases:

- Real-time Debugging: Get production context while coding - Incident Response: AI-assisted troubleshooting with live data - Security Analysis: Correlate code vulnerabilities with production issues - Performance Optimization: Query metrics and logs in natural language

πŸš€ Setup Instructions

Prerequisites

- Node.js 18+ (we use v20.19.2 LTS) - Access to Dynatrace tenant(s) - Dynatrace API token OR OAuth client credentials - AI client (Cursor IDE recommended)

Environment Configuration

1. Copy the environment template:

cp env/env.template env/.env.dev

2. Edit env/.env.dev with your credentials:
```bash

No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.