MCP Diagnostics Extension

by newbpydev

Not rated
GitHub

About

A VS Code extension that provides real-time diagnostic problems like errors and warnings via the Model Context Protocol.

Details

Author
newbpydev
Categories
Developer Tools

Setup

Install MCP Diagnostics Extension in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/newbpydev/mcp-diagnostics-extension

Follow the installation instructions in the repository README, then restart your MCP client.

A VS Code extension that provides real-time diagnostic problems like errors and warnings via the Model Context Protocol.

πŸ† A production-ready VS Code extension that exposes diagnostic problems (errors, warnings, etc.) in real-time via the Model Context Protocol (MCP) for seamless consumption by AI agents and MCP-enabled tools.

- βœ… 810 Tests Passing- Comprehensive test coverage with 0 failures (1 skipped)
- βœ… 97.99% Statement Coverage- Exceeding industry standards (95%+ target)
- βœ… Production-Ready Architecture- Clean Architecture with dependency injection
- βœ… Professional CI/CD Pipeline- Multi-platform testing and automated releases
- βœ… Zero External Dependencies- Native implementations for maximum reliability

- ⚑ <2s Extension Activation- Lightning-fast startup performance
- ⚑ <500ms Diagnostic Processing- Real-time problem monitoring
- ⚑ <100ms MCP Tool Response- Instant AI agent integration
- πŸ’Ύ <50MB Memory Baseline- Efficient resource utilization
- πŸ“Š 10,000+ File Workspace Support- Enterprise-scale capability

- 🎯 Event-Driven Architecture- Loose coupling via EventEmitter patterns
- πŸ›‘οΈ Robust Error Handling- Comprehensive error recovery mechanisms
- πŸ“ˆ Performance Monitoring- Built-in metrics and optimization
- πŸ”„ Real-time Synchronization- Live diagnostic updates via MCP notifications
- 🌐 Cross-Platform Compatibility- Windows, macOS, Linux support with intelligent spawn handling

- πŸ”§ Cross-Platform Utilities- Smart platform detection and spawn option handling
- βš™οΈ Configuration Validation- Automatic validation and enhancement of MCP client configurations
- πŸ“Š Enhanced Export System- Continuous diagnostic data export for standalone MCP server integration
- 🎨 Improved Status Display- Better visual indicators and error reporting
- πŸ› οΈ Automated Setup- One-click MCP server registration across different environments

πŸš€ NEW: v1.4.0 - Auto-Server Injection & Advanced Diagnostics

- πŸ€– Automatic MCP Server Registration- One-click deployment and configuration across VS Code, Cursor, and other MCP clients
- πŸ“Š Cross-Platform Diagnostic Analysis- Enhanced TypeScript and ESLint analysis with background workspace scanning
- βš™οΈ Configuration Manager- Atomic configuration injection with backup and rollback capabilities
- πŸ”§ Server Installation Utilities- Automated bundled server deployment with version management
- πŸ› οΈ Enhanced Command System- NewconfigureServercommand for automated MCP setup
- πŸ“ˆ Improved Performance Monitoring- Advanced timer management and memory leak prevention
- 🌐 Enhanced Cross-Platform Support- Native spawn option handling for Windows, macOS, and Linux
- πŸ§ͺ Comprehensive Test Coverage- 810 tests with 97.99% coverage including E2E and integration tests

The MCP Diagnostics Extension bridges VS Code's powerful diagnostic system with the Model Context Protocol, enabling AI agents to access your code problems in real-time. Whether you're debugging TypeScript errors, ESLint warnings, or custom linter issues, this extension makes all diagnostic information instantly available to your AI tools.

- πŸ€– AI-First Development: Modern development increasingly relies on AI assistance. This extension ensures your AI tools have complete visibility into your codebase health.
- ⚑ Real-time Integration: No more manually copying error messages or explaining problems to AI tools - they see everything instantly.
- πŸ”§ Universal Diagnostics: Works with any VS Code diagnostic provider (TypeScript, ESLint, custom linters, etc.)
- πŸ“Š Enhanced Productivity: AI agents can provide more contextual help when they understand your current problems.

Before this extension, AI agents couldn't see your VS Code problems panel, making it difficult for them to:

- Understand compilation errors when suggesting fixes
- Provide relevant solutions for linting issues
- Help with project-wide diagnostic patterns
- Assist with debugging based on current error state

