VS Code Diagnostics MCP server

Connects to VS Code diagnostics via Debug Adapter Protocol to retrieve error messages, warnings, and diagnostic information from active workspaces for debugging workflows and automated error resolution.
Back to servers
Setup instructions
Provider
lin037
Release date
Aug 02, 2025
Language
JavaScript
Stats
6 stars

MCP Diagnostics is a specialized server designed for Trae IDE that enables AI agents to access real-time diagnostic information (errors, warnings, and hints) from your project, allowing for smarter code analysis and suggestions.

Installation

Step 1: Install the VS Code Extension

To access VS Code diagnostic information, first install the companion extension:

  1. Open VS Code
  2. Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P)
  3. Select "Extensions: Install from VSIX..."
  4. Locate the trae-diagnostics-server-0.0.1.vsix file in the diagnostics-extension directory
  5. Restart VS Code after installation

Once installed, the extension will automatically run a local server in the background to provide diagnostic data.

Step 2: Clone and Build the Project

# Clone the project
git clone https://github.com/lin037/mcp-diagnostics-trae.git
cd mcp-diagnostics

# Install dependencies
npm install

# Build the project
npm run build

Step 3: Configure in Trae

  1. Open Trae's MCP settings
  2. Choose "Add Manually"
  3. Paste the following configuration:
{
  "mcpServers": {
    "diagnostics": {
      "command": "npx",
      "args": ["-y", "/path/to/mcp-diagnostics"],
      "description": "Trae IDE Diagnostic Information Tool"
    }
  }
}

Note: Replace /path/to/mcp-diagnostics with the actual path where you cloned the project.

For example, if you cloned the project to E:/MCPWork/trae-diagnostics/mcp:

{
  "mcpServers": {
    "diagnostics": {
      "command": "npx",
      "args": [
        "-y",
        "E:/MCPWork/trae-diagnostics/mcp"
      ]
    }
  }
}

MCP Tools Reference

1. getDiagnostics()

Retrieves diagnostic information for all files in the current workspace.

Input: No parameters

{}

Output: Array of diagnostic information

[
  {
    "uri": "file:///workspace/src/index.ts",
    "diagnostics": [
      {
        "range": {
          "start": { "line": 12, "character": 5 },
          "end": { "line": 12, "character": 10 }
        },
        "severity": 1,
        "source": "typescript",
        "message": "Type 'string' cannot be assigned to type 'number'."
      }
    ]
  }
]

2. getDiagnosticsForPath(filePath)Recommended

Gets diagnostic information based on file path, with flexible path matching.

Input:

{
  "filePath": "src/index.ts"
}

Supported path formats:

  • Relative path: src/index.ts
  • Filename: index.ts
  • Filename with directory: test/TestJava.java

Output: Array of diagnostic information for matching files

Examples:

  • TypeScript file: "filePath": "src/index.ts"
  • Java file: "filePath": "TestJava.java"
  • Test file: "filePath": "test/test-errors.ts"

3. getDiagnosticsForFile(fileUri)

Gets diagnostic information for a specific file (requires full URI).

Input:

{
  "fileUri": "file:///workspace/src/index.ts"
}

Note: Must use the complete URI format starting with file:///workspace/.

4. getDiagnosticsSummary()

Gets statistical information about diagnostics.

Input: No parameters

{}

Output: Summary statistics

{
  "totalFiles": 4,
  "errors": 4,
  "warnings": 4
}

Usage Examples

Get Project Diagnostic Summary

User: "Please check the diagnostic summary for the current project"

The AI will automatically call the getDiagnosticsSummary tool.

Get All Diagnostic Details

User: "Please list all errors and warnings in the current project"

The AI will call the getDiagnostics tool.

Get Diagnostics for a Specific File

User: "Please check the issues in src/index.ts file"

The AI will call the getDiagnosticsForPath tool with the parameter {"filePath": "src/index.ts"}.

Supported Conversation Examples

  • "How many errors are in the current project?"
  • "Help me find all TypeScript type errors"
  • "List all warning messages"
  • "Check what issues are in TestJava.java file"
  • "How is the code quality in this project?"
  • "Which files need fixing?"

Diagnostic Severity Levels

  • 1 - Error ❌
  • 2 - Warning ⚠️
  • 3 - Information ℹ️
  • 4 - Hint 💡

Troubleshooting

Cannot Connect to Trae IDE

Solution:

  1. Ensure Trae IDE is running
  2. Check that the project is open in Trae
  3. Wait for the language server to complete initialization

Empty Diagnostics Returned

Possible causes:

  1. The project has no errors or warnings
  2. The language server is still analyzing
  3. The file type doesn't support diagnostics

Solution:

  • Wait a few seconds and try again
  • Make sure files are saved
  • Check if Trae shows diagnostic information

getDiagnosticsForFile Returns Empty Array

Solution:

  • Use the getDiagnosticsForPath tool (recommended)
  • Ensure you're using the correct URI format: file:///workspace/file-path
  • Call getDiagnostics first to see available file URIs

Tool Call Fails

Check:

  1. If the MCP server started properly
  2. If the network connection is working
  3. Trae's error logs

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "diagnostics" '{"command":"npx","args":["-y","mcp-diagnostics"],"description":"Trae IDE \u8bca\u65ad\u4fe1\u606f\u8bfb\u53d6\u5de5\u5177"}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "diagnostics": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-diagnostics"
            ],
            "description": "Trae IDE \u8bca\u65ad\u4fe1\u606f\u8bfb\u53d6\u5de5\u5177"
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "diagnostics": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-diagnostics"
            ],
            "description": "Trae IDE \u8bca\u65ad\u4fe1\u606f\u8bfb\u53d6\u5de5\u5177"
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later