Monti APM MCP Server

Monti APM MCP Server

Integrates Monti APM with the Model Context Protocol to provide AI assistants with access to Meteor application performance monitoring data. It enables users to monitor system metrics, analyze method execution traces, and track application errors through natural language.

Category
访问服务器

README

SDUI MCP Monti APM Server

A Model Context Protocol (MCP) server that integrates with Monti APM to provide AI assistants with access to your Meteor application's performance monitoring data.

Overview

This MCP server exposes Monti APM data through the Model Context Protocol, allowing AI assistants like Claude Desktop to:

  • Retrieve system metrics (RAM, CPU, network, disk usage)
  • Query method execution traces for performance analysis
  • Access application errors and exceptions
  • Execute custom GraphQL queries against the Monti APM API
  • Get application information and configuration

Features

  • 🔐 Secure Authentication: JWT-based authentication with Monti APM API
  • 📊 System Metrics: Real-time performance monitoring data
  • 🔍 Method Tracing: Detailed execution traces for performance debugging
  • 🚨 Error Monitoring: Application errors and exceptions tracking
  • 🛠️ Custom Queries: Execute custom GraphQL queries against Monti APM
  • 📝 Comprehensive Logging: Structured logging with Winston
  • 🔄 Resource Caching: Efficient data retrieval with smart caching

Prerequisites

  • Node.js 18+
  • Existing Meteor application with Monti APM monitoring configured
  • Monti APM App ID and App Secret credentials

Installation

1. Clone and Install Dependencies

git clone <repository-url>
cd sdui-mcp-monti-apm
npm install

2. Environment Configuration

Copy the example environment file and configure your credentials:

cp .env.example .env

Edit .env with your Monti APM credentials:

# Monti APM Configuration
MONTI_APP_ID=your_app_id_here
MONTI_APP_SECRET=your_app_secret_here
MONTI_API_URL=https://api.montiapm.com/core
MONTI_AUTH_URL=https://api.montiapm.com/auth

# Server Configuration  
PORT=4002
NODE_ENV=development

# Logging
LOG_LEVEL=info
LOG_FILE=./logs/mcp-monti.log

3. Build the Project

npm run build

4. Test the Server

npm start

Usage

With Claude Desktop

Add the server to your Claude Desktop configuration file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "monti-apm": {
      "command": "node",
      "args": ["/path/to/sdui-mcp-monti-apm/dist/index.js"],
      "env": {
        "MONTI_APP_ID": "your_app_id",
        "MONTI_APP_SECRET": "your_app_secret"
      }
    }
  }
}

Available Tools

1. Get System Metrics

getSystemMetrics(metric: 'RAM_USAGE' | 'CPU_USAGE' | 'NETWORK_IN' | 'NETWORK_OUT' | 'DISK_USAGE')

Retrieve system performance metrics with optional filtering by host and time range.

2. Get Method Traces

getMethodTraces(options?: { minDuration, maxDuration, host, userId, limit, since, until })

Analyze method execution traces to identify performance bottlenecks.

3. Get Application Errors

getErrors(options?: { limit, since, until, host, resolved })

Retrieve application errors and exceptions for debugging.

4. Run Custom Query

runMontiQuery(query: string, variables?: object)

Execute custom GraphQL queries against the Monti APM API.

5. Get App Info

getAppInfo()

Retrieve basic information about your monitored application.

6. Get Available Hosts

getAvailableHosts()

List all monitored hosts to identify development vs production deployments.

Host Filtering for Multi-Environment Monitoring

This MCP server supports filtering data by deployment host, perfect for separating development and production monitoring:

// List available hosts
getAvailableHosts()
// Returns: Development hosts (e.g., "MBPvonJMichael2.pioneers") and Production hosts

// Development environment monitoring
getSystemMetrics({host: "MBPvonJMichael2.pioneers", metric: "RAM_USAGE"})
getMethodTraces({host: "MBPvonJMichael2.pioneers", limit: 20})
getErrors({host: "MBPvonJMichael2.pioneers", limit: 10})

// Production environment monitoring
getSystemMetrics({host: "plaiground01-plAIground", metric: "RAM_USAGE"})
getMethodTraces({host: "plaiground01-plAIground", limit: 20})
getErrors({host: "plaiground01-plAIground", limit: 10})

// Compare CPU usage across environments
getSystemMetrics({host: "MBPvonJMichael2.pioneers", metric: "CPU_USAGE"})      // Dev
getSystemMetrics({host: "plaiground01-plAIground", metric: "CPU_USAGE"})       // Prod

Available Resources

  • monti://metric/{metric_type} - Access cached metric data
  • monti://trace/{trace_id} - Individual method trace details
  • monti://error/{error_id} - Specific error details
  • monti://app - Application information

Development

Scripts

# Development with hot reload
npm run dev

# Build for production
npm run build

# Start production server
npm start

# Lint code
npm run lint

# Format code
npm run format

Project Structure

src/
├── lib/
│   ├── logger.ts          # Winston logging configuration
│   ├── montiAuth.ts       # JWT authentication with Monti APM
│   └── montiClient.ts     # GraphQL client for Monti API
├── mcp/
│   └── schema.ts          # MCP tools and resources definitions
├── server.ts              # Main MCP server implementation
└── index.ts              # Application entry point

Security Considerations

  • Environment Variables: Never commit .env files containing credentials
  • Token Caching: JWT tokens are cached securely and refreshed automatically
  • Error Handling: Sensitive information is not exposed in error messages
  • Logging: Credentials are never logged in plain text

Configuration Options

Variable Description Default
MONTI_APP_ID Your Monti APM App ID Required
MONTI_APP_SECRET Your Monti APM App Secret Required
MONTI_API_URL Monti APM GraphQL API endpoint https://api.montiapm.com/core
MONTI_AUTH_URL Monti APM authentication endpoint https://api.montiapm.com/auth
PORT Server port (not used in MCP mode) 4002
NODE_ENV Environment mode development
LOG_LEVEL Logging level info
LOG_FILE Log file path ./logs/mcp-monti.log
DEV_HOST_PATTERNS Development host patterns (comma-separated) mbp,macbook,pioneers
DEFAULT_HOST Default host filter for tools None
DEFAULT_ENV_MODE Default environment mode (dev, prod, all) all

Troubleshooting

Authentication Issues

If you're getting authentication errors:

  1. Verify your MONTI_APP_ID and MONTI_APP_SECRET are correct
  2. Check that your Meteor app is properly configured with Monti APM
  3. Ensure the credentials have appropriate permissions

Connection Issues

For API connection problems:

  1. Check your internet connection and firewall settings
  2. Verify the API URLs are accessible
  3. Check the server logs for detailed error messages

MCP Integration Issues

If Claude Desktop isn't recognizing the server:

  1. Verify the configuration file syntax is correct
  2. Check that the path to the built server is correct
  3. Restart Claude Desktop after configuration changes

Contributing

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

License

MIT License - see LICENSE file for details.

Support

For issues specific to this MCP server, please open a GitHub issue.

For Monti APM support, visit https://docs.montiapm.com.

Related Projects

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选