- πŸ” Real-time Diagnostics Monitoring: Automatically captures all diagnostic problems from VS Code's Problems panel using advanced event debouncing (300ms configurable)
- πŸ€– MCP Server Integration: Exposes diagnostics through standardized MCP tools and resources with comprehensive filtering capabilities
- ⚑ Performance Optimized: Handles large workspaces efficiently with smart caching and memory management (97.99% test coverage)
- 🏒 Multi-workspace Support: Seamlessly works with complex project structures and multiple workspace folders
- πŸ“‘ Real-time Notifications: Pushes diagnostic changes instantly to connected MCP clients with structured payloads
- 🎨 Enhanced Status Bar: Color-coded status bar with red (errors), orange (warnings), green (clean) backgrounds and real-time updates
- πŸŽ›οΈ Command Palette: Full integration with VS Code commands for server management and detailed status viewing with webview
- πŸ”§ Highly Configurable: Customizable port, debounce timing, logging options, and performance settings
- πŸš€ Automatic Registration: One-click setup with intelligent MCP server registration across different environments
- πŸ§ͺ Test Workspace: Comprehensive testing environment with intentional errors for validation (810 tests passing)
- πŸ›‘οΈ Robust Error Handling: Graceful degradation and comprehensive error recovery mechanisms
- 🌐 Cross-Platform Support: Native Windows, macOS, and Linux compatibility with platform-specific optimizations
- Open VS Code
- Go to Extensions(Ctrl+Shift+X / Cmd+Shift+X)
- Search for"MCP Diagnostics Extension"
- Click Install
- Reload VS Codeif prompted

The extension will automatically activate and register itself as an MCP server.
- Download the latest.vsixfile fromGitHub Releases
- Open VS Code
- Run command:Extensions: Install from VSIX...
- Select the downloaded file

# Clone the repository git clone https://github.com/newbpydev/mcp-diagnostics-extension.git cd mcp-diagnostics-extension # Install dependencies npm install # Compile TypeScript npm run compile # Launch Extension Development Host # Press F5 in VS Code or run: code --extensionDevelopmentPath=.

After installing from the marketplace, the extension automatically:

- βœ… Activates when VS Code starts
- βœ… Registers as an MCP server
- βœ… Starts monitoring diagnostics
- βœ… Shows status in the status bar

Look for the status bar item:$(bug) MCP: XE YW(X errors, Y warnings)

{ "mcpServers": { "vscode-diagnostics": { "command": "node", "args": ["scripts/mcp-server.js"], "cwd": "/path/to/mcp-diagnostics-extension", "env": { "NODE_ENV": "production", "MCP_DEBUG": "false" } } } }

Your AI agent can now access three powerful tools:

- getProblems- Get all diagnostics with filtering
- getProblemsForFile- Get problems for specific files
- getWorkspaceSummary- Get workspace-wide statistics

πŸš€AUTO-DEPLOYMENT & ONE-CLICK SETUP(Sprint 4 Feature)

The extension now featuresone-click automatic setupthat eliminates all manual configuration! This breakthrough feature automatically:

- βœ…Deploys bundled MCP serverto user directory with proper permissions
- βœ…Injects configurationinto Cursor IDE and other MCP clients
- βœ…Validates deploymentwith atomic operations and backup creation
- βœ…Cross-platform supportwith Windows/macOS/Linux compatibility
- βœ…Error recoverywith graceful fallback to manual setup

