VSCode MCP server

VSCode tools and resources as a Model Context Protocol (MCP) server in a VSCode extension
Back to servers
Provider
Microsoft
Release date
Feb 23, 2025
Language
TypeScript
Stats
259 stars

The VSCode MCP Server extension enables AI assistants to access your VSCode environment's diagnostic information through the Model Context Protocol (MCP). This server provides contextual data from your workspace to help AI assistants deliver more informed responses about your code.

Installation

Setting Up the VSCode Extension

  1. Install the VSCode MCP Server extension either through the Visual Studio Code Marketplace or by using a local VSIX file:

    • Option 1: Search for "VSCode MCP Server" in the Extensions view (Ctrl+Shift+X)
    • Option 2: Install from a VSIX file:
      # Press Ctrl+Shift+P (or Cmd+Shift+P on macOS)
      # Type "Extensions: Install from VSIX..."
      # Select the .vsix file
      
  2. After installation, reload VSCode using the "Developer: Reload Window" command from the Command Palette.

Connecting Claude Desktop to the MCP Server

Since Claude Desktop only supports stdio transport, but the MCP server uses SSE transport, you'll need to use a proxy:

  1. Install MCP Proxy using one of these methods:

    # Option 1: With uv (recommended)
    uv tool install mcp-proxy
    
    # Option 2: With pipx
    pipx install mcp-proxy
    
  2. Configure Claude Desktop:

    • Open Claude Desktop
    • Navigate to File > Settings > Developer tab
    • Click Edit Config to open the configuration file
    • Add the following to the mcpServers section:
    {
        "mcpServers": {
            "vscode": {
                "command": "mcp-proxy",
                "args": ["http://127.0.0.1:6010/sse"]
            }
        }
    }
    
  3. Restart Claude Desktop:

    • Use File > Exit to completely close the application (not just close the window)
    • Start Claude Desktop again

Usage

Managing the MCP Server

The MCP Server starts automatically by default, but you can manage it manually:

  • Stop the server: Open the Command Palette and run Stop MCP Server
  • Start the server: Open the Command Palette and run Start MCP Server

Configuring the Server Port

If the default port (6010) is unavailable, you can change it:

  1. Using the Command Palette:

    • Open Command Palette (Ctrl+Shift+P or Cmd+Shift+P)
    • Search for Set MCP Server Port
    • Enter your desired port number
  2. Using VSCode Settings:

    • Open Settings (File > Preferences > Settings or Ctrl+,)
    • Search for mcpServer.port
    • Set your desired port number
    • Restart VSCode

Disabling Automatic Startup

If you prefer to start the MCP server manually:

  1. Open Settings (File > Preferences > Settings or Ctrl+,)
  2. Search for mcpServer.startOnActivate
  3. Toggle it to false

Available MCP Tools

The VSCode MCP Server provides several tools that AI assistants can use:

  • code_checker: Aggregates diagnostic messages (similar to those in the Problems panel)
  • focus_editor: Opens a specific file at a designated line and column
  • search_symbol: Searches for symbols in the workspace
  • Debug session tools:
    • list_debug_sessions: Lists all active debug sessions
    • start_debug_session: Starts a new debug session
    • stop_debug_session: Stops specific debug sessions
    • restart_debug_session: Restarts a debug session

Testing the Server

You can manually test if the server is working using curl:

  1. Establish an SSE Connection:

    curl -N http://127.0.0.1:6010/sse
    

    You should see output including a session ID:

    event: endpoint
    data: /messages?sessionId=your-session-id
    
  2. Send an Initialization Request:

    curl -X POST "http://127.0.0.1:6010/messages?sessionId=your-session-id" \
    -H "Content-Type: application/json" \
    -d '{
      "jsonrpc": "2.0",
      "method": "initialize",
      "id": 0,
      "params": {
        "protocolVersion": "2024-11-05",
        "capabilities": {
          "roots": { "listChanged": true }
        },
        "clientInfo": {
          "name": "mcp",
          "version": "0.1.0"
        },
        "workspace": {
          "folders": []
        }
      }
    }'
    

Troubleshooting

  • Server Doesn't Start: Check the "MCP Server Logs" output channel for error messages
  • Port Conflicts: The server will attempt to find the next available port if the default is occupied
  • Connection Issues: Ensure your firewall isn't blocking the port
  • Claude Desktop Not Connecting: Make sure you've fully exited Claude Desktop (File > Exit) before restarting it

How to add this MCP server to 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 > MCP and click "Add new global MCP server".

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

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

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