JV

juehang/vscode-mcp-server

开发工具

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

392 stars 85 forks 质量 69 趋势 20MIT

MCP服务器将VS Code编辑功能暴露给大型语言模型以进行AI编码

概览

一个Visual Studio Code扩展(可在市场上提供),允许Claude和其他MCP客户端直接用VS Code编程!灵感来自Serena,但利用了VS Code内置功能。非常适合扩展现有的编码代理,如Claude Code,加入VS Code专属功能(符号搜索、文档轮廓),而无需重复已有的工具。注意,该扩展使用可流式HTTP API,而非SSE API。 该扩展可以执行shell命令。这意味着存在潜在的安全风险,因此请谨慎使用,并确保你信任所用的MCP客户端,且端口不会暴露在任何情况下。认证会有所帮助,但由于MCP认证规范仍在不断变化中,目前尚未实现。 https://github.com/user-attachments/assets/20b87dfb-fc39-4710-a910-b9481dde1e90 1.

概述(AI 翻译)

一个Visual Studio Code扩展(可在市场上提供),允许Claude和其他MCP客户端直接用VS Code编程!灵感来自Serena,但利用了VS Code内置功能。非常适合扩展现有的编码代理,如Claude Code,加入VS Code专属功能(符号搜索、文档轮廓),而无需重复已有的工具。注意,该扩展使用可流式HTTP API,而非SSE API。

该扩展可以执行shell命令。这意味着存在潜在的安全风险,因此请谨慎使用,并确保你信任所用的MCP客户端,且端口不会暴露在任何情况下。认证会有所帮助,但由于MCP认证规范仍在不断变化中,目前尚未实现。

欢迎永久居民!

演示视频

https://github.com/user-attachments/assets/20b87dfb-fc39-4710-a910-b9481dde1e90

安装

  1. 从市场安装扩展或克隆该仓库,运行 npm install 和 npm run compile 来构建它。

Claude Desktop Configuration

Claude Desktop 可以配置为将该扩展作为 MCP 服务器使用。

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

README

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

VS Code MCP Server

A Visual Studio Code extension (available on the Marketplace) that allows Claude and other MCP clients to code directly in VS Code! Inspired by Serena, but using VS Code’s built-in capabilities. Perfect for extending existing coding agents like Claude Code with VS Code-specific capabilities (symbol search, document outlines) without duplicating tools they already have. Note that this extension uses the streamable HTTP API, not the SSE API.

This extension can allow for execution of shell commands. This means that there is a potential security risk, so use with caution, and ensure that you trust the MCP client that you are using and that the port is not exposed to anything. Authentication would help, but as the MCP authentication spec is still in flux, this has not been implemented for now.

PRs are welcome!

Demo Video

https://github.com/user-attachments/assets/20b87dfb-fc39-4710-a910-b9481dde1e90

Installation

  1. Install the extension from the Marketplace or clone this repository and run npm install and npm run compile to build it.

Claude Desktop Configuration

Claude Desktop can be configured to use this extension as an MCP server. To do this, your claude_desktop_config.json file should look like this:

{
  "mcpServers": {
    "vscode-mcp-server": {
        "command": "npx",
        "args": ["mcp-remote@next", "http://localhost:3000/mcp"]
    }

  }
}

I also like to use this extension in a Claude project, as it allows me to specify additional instructions for Claude. I find the following prompt to work well:

You are working on an existing codebase, which you can access using your tools. These code tools interact with a VS Code workspace.

WORKFLOW ESSENTIALS:
1. Always start exploration with list_files_code on root directory (.) first
2. CRITICAL: Run get_diagnostics_code after EVERY set of code changes before completing tasks
3. For small edits (≤10 lines): use replace_lines_code with exact original content
4. For large changes, new files, or uncertain content: use create_file_code with overwrite=true

EXPLORATION STRATEGY:
- Start: list_files_code with path='.' (never recursive on root)
- Understand structure: read key files like package.json, README, main entry points
- Find symbols: use search_symbols_code for functions/classes, get_document_symbols_code for file overviews
- Before editing: read_file_code the target file to understand current content

EDITING BEST PRACTICES:
- Small modifications: replace_lines_code (requires exact original content match)
- If replace_lines_code fails: read_file_code the target lines, then retry with correct content
- Large changes: create_file_code with overwrite=true is more reliable
- After any changes: get_diagnostics_code to check for errors
在 GitHub 查看完整 README

安装

npx mcp-remote@next http://localhost:3000/mcp
新手?先看 mcpskill.org 教程 →