Dynatrace-Managed-MCP

theharithsa/Dynatrace-Managed-MCP

3.3

If you are the rightful owner of Dynatrace-Managed-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.

The Dynatrace Managed MCP Server is a comprehensive Model Context Protocol server designed for Dynatrace Managed environments, offering extensive tools and features for monitoring and managing IT infrastructure.

Tools
5
Resources
0
Prompts
0

Dynatrace Managed MCP Server

A comprehensive Model Context Protocol server for Dynatrace Managed environments


Table of Contents


Features

Production Ready

  • 39 comprehensive tools covering the complete Dynatrace API
  • Enterprise-grade error handling
  • Request tracking with UUID
  • Automatic retry logic

Full Observability

  • Built-in OpenTelemetry tracing
  • Parent-child span relationships
  • Performance metrics
  • Error tracking with stack traces

AI-First Design

  • Raw JSON responses for LLM interpretation
  • No pre-formatting - let AI handle presentation
  • Future-proof API field support
  • Universal client compatibility

Enterprise Security

  • API token authentication
  • Secure credential handling
  • Configurable timeouts
  • Comprehensive logging

Installation

Option 1: NPM (Recommended)

npm install -g @theharithsa/dynatrace-managed-mcp-server

Option 2: From Source

git clone https://github.com/theharithsa/Dynatrace-Managed-MCP.git
cd Dynatrace-Managed-MCP
npm install
npm run build

Configuration

Environment Variables

Required Variables
VariableDescriptionExample
DYNATRACE_MANAGED_URLYour Dynatrace Managed cluster URLhttps://your-cluster.dynatrace.com
DYNATRACE_ENVIRONMENT_IDEnvironment ID (UUID format)c08a8ab3-83c9-4efe-8903-73ed21722e70
DYNATRACE_API_TOKENAPI token with required permissionsdt0c01.XXXXX.YYYYY
Optional Variables
VariableDefaultDescription
REQUEST_TIMEOUT30000HTTP request timeout (ms)
MAX_RETRIES3Retry attempts for failed requests
LOG_LEVELinfoLogging level (debug, info, warn, error)
OpenTelemetry Variables
VariableDescription
OTEL_EXPORTER_OTLP_ENDPOINTOTLP endpoint URL
OTEL_EXPORTER_OTLP_HEADERSAuth headers for OTLP
OTEL_RESOURCE_ATTRIBUTESService metadata
OTEL_TRACES_EXPORTERSet to otlp to enable
OTEL_EXPORTER_OTLP_TRACES_PROTOCOLhttp/protobuf or grpc

VS Code Configuration

Create .vscode/mcp.json in your workspace:

{
  "servers": {
    "dynatrace-managed": {
      "command": "npx",
      "args": ["@theharithsa/dynatrace-managed-mcp-server"],
      "env": {
        "DYNATRACE_MANAGED_URL": "https://your-cluster.dynatrace.com",
        "DYNATRACE_ENVIRONMENT_ID": "your-environment-id",
        "DYNATRACE_API_TOKEN": "dt0c01.xxxxx"
      }
    }
  }
}

Claude Desktop Configuration

PlatformConfig File Location
Windows%APPDATA%\Claude\claude_desktop_config.json
macOS~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "dynatrace-managed": {
      "command": "npx",
      "args": ["@theharithsa/dynatrace-managed-mcp-server"],
      "env": {
        "DYNATRACE_MANAGED_URL": "https://your-cluster.dynatrace.com",
        "DYNATRACE_ENVIRONMENT_ID": "your-environment-id",
        "DYNATRACE_API_TOKEN": "dt0c01.xxxxx"
      }
    }
  }
}

Full Configuration with OpenTelemetry

{
  "mcpServers": {
    "dynatrace-managed": {
      "command": "npx",
      "args": ["@theharithsa/dynatrace-managed-mcp-server"],
      "env": {
        "DYNATRACE_MANAGED_URL": "https://your-cluster.dynatrace.com",
        "DYNATRACE_ENVIRONMENT_ID": "your-environment-id",
        "DYNATRACE_API_TOKEN": "dt0c01.xxxxx",
        "REQUEST_TIMEOUT": "30000",
        "MAX_RETRIES": "3",
        "LOG_LEVEL": "info",
        "OTEL_EXPORTER_OTLP_ENDPOINT": "https://your-tenant.live.dynatrace.com/api/v2/otlp/v1/traces",
        "OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Api-Token dt0c01.xxxxx",
        "OTEL_RESOURCE_ATTRIBUTES": "service.name=mcp-server,service.version=1.0.0",
        "OTEL_TRACES_EXPORTER": "otlp",
        "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL": "http/protobuf"
      }
    }
  }
}

