Debugger MCP Server

Debugger MCP Server

Provides real-time debugging, code quality monitoring, and performance insights for React/Next.js applications with features including Chrome DevTools integration, breakpoint management, complexity analysis, and live error streaming.

Category
访问服务器

README

Debugger MCP Server

A comprehensive development companion tool that provides real-time debugging, code quality monitoring, and AI-enhanced insights for React/Next.js applications via the Model Context Protocol (MCP).

🚀 Features

Traditional Debugging

  • Error Capture: Caught/uncaught errors, console errors, promise rejections
  • Chrome DevTools Integration: Full browser debugging capabilities via Puppeteer
  • Breakpoint Management: Set, remove, and manage breakpoints with analytics
  • Conditional Breakpoints: Advanced breakpoint conditions and hit count tracking
  • Logpoints: Non-intrusive debugging with dynamic log messages
  • Network Monitoring: Track API calls, failed requests, performance
  • Real-time Streaming: Live error and performance data

Code Quality Monitoring

  • Complexity Analysis: Cyclomatic complexity, function metrics, nesting depth
  • Rule Enforcement: ESLint-style rules without running separate tools
  • Pattern Detection: Naming conventions, import patterns, architecture compliance
  • File Watching: Real-time analysis on code changes

React/Next.js Specific

  • Component Analysis: State tracking, prop drilling detection
  • Hook Monitoring: useEffect dependencies, hook rule compliance
  • Performance Insights: Render times, bundle analysis, SSR monitoring
  • Build Integration: Real-time feedback during development

📦 Installation

# Clone the repository
git clone <repository-url>
cd debugger-mcp

# Install dependencies
npm install

# Build the project
npm run build

🎯 Quick Start

1. Start the MCP Server

# Development mode (with hot reload)
npm run dev

# Production mode
npm start

2. Connect to Claude Desktop

Add this to your Claude Desktop MCP configuration:

{
  "mcpServers": {
    "debugger": {
      "command": "node",
      "args": ["/path/to/debugger-mcp/dist/index.js"],
      "env": {}
    }
  }
}

3. Test the Connection

In Claude Desktop, try these commands:

# Get current debugging session info
Use the get-debug-session tool

# Check for errors
Use the get-errors tool

# Analyze code complexity
Use the analyze-complexity tool with filePath: "src/components/MyComponent.tsx"

🛠 Available MCP Tools

Tool Description Parameters
get-debug-session Get current debugging session information None
get-errors Get current errors and exceptions severity?, timeframe?
get-violations Get code quality rule violations severity?, filePath?
analyze-complexity Analyze complexity metrics for a file filePath
get-performance Get performance metrics and insights timeframe?
manage-breakpoints Set, remove, and manage debugging breakpoints action, location?, options?, breakpointId?, active?
update-config Update debugger configuration config

📡 Available MCP Resources

Resource Description URI
Error Stream Real-time stream of errors stream://errors
Violation Stream Real-time code quality violations stream://violations
Performance Stream Real-time performance metrics stream://performance

🔍 Breakpoint Management

The debugger provides comprehensive breakpoint management capabilities through the manage-breakpoints tool:

Setting Breakpoints

# Set a simple breakpoint
Use the manage-breakpoints tool with:
- action: "set"
- location: { "filePath": "src/components/App.tsx", "lineNumber": 25 }

# Set a conditional breakpoint
Use the manage-breakpoints tool with:
- action: "set"
- location: { "filePath": "src/utils/api.ts", "lineNumber": 15 }
- options: { "condition": "response.status >= 400" }

# Set a logpoint (non-intrusive debugging)
Use the manage-breakpoints tool with:
- action: "set"
- location: { "filePath": "src/hooks/useAuth.ts", "lineNumber": 30 }
- options: { "logMessage": "User login attempt: ${user.email}" }

Managing Breakpoints

# List all breakpoints
Use the manage-breakpoints tool with action: "list"

# Remove a specific breakpoint
Use the manage-breakpoints tool with:
- action: "remove"
- breakpointId: "bp-123"

# Clear all breakpoints
Use the manage-breakpoints tool with action: "clear"

# Toggle breakpoints on/off
Use the manage-breakpoints tool with:
- action: "toggle"
- active: false

Breakpoint Analytics

# Get breakpoint analytics and hit statistics
Use the manage-breakpoints tool with action: "analytics"

This provides detailed information about:

  • Total breakpoints and hit counts
  • Most frequently hit breakpoints
  • Hit statistics by file and time
  • Recent breakpoint activity

⚙️ Configuration

The debugger creates a .debugger-mcp.json configuration file with these options:

{
  "complexity": {
    "maxFileLines": 300,
    "maxFunctionComplexity": 10,
    "maxFunctionParams": 5,
    "maxNestingDepth": 4
  },
  "patterns": {
    "namingConventions": {
      "components": "^[A-Z][a-zA-Z0-9]*$",
      "hooks": "^use[A-Z][a-zA-Z0-9]*$"
    }
  },
  "watching": {
    "paths": ["src", "pages", "components"],
    "ignored": ["node_modules", ".git", "dist"]
  },
  "browser": {
    "autoConnect": true,
    "port": 9222
  },
  "breakpoints": {
    "maxRecentHits": 100,
    "autoRemoveAfterHits": null,
    "enableAnalytics": true,
    "persistBreakpoints": true,
    "logpointTimeout": 5000,
    "enableConditionalBreakpoints": true,
    "enableLogpoints": true
  }
}

🔧 Development

# Run in development mode
npm run dev

# Build the project
npm run build

# Run tests
npm test

# Lint code
npm run lint

# Format code
npm run format

📋 Architecture

┌─────────────────────────────────────────────────────────┐
│                 Debugger MCP Server                     │
├─────────────────────────────────────────────────────────┤
│  MCP Interface                                          │
│  • Tools for querying data   │  • SSE streaming         │
│  • Configuration management  │  • Real-time updates     │
├─────────────────────────────────────────────────────────┤
│  Core Debugging Engine                                  │
│  • Chrome DevTools Protocol  │  • File System Watcher   │
│  • Code Quality Analysis     │  • Performance Monitor   │
│  • Error Tracking           │  • Stream Management     │
├─────────────────────────────────────────────────────────┤
│  Real-time Communication                               │
│  • Live error streaming     │  • Configuration updates │
│  • Performance metrics      │  • Code quality alerts   │
└─────────────────────────────────────────────────────────┘

🎯 Use Cases

During Development

  • Real-time feedback on code quality as you type
  • Immediate error detection without waiting for builds
  • Performance monitoring of your React components
  • Architecture compliance checking

Code Review

  • Complexity analysis of changed files
  • Pattern compliance verification
  • Performance impact assessment

Debugging

  • Live error tracking across browser and build
  • Network request monitoring
  • Component state inspection
  • Performance bottleneck identification

🤝 Contributing

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

📄 License

MIT License - see LICENSE file for details

🆘 Support

  • Issues: Report bugs and feature requests on GitHub
  • Documentation: Check the docs/ directory for detailed guides
  • Examples: See examples/ directory for usage examples

Built with ❤️ for the React/Next.js development community

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选