TalkO11yToMe: Learning MCP Servers with Dynatrace Integration

by chiefnamingofficer

286 downloads Not rated yet
GitHub

About

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

Explore

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

- 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

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

- 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)

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

- 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

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

---

- 🚀 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

1. Copy the environment template:

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

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


DT_ENVIRONMENT=https://your-environment-id.live.dynatrace.com

API_TOKEN=dt0c01.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY

node lib/demo-dotenv.js

Check your Dynatrace URL to determine your environment type:

bash
https://xxx.apps.dynatrace.com ← Contains ".apps."
→ Use: grail-log-query.js (OAuth required)

bash
https://xxx.live.dynatrace.com ← Contains ".live."
→ Use: classic-log-query.js (API token supported)

bash


Before: Each tool had 40+ lines of duplicate environment parsing
After: Single shared config with dotenv standardization

javascript
// All tools now use this simple pattern:
const config = require('../lib/config');
const dt = await config.getDynatraceConfig();
// 6 lines replace 40+ lines of custom parsing

bash

node tools/grail-log-query.js "error" now-2h

node tools/classic-log-query.js search "error" now-2h

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"
        ]
    }
}

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.