graph TD A[πŸ”§ User Runs Configure Server Command] --> B[πŸ“‹ Progress Notification Shown] B --> C[πŸ“¦ Deploy Bundled Server] C --> D{πŸ” Server Exists?} D -->|No| E[πŸ“‚ Create Installation Directory] D -->|Yes| F[πŸ“‹ Check Version] F -->|Newer| E F -->|Same/Older| G[βœ… Skip Deployment] E --> H[πŸ“‹ Copy Server Binary] H --> I[πŸ” Set Executable Permissions] I --> J[πŸ“„ Persist Manifest] J --> K[πŸ”§ Inject Configuration] G --> K K --> L[πŸ” Locate Config File] L --> M{πŸ“ Config Exists?} M -->|Yes| N[πŸ“‹ Load & Validate] M -->|No| O[πŸ“„ Create Default Config] N --> P[πŸ”„ Deep Merge Configurations] O --> P P --> Q[πŸ’Ύ Atomic Write Operation] Q --> R[βœ… Backup Creation] R --> S[πŸ“‹ Validate Final Config] S --> T[πŸŽ‰ Success Notification] %% Error Paths C -.->|Error| U[❌ Deployment Failed] K -.->|Error| V[❌ Configuration Failed] U --> W[πŸ“– Show Manual Setup Guide] V --> W %% Styling classDef success fill:#d4edda,stroke:#155724,color:#155724 classDef error fill:#f8d7da,stroke:#721c24,color:#721c24 classDef process fill:#cce5ff,stroke:#004085,color:#004085 class T success class U,V,W error class A,B,C,E,H,I,J,K,L,N,O,P,Q,R,S process
sequenceDiagram participant User participant ExtensionCommands participant ServerDeployment participant McpServerRegistration participant FileSystem participant VSCode User->>ExtensionCommands: Execute "Configure Server" ExtensionCommands->>VSCode: Show Progress Notification Note over ExtensionCommands,ServerDeployment: Phase 1: Server Deployment ExtensionCommands->>ServerDeployment: deployBundledServer() ServerDeployment->>FileSystem: Check installation directory FileSystem-->>ServerDeployment: Directory status ServerDeployment->>FileSystem: Atomic copy & permissions FileSystem-->>ServerDeployment: Deployment complete ServerDeployment-->>ExtensionCommands: Server path Note over ExtensionCommands,McpServerRegistration: Phase 2: Configuration Injection ExtensionCommands->>McpServerRegistration: injectConfiguration() McpServerRegistration->>FileSystem: Locate config file (priority order) FileSystem-->>McpServerRegistration: Config path McpServerRegistration->>FileSystem: Load existing config FileSystem-->>McpServerRegistration: Config data McpServerRegistration->>McpServerRegistration: Deep merge with validation McpServerRegistration->>FileSystem: Atomic write with backup FileSystem-->>McpServerRegistration: Write complete McpServerRegistration-->>ExtensionCommands: Configuration complete ExtensionCommands->>VSCode: Success notification VSCode-->>User: "MCP server configured successfully!" Note over User,VSCode: Alternative: Error Handling ExtensionCommands->>VSCode: Error notification (if failed) VSCode-->>User: Show manual setup guide
graph LR subgraph "πŸ“¦ Bundled Assets" A[scripts/mcp-server.js] B[Server Manifest] C[Configuration Template] end subgraph "πŸ”§ Core Components" D[ServerInstallUtils] E[ServerDeployment] F[McpServerRegistration] G[ExtensionCommands] end subgraph "πŸ’Ύ User Environment" H[~/.mcp-diagnostics/] I[.cursor/mcp.json] J[IDE Configuration] end subgraph "πŸ›‘οΈ Safety Features" K[Atomic Operations] L[Backup Creation] M[Version Validation] N[Permission Checks] end A --> D: Bundled Server D --> E: Installation Utils E --> F: Deployment Service F --> G: Registration Service G --> H: Deploy to User Dir F --> I: Inject Config I --> J: Configure IDE K --> E: Ensure Atomicity L --> F: Create Backups M --> E: Version Control N --> D: Security Checks %% Styling classDef bundled fill:#fff3cd,stroke:#856404,color:#856404 classDef core fill:#cce5ff,stroke:#004085,color:#004085 classDef user fill:#d4edda,stroke:#155724,color:#155724 classDef safety fill:#f8d7da,stroke:#721c24,color:#721c24 class A,B,C bundled class D,E,F,G core class H,I,J user class K,L,M,N safety
graph TD A[πŸ” Configuration Discovery] --> B[πŸ“ Check Workspace .cursor/mcp.json] B --> C{βœ… Exists?} C -->|Yes| D[🎯 Use Workspace Config] C -->|No| E[πŸ“ Check User Home .cursor/mcp.json] E --> F{βœ… Exists?} F -->|Yes| G[🏠 Use User Config] F -->|No| H[πŸ“„ Create New Configuration] D --> I[πŸ”„ Load & Parse JSON] G --> I H --> J[πŸ“‹ Generate Default Config] J --> I I --> K[βœ… Validate with Zod Schema] K --> L[πŸ”„ Deep Merge with Diagnostics Server] L --> M[πŸ’Ύ Atomic Write with Backup] %% Styling classDef primary fill:#007bff,stroke:#ffffff,color:#ffffff classDef success fill:#28a745,stroke:#ffffff,color:#ffffff classDef process fill:#17a2b8,stroke:#ffffff,color:#ffffff class D,G primary class H,J,M success class I,K,L process

The magic command that does everything automatically!