Available Tools (39 Total)

Problems Management (8 tools)

ToolDescription
list_problemsList problems with filtering, time range, and pagination
get_problemGet detailed problem information including root cause
close_problemClose a problem with an optional message
add_commentAdd a comment to a problem
list_commentsList all comments on a problem
get_commentGet a specific comment by ID
update_commentUpdate an existing comment
delete_commentDelete a comment from a problem

Metrics Management (6 tools)

ToolDescription
list_metricsList available metrics with filtering
get_metricGet metric descriptor and metadata
query_metricsQuery metric data points with selectors
ingest_metricsIngest custom metrics data
delete_metricDelete a custom metric
list_unitsList available measurement units

Entity Management (5 tools)

ToolDescription
list_entitiesList monitored entities with filtering
get_entityGet detailed entity information
list_entity_typesList available entity types
get_entity_typeGet entity type schema
create_custom_deviceCreate a custom device entity

Events Management (7 tools)

ToolDescription
list_eventsList events with filtering
get_eventGet event details
ingest_eventSend custom events
list_event_typesList available event types
get_event_typeGet event type schema
list_event_propertiesList event properties
get_event_propertyGet event property details

Additional Tools

CategoryTools
Tagslist_tags - add_tags - delete_tags
Auditlist_audit_logs - get_audit_log
Securitylist_vulnerabilities - get_vulnerability_details
Discoveryfind_monitored_entity_by_name - get_monitored_entity_details - list_monitoring_states
Environmentget_unit - get_logs_for_entity - get_events_for_cluster

OpenTelemetry Integration

This server includes built-in OpenTelemetry instrumentation using @theharithsa/opentelemetry-instrumentation-mcp.

FeatureDescription
Automatic TracingEvery tool call is automatically traced
Parent-Child SpansFull distributed trace context propagation
Performance MetricsTiming and success/failure tracking
Error TrackingExceptions captured with full stack traces
Dynatrace NativeDirect OTLP export to Dynatrace

Span Attributes

AttributeDescription
mcp.tool.nameTool being executed
mcp.tool.argumentsInput parameters
mcp.tool.resultExecution result
dynatrace.environment_idTarget environment

Prompt Guides

Detailed guides for crafting effective prompts are available in the dynatrace-agent-rules/ folder:

GuideDescription
Problem management prompts
Metrics query prompts
Entity management prompts
Event handling prompts
Audit log prompts
Tag management prompts
Security prompts

Development

Prerequisites

  • Node.js 18+
  • npm 9+

Quick Start

# Install dependencies
npm install

# Build the project
npm run build

# Run in development mode
npm run dev

# Run tests
npm test

Adding New Tools

  1. Create a new file in src/capabilities/
  2. Follow the existing Zod schema pattern
  3. Register in src/index.ts
  4. Add tests in test/

API Token Permissions

Create an API token with these scopes:

ScopePurpose
problems.readRead problems
problems.writeClose problems, add comments
metrics.readQuery metrics
metrics.writeIngest metrics
entities.readRead entities
entities.writeCreate custom devices
events.readRead events
events.ingestSend custom events
auditLogs.readRead audit logs
securityProblems.readRead vulnerabilities

Troubleshooting

Connection Issues

# Test connectivity
curl -H "Authorization: Api-Token YOUR_TOKEN" \
  "https://YOUR_CLUSTER/e/YOUR_ENV/api/v2/problems"

Debug Mode

# Enable verbose logging
DEBUG=mcp:* npm start

Common Errors

ErrorSolution
401 UnauthorizedCheck API token permissions
404 Not FoundVerify environment ID and URL
ECONNREFUSEDCheck network/firewall settings

Troubleshooting

Windows: npx command not recognized

If you encounter 'dynatrace-managed-mcp-server' is not recognized as an internal or external command when running npx @theharithsa/dynatrace-managed-mcp-server, the npm global bin folder may not be in your PATH.

Solution:

  1. Add the npm global bin folder to your PATH:

    [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Users\<username>\AppData\Roaming\npm", [EnvironmentVariableTarget]::User)
    
  2. Restart VS Code or your terminal for the PATH change to take effect.

  3. Verify the installation:

    npx @theharithsa/dynatrace-managed-mcp-server --help
    

Alternative: Use the installed command directly

If you've installed the package globally, you can run it directly:

npm install -g @theharithsa/dynatrace-managed-mcp-server
dynatrace-managed-mcp-server --help

Authors


Contributing

Contributions are welcome! Please see for guidelines.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

Support


License

This project is licensed under the .


Made with ❤️ for the Dynatrace community