dynatrace-cs-mcp

theharithsa/dynatrace-cs-mcp

3.1

If you are the rightful owner of dynatrace-cs-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This is the project MCP server for the CS team at Dynatrace, designed to manage business context and report on daily CS tasks.

Dynatrace CS MCP Server

A Model Context Protocol (MCP) server for the Dynatrace Customer Success team, providing multi-account support for consolidated account management portal operations and daily CS tasks.

Features

Multi-Account Architecture

  • Consolidated Operations: Execute operations across multiple Dynatrace accounts simultaneously
  • Account-Specific Credentials: Each account has its own OAuth client credentials stored in accounts.json
  • Flexible Authentication: Use specific account credentials or default account for operations
  • Unified Reporting: Get consolidated views across all active accounts

Core Capabilities

  • Account Management: Retrieve and manage Dynatrace account information across multiple accounts
  • Subscription Monitoring: Track subscriptions across all configured accounts
  • OAuth Validation: Validate credentials for individual or all accounts
  • Environment Information: Get detailed environment data using account-specific credentials
  • Professional Integration: Built with Dynatrace SDK and OpenTelemetry tracing

Tools

Individual Account Operations

  • get_environment_info: Get basic information about a Dynatrace environment
  • get_account_info: Get detailed information about a specific Dynatrace account
  • get_account_subscriptions: Get subscriptions for a specific Dynatrace account
  • validate_oauth_credentials: Validate OAuth credentials for specific or all accounts

Multi-Account Consolidated Operations

  • get_all_accounts_info: Get consolidated account information for all active accounts
  • get_all_accounts_subscriptions: Get consolidated subscriptions across all active accounts
  • list_accounts: List all configured accounts with their status

Configuration

Global Environment (.env)

# Global Dynatrace environment URL
DT_ENVIRONMENT=https://your-tenant.apps.dynatrace.com

# Fallback credentials (optional - accounts.json takes precedence)
OAUTH_CLIENT_ID=your-fallback-oauth-client-id
OAUTH_CLIENT_SECRET=your-fallback-oauth-client-secret

# Optional additional settings
SLACK_CONNECTION_ID=your-slack-connection-id
DT_PLATFORM_TOKEN=your-platform-token

Multi-Account Configuration (accounts.json)

Create an accounts.json file in the project root:

{
  "accounts": [
    {
      "accountUuid": "prod-account-uuid",
      "accountName": "Production Account",
      "oauthClientId": "prod-oauth-client-id",
      "oauthClientSecret": "prod-oauth-client-secret",
      "description": "Main production environment",
      "environment": "production", 
      "region": "us-east-1",
      "isActive": true
    },
    {
      "accountUuid": "staging-account-uuid",
      "accountName": "Staging Account",
      "oauthClientId": "staging-oauth-client-id", 
      "oauthClientSecret": "staging-oauth-client-secret",
      "description": "Staging environment for testing",
      "environment": "staging",
      "region": "us-west-2", 
      "isActive": true
    }
  ],
  "defaultAccount": "prod-account-uuid",
  "lastUpdated": "2025-08-07T00:00:00.000Z"
}

Important: Add accounts.json to your .gitignore to protect sensitive credentials.

Quick Start

Prerequisites

  • Node.js (v16 or higher)
  • npm

Installation

npm install

Development

Build the project:

npm run build

Run in development mode:

npm run dev

Start the server:

npm start

Using with VS Code

This MCP server can be debugged using VS Code:

  1. Open the project in VS Code
  2. Use the "Debug MCP Server" configuration to debug the TypeScript source
  3. Use the "Debug Built MCP Server" configuration to debug the compiled JavaScript

The MCP configuration is available in .vscode/mcp.json for integration with MCP clients.

Multi-Account OAuth Configuration

This MCP server implements enterprise-grade OAuth 2.0 authentication following Dynatrace SDK best practices:

šŸ† Professional Features

  • Advanced Token Management: Automatic refresh with 60s safety buffer
  • Axios-Based HTTP Client: Production-ready HTTP client with interceptors
  • Multi-Account Support: Manage multiple accounts from single configuration
  • Error Recovery: Automatic retry on token expiration with 401 handling
  • Performance Optimized: Token caching and connection reuse

Technical Implementation

  • OAuth 2.0 Client Credentials Flow: Industry-standard authentication
  • Request/Response Interceptors: Seamless token refresh
  • Intelligent Caching: Per-account token management with expiration tracking
  • Concurrent Processing: Batch operations across multiple accounts
  • Environment Variables: Secure configuration via dotenv

The server supports managing multiple Dynatrace accounts with their respective OAuth credentials. All account configurations are stored in a JSON file for easy management.

Setup Multiple Accounts

  1. Copy the example configuration:
cp accounts.json.example accounts.json
  1. Edit accounts.json with your real credentials:
{
  "accounts": [
    {
      "accountUuid": "your-actual-account-1-uuid",
      "accountName": "Production Account",
      "oauthClientId": "your-oauth-client-id-1", 
      "oauthClientSecret": "your-oauth-client-secret-1",
      "description": "Main production environment",
      "environment": "production",
      "region": "us-east-1",
      "isActive": true
    },
    {
      "accountUuid": "your-actual-account-2-uuid",
      "accountName": "Staging Account", 
      "oauthClientId": "your-oauth-client-id-2",
      "oauthClientSecret": "your-oauth-client-secret-2",
      "description": "Staging environment",
      "environment": "staging", 
      "region": "us-west-2",
      "isActive": true
    }
  ],
  "defaultAccount": "your-actual-account-1-uuid"
}
  1. Security: The accounts.json file is automatically ignored by git to prevent credential exposure.

Available Tools

Single Account Tools

get_account_info

Retrieves basic information about a specific Dynatrace account.

Parameters:

  • accountId (string): The Dynatrace account ID
get_account_subscriptions

Retrieves subscriptions for a specific account using provided credentials.

Parameters:

  • accountUuid (string): The Dynatrace account UUID
  • oauthClientId (string): OAuth Client ID for authentication
  • oauthClientSecret (string): OAuth Client Secret for authentication
validate_oauth_credentials

Validates OAuth credentials for a specific account.

Parameters:

  • oauthClientId (string): OAuth Client ID
  • oauthClientSecret (string): OAuth Client Secret

Multi-Account Tools

get_all_accounts_subscriptions

Fetches subscriptions from all active accounts configured in accounts.json.

Parameters:

  • includeInactive (boolean, optional): Include inactive accounts

Returns: Aggregated results from all accounts with success/failure status for each.

get_all_accounts_info

Gets detailed information and subscriptions for all configured accounts.

Parameters:

  • includeInactive (boolean, optional): Include inactive accounts

Returns: Complete account information and subscriptions from all accounts.

validate_all_oauth_credentials

Validates OAuth credentials for all configured accounts.

Returns: Validation results for each account with success/failure details.

Available Resources

dynatrace://accounts

Provides a list of managed Dynatrace accounts in JSON format.

dynatrace://subscriptions/{accountUuid}

Provides subscription information for a specific account (requires OAuth credentials via tools).

Development

The server is built with:

  • TypeScript for type safety
  • MCP SDK for protocol implementation
  • Zod for data validation (ready for future use)

Project Structure

ā”œā”€ā”€ src/
│   └── index.ts          # Main MCP server implementation
ā”œā”€ā”€ dist/                 # Compiled JavaScript (generated)
ā”œā”€ā”€ .vscode/
│   ā”œā”€ā”€ mcp.json         # MCP client configuration
│   ā”œā”€ā”€ launch.json      # VS Code debugger configuration
│   └── tasks.json       # VS Code build tasks
ā”œā”€ā”€ package.json
ā”œā”€ā”€ tsconfig.json
└── README.md

Adding New Capabilities

  1. Add new tools in the setupToolHandlers() method
  2. Implement corresponding handler methods
  3. Add new resources in setupResourceHandlers() if needed
  4. Update this README with the new functionality

Future Enhancements

  • Integration with Dynatrace APIs
  • Authentication and authorization
  • Additional account management tools
  • Reporting and analytics capabilities
  • Caching and performance optimization

Contributing

This project is maintained by the Dynatrace Customer Success team. Please follow the coding standards and add appropriate tests for new features.

License

ISC