Access via Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
- Search: "MCP Diagnostics: Configure Server"
- Click: Command executes automatically
- Watch: Progress notification shows deployment status
- Result: Either success notification OR manual setup guide

- βœ… Deploys server to~/.mcp-diagnostics/mcp-server.js
- βœ… Sets proper executable permissions (Unix/Linux)
- βœ… Creates version manifest for future upgrades
- βœ… Locates your MCP configuration file (workspace β†’ user home)
- βœ… Preserves existing MCP servers during injection
- βœ… Validates configuration with JSON schema
- βœ… Creates backup before any changes
- βœ… Provides manual setup fallback if automatic fails

// All file operations are atomic to prevent corruption 1. Write to temporary file (.tmp) 2. Validate written content 3. Atomic rename to final location 4. Clean up temporary files
// Automatic backup creation before any changes - Original config β†’ config.backup - Malformed config β†’ config.malformed.backup - Restore on validation failure
// Smart version detection and upgrade handling - Compare semantic versions (1.2.3 format) - Skip deployment if same/older version - Automatic upgrade for newer versions

The auto-deployment system includes comprehensive error handling:

Sprint 4 auto-deployment meets strict performance requirements:

- ⚑Deployment Time: <2 seconds for complete setup
- ⚑Configuration Injection: <500ms including validation
- ⚑Memory Usage: <10MB additional during deployment
- ⚑File Operations: Atomic with <100ms overhead
- ⚑Cross-Platform: Universal compatibility with intelligent spawn detection

Access via Command Palette (Ctrl+Shift+P / Cmd+Shift+P):

-

MCP Diagnostics: Show Status- Opens detailed status webview with:

- Server connection status
- Problem statistics by severity and source
- File-by-file breakdown
- Workspace folder information
- Performance metrics

MCP Diagnostics: Restart Server- Restarts the MCP server with progress indication

MCP Diagnostics: Show Setup Guide- Opens comprehensive setup guide for MCP client configuration

Get all diagnostic problems with powerful filtering options:

