
该项目提供工具,将语言服务器协议(LSP)功能暴露为MCP(模型上下文协议)工具
概览
该项目提供工具,将语言服务器协议(LSP)功能作为工具展示。它使 AI 客户端能够通过标准化的 MCP 工具调用程序化分析和编辑代码。 它最初是一个专注于仅用 TypeScript 编程的简单项目,后来发展成一个功能齐全的 MCP 服务器,支持 VS Code 支持的任何语言。 关于最新变更及向无头VC代码迁移的完整细节可在此处查阅 VSC-MCP 可以两种模式运行:- : 它生成一个本地 Typescript-language-server,仅支持 TypeScript/JavaScript 的 LSP。- : 利用 Gitpod 的无头 VS Code 移植,即运行于 Docker 中的 OpenVSCode Server,为任何受 VC Code 支持的语言如 Rust、Go、C#、Python 等提供更丰富的 LSP 支持。 - : 避免为每种语言单独启动本地语言服务器的麻烦。- : 继承了 VS Code 的扩展支持和高级语言功能的 API。
概述(AI 翻译)
该项目提供工具,将语言服务器协议(LSP)功能暴露为**MCP(模型上下文协议)**工具。它使AI客户端能够通过标准化的MCP工具调用程序化分析和编辑代码。
它最初是一个专注于仅用 TypeScript 编程的简单项目,后来发展成一个功能齐全的 MCP 服务器,支持 VS Code 支持的任何语言。
关于最新变更及向无头VC代码迁移的完整细节可在此处查阅
Docker 模式与 VS 代码 LSP 集成
VSC-MCP 可以运行两种模式:
- 独立模式:它生成一个本地的TypeScript语言服务器,仅为TypeScript/JavaScript提供LSP支持。
- Docker 模式:利用 Gitpod 的无头 VS Code 移植,即运行于 Docker 中的 OpenVSCode Server,为 Rust、Go、C#、Python 等 VC Code 支持的任何语言提供更丰富的 LSP 支持。
为什么是Docker Mode?
- 统一LSP:避免为每种语言单独启动本地语言服务器的麻烦。
- 丰富的扩展生态系统:继承了VS Code的扩展支持和高级语言功能的API。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
VSC-MCP
This project provides tools that expose Language Server Protocol (LSP) functionality as MCP (Model Context Protocol) tools. It enables AI clients to programmatically analyze and edit code through standardized MCP tool calls.
It started as a simple project focused on coding only with TypeScript, then evolved to a full-featured MCP server that supports any language supported by VS Code.
Full details about latest changes and migration to headless VC Code can be found here
Docker Mode & VS Code LSP Integration
VSC-MCP can run in two modes:
- Standalone Mode: It spawn a local typescript-language-server to provide LSP support ONLY for TypeScript/JavaScript.
- Docker Mode: Leverages a headless VS Code port by Gitpod, namely OpenVSCode Server, running in Docker to provide richer LSP support, for any languages supported by VC Code like Rust, Go, C#, Python, etc.
Why Docker Mode?
- Unified LSP: Avoids the hassle of launching separate local language servers for each language.
- Rich Extension Ecosystem: Inherits VS Code’s extension support and APIs for advanced language features.
- Live Editing: Open http://localhost:3000 to watch edits in real time as your AI agent interacts with MCP.
- Works without IDE: we can write and analyze code without opening any IDE.
How It Works
- OpenVSCode Server runs inside Docker, exposing port
3000(IDE UI) and5007(LSP bridge). - Required VS Code extensions are pre-installed (e.g., rust-analyzer, pyright, eslint, and the VSC-MCP extension).
- The VSC-MCP extension creates a WebSocket channel between MCP and the VS Code back-end.
- File I/O tools use direct access; LSP tools use VS Code’s internal language servers.
Installation
Prerequisites
Setup
- Clone the repository and
cdinto it. - Install dependencies
bun install - Build and start OpenVSCode Server (mount your project into the container)
PROJECT_PATH=/path/to/your/project docker-compose up - Register MCP in your AI client (example
settings.json){ "mcpServers": { "vsc-mcp": { "command": "bun", "args": ["/src/index.ts"], "env": { "USE_VSCODE_LSP": "true", "LOG_DIR": "/logs", "ALLOWED_DIRECTORIES": "/path/to/your/project" } } } }
Environment Variables
| Variable | Purpose |
安装
npx -y repomix --mcp配置
{
"mcpServers": {
"vsc-mcp": {
"command": "bun",
"args": ["<vsc_mcp_cloned_dir>/src/index.ts"],
"env": {
"USE_VSCODE_LSP": "true",
"LOG_DIR": "<vsc_mcp_cloned_dir>/logs",
"ALLOWED_DIRECTORIES": "/path/to/your/project"
}
}
}
}