MM

malvex/mcp-server-vscode

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

17 stars 9 forks 质量 70 趋势 21MIT

Give Claude Code direct access to VS Code's code navigation, error checking, and debugging tools through the Model Context Protocol.

概览

A VS Code extension that provides a Model Context Protocol (MCP) server, enabling AI assistants to interact with your VS Code environment for language intelligence, debugging, and code execution. - : Access VS Code's language server features including: - Go to definition - Find references - Diagnostics (errors and warnings) - Symbol search - Call hierarchy - : Control VS Code's debugger programmatically: - Start/stop debug sessions - Set and manage breakpoints - Step through code (into/over/out) - Inspect variables and call stacks - Evaluate expressions in debug context Download the .vsix file from Releases and install: - In VS Code: Extensions → ... menu → Install from VSIX - Or via command line: code --install-extension mcp-server-vscode-*.vsix The MCP server runs directly from GitHub using npx. Add this to your Claude config: - : ~/Library/Application Support/Claude/claude_desktop_config.json - : %APPDATA%\Claude\claude_desktop_config.json

README

以下为原文 README 节选,完整内容请查看原文。

MCP Server for VS Code

A VS Code extension that provides a Model Context Protocol (MCP) server, enabling AI assistants to interact with your VS Code environment for language intelligence, debugging, and code execution.

Features

  • Language Intelligence: Access VS Code’s language server features including:

    • Go to definition
    • Find references
    • Diagnostics (errors and warnings)
    • Symbol search
    • Call hierarchy
  • Debugging Support: Control VS Code’s debugger programmatically:

    • Start/stop debug sessions
    • Set and manage breakpoints
    • Step through code (into/over/out)
    • Inspect variables and call stacks
    • Evaluate expressions in debug context

Installation

Alpha Testing

Step 1: Install VS Code Extension

Download the .vsix file from Releases and install:

  • In VS Code: Extensions → ... menu → Install from VSIX
  • Or via command line: code --install-extension mcp-server-vscode-*.vsix

Step 2: Configure Claude Desktop

The MCP server runs directly from GitHub using npx. Add this to your Claude config:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "vscode": {
      "command": "npx",
      "args": ["github:malvex/mcp-server-vscode"]
    }
  }
}

Step 3: Restart Claude Desktop

That’s it! The VS Code tools are now available in Claude.

Configure Claude Code (CLI)

For Claude Code users, run this one-liner:

claude mcp add-json vscode '{"type":"stdio","command":"npx","args":["github:malvex/mcp-server-vscode"]}' -s user

Usage

Once installed, the extension shows the MCP server status in the VS Code status bar (bottom right).

To start the MCP server: Click on “VS Code MCP: Stopped” in the status bar. It will change to “VS Code MCP: 8991” when running.

The status bar indicates:

  • VS Code MCP: 8991 - Server is running on port 8991
  • VS Code MCP: Stopped - Server is not running

Click the status bar item to toggle the server on/off.

How It Works

┌─────────────┐     stdio      ┌──────────────────┐     HTTP      ┌─────────────┐
│   Claude    │ ◄────────────► │  MCP Standalone  │ ◄───────────► │   VS Code   │
│   Desktop   │                │      Server      │    :8991      │  Extension  │
└─────────────┘                └──────────────────┘               └─────────────┘
  1. VS Code Extension provides an HTTP API on port 8991
  2. MCP Standalone Server acts as a bridge, converting stdio ↔ HTTP
  3. Claude Desktop communicates with the standalone server via stdio

Troubleshooting

If Claude can’t connect to VS Code:

  1. Check VS Code is running with the extension active
  2. Check the status bar shows “VS Code MCP: 8991”
  3. Test the MCP server: Run npx github:malvex/mcp-server-vscode in terminal
  4. Check firewall isn’t blocking localhost:8991
在 GitHub 查看完整 README

安装

npx github:malvex/mcp-server-vscode
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "vscode": { "command": "npx", "args": ["github:malvex/mcp-server-vscode"] } } }