{ "name": "getProblems", "arguments": { "filePath": "/path/to/file.ts", // Optional: filter by specific file "severity": "Error", // Optional: Error, Warning, Information, Hint "workspaceFolder": "my-project", // Optional: filter by workspace "source": "typescript", // Optional: filter by diagnostic source "limit": 100, // Optional: limit results (default: 1000) "offset": 0 // Optional: pagination offset } }
{ "content": [ { "type": "text", "text": "[{\"filePath\":\"/workspace/src/app.ts\",\"severity\":\"Error\",\"message\":\"Cannot find name 'foo'\",\"range\":{\"start\":{\"line\":10,\"character\":5},\"end\":{\"line\":10,\"character\":8}},\"source\":\"typescript\",\"workspaceFolder\":\"/workspace\",\"code\":\"2304\"}]" } ] }

πŸ“„getProblemsForFile- File-Specific Diagnostics

{ "name": "getProblemsForFile", "arguments": { "filePath": "/absolute/path/to/file.ts" } }

πŸ“ŠgetWorkspaceSummary- Workspace Statistics

Get comprehensive workspace diagnostic statistics:

{ "name": "getWorkspaceSummary", "arguments": { "groupBy": "severity" // Optional: severity, source, workspaceFolder } }
{ "content": [ { "type": "text", "text": "{\"totalProblems\":15,\"byFile\":{\"app.ts\":3,\"utils.ts\":2},\"bySeverity\":{\"Error\":5,\"Warning\":10},\"bySource\":{\"typescript\":8,\"eslint\":7},\"byWorkspace\":{\"main\":15},\"timestamp\":\"2024-01-15T10:30:00.000Z\"}" } ] }

Dynamic resources providing structured access to diagnostic data:

- diagnostics://summary- Overall workspace problems summary
- diagnostics://file/{encodedFilePath}- Problems for specific file
- diagnostics://workspace/{encodedWorkspaceName}- Problems for specific workspace

The server automatically sendsproblemsChangednotifications when diagnostics change:

{ "method": "notifications/message", "params": { "level": "info", "data": { "type": "problemsChanged", "uri": "/path/to/file.ts", "problemCount": 3, "problems": [...], "timestamp": "2024-01-15T10:30:00.000Z" } } }

Customize the extension via VS Code settings (Ctrl+,/Cmd+,):

{ "mcpDiagnostics.server.port": 6070, "mcpDiagnostics.debounceMs": 300, "mcpDiagnostics.enableDebugLogging": false, "mcpDiagnostics.enablePerformanceLogging": false, "mcpDiagnostics.maxProblemsPerFile": 1000, "mcpDiagnostics.debug.logLevel": "info", "mcpDiagnostics.showAutoRegistrationNotification": true }

The extension has achievedworld-class testing standards:

- βœ… 810 Tests Passing- Comprehensive test suite with 0 failures (1 skipped)
- βœ… 97.99% Statement Coverage- Exceeding industry standards
- βœ… 34 Test Suites- Organized, maintainable test structure across all components
- βœ… Cross-Platform Testing- Validated on Windows, macOS, and Linux environments
- βœ… Comprehensive E2E Testing- Full extension workflow validation

The extension providestwo operational modes:

πŸ”΄Real VS Code Extension(Production Mode)

- Purpose: Production use with actual VS Code diagnostics
- Data Source: Live VS Code Problems panel
- Activation: Automatic when extension is installed
- Use Case: Real development workflows with AI agents

- Package Validation:scripts/validate-package.sh- Automated package integrity checks
- Asset Conversion:scripts/convert-assets.js- Visual asset optimization utilities

The extension includestest-workspace/with intentional errors:

- example.ts: TypeScript errors (type mismatches, undefined variables, invalid assignments)
- utils.js: ESLint warnings (unused variables, style issues, best practice violations)
- Launch Extension Development Host(Press F5 in VS Code)
- Open test workspaceor any workspace with diagnostic issues
- View Problems panel(Ctrl+Shift+M) to see real diagnostics
- Use MCP toolsto query the diagnostic data
- Check status barfor live error/warning counts

# Install dependencies npm install # Run tests (810 tests) npm test # Run tests with coverage npm run test:coverage # Lint code npm run lint # Format code npm run format # Compile TypeScript npm run compile # Package extension npm run package # Run CI checks npm run ci:check

The extension provides auniversal MCP serverthat works with all major MCP-enabled environments. The server runs as a standalone Node.js process and provides real-time diagnostic data from your workspace.

All MCP clients use the same basic configuration pattern with environment-specific variations:

{ "mcpServers": { // or "servers" for some clients "vscode-diagnostics": { "command": "node", "args": ["scripts/mcp-server.js"], "cwd": "/path/to/mcp-diagnostics-extension", "env": { "NODE_ENV": "production", "MCP_DEBUG": "false" } } } }
// .cursor/mcp.json or cursor-mcp-config.json { "mcpServers": { "vscode-diagnostics": { "command": "node", "args": ["scripts/mcp-server.js"], "cwd": "/path/to/mcp-diagnostics-extension", "env": { "NODE_ENV": "production", "MCP_DEBUG": "false" } } } }
// .vscode/mcp.json { "servers": { "vscode-diagnostics": { "type": "stdio", "command": "node", "args": ["scripts/mcp-server.js"], "cwd": "/path/to/mcp-diagnostics-extension", "env": { "NODE_ENV": "production", "MCP_DEBUG": "false" } } } }
// .windsurf/mcp.json { "servers": { "vscode-diagnostics": { "command": "node", "args": ["scripts/mcp-server.js"], "cwd": "/path/to/mcp-diagnostics-extension", "env": { "NODE_ENV": "production", "MCP_DEBUG": "false" } } } }
// claude_desktop_config.json { "mcpServers": { "vscode-diagnostics": { "command": "node", "args": ["scripts/mcp-server.js"], "cwd": "/path/to/mcp-diagnostics-extension", "env": { "NODE_ENV": "production", "MCP_DEBUG": "false" } } } }
import { Client } from '@modelcontextprotocol/client'; const client = new Client({ name: 'my-client', version: '1.0.0', }); // Connect to extension await client.connect({ command: 'node', args: ['scripts/mcp-server.js'], cwd: '/path/to/mcp-diagnostics-extension', env: { NODE_ENV: 'production', MCP_DEBUG: 'false', }, }); // Use tools const problems = await client.callTool({ name: 'getProblems', arguments: { severity: 'Error' }, });

- πŸ” Real-time Diagnostics: Live TypeScript and ESLint analysis
- πŸ“Š VS Code Integration: Automatic import of VS Code Problems panel data
- ⚑ Performance Optimized: Cached results with smart refresh logic
- πŸ›‘οΈ Error Recovery: Graceful fallback when VS Code data unavailable
- πŸ”§ Configurable: Environment variables for debugging and behavior control

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.