vscode-mcp-api
Provides tools for working with Git in the VS Code workspace, including checking repository status and performing version control operations.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@vscode-mcp-apicheck the diagnostics for the current file and fix any errors"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
vscode-mcp-api(VS Code MCP 桥接)
中文 | English
本项目基于开源项目 vscode-mcp-bridge 完成。 This project is based on the open-source project vscode-mcp-bridge.
把正在运行的 VS Code 实例通过 MCP(Model Context Protocol)暴露给 AI 智能体:智能体可以读写文件、查看 LSP 诊断、执行终端命令、操作 git、进行重构——就像坐在你电脑前一样。
功能特性
27 个 MCP 工具:文件读写、可视化 Diff、LSP(诊断/定义/引用/悬停/符号)、全工作区重构、终端管理、git 状态等
双传输端点:
/sse(本地经典 SSE)+/mcp(Streamable HTTP 无状态,远程/代理环境推荐)内置 cloudflared 外网隧道:一键把本机 VS Code 暴露到公网(trycloudflare.com),让网页版/其它电脑上的智能体接入
「MCP 桥接面板」:真实输入框显示当前外网地址(自动刷新),真按钮一键复制地址 / 复制关键提示词
可选 Bearer Token 鉴权与命令白名单,控制访问面
扩展随 VS Code 启动自动运行,无需手动开启
Related MCP server: VSCode Language Server MCP Extension
安装
方式一:命令行安装 VSIX
code --install-extension "vscode-mcp-api-1.0.0.vsix" --force方式二:VS Code 界面安装
打开扩展面板(
Ctrl+Shift+X)点击面板右上角
···→ 从 VSIX 安装选择
vscode-mcp-api-1.0.0.vsix重新加载窗口(
Ctrl+Shift+P→ “重新加载窗口”)
验证安装
窗口重载后,右下角状态栏会出现 MCP :3333 字样;也可以执行健康检查:
curl http://127.0.0.1:3333/health
# {"status":"ok","version":"1.0.0","connectedAgents":0,"port":3333}端口默认 3333,如被占用会自动尝试 3333–3337。
使用一:本地智能体接入(同一台电脑)
给本机的 MCP 客户端(Claude Code、Cline、其它支持 MCP 的工具)配置:
端点 | 地址 | 说明 |
Streamable HTTP(推荐) |
| 纯请求-响应,兼容性最好 |
SSE(经典) |
| 旧版传输,本地同样可用 |
配置示例(~/.claude/mcp.json 或支持 mcpServers 的客户端):
{
"mcpServers": {
"vscode": {
"url": "http://127.0.0.1:3333/mcp"
}
}
}配置好后对智能体说“连接 MCP 并列出可用工具”,即可看到全部 27 个工具。
使用二:远程智能体接入(网页版/其它电脑)
开启外网隧道(三种方式任选):
设置中勾选
mcpServer.enableCloudflareTunnel(服务器启动时自动开启)点击状态栏「外网隧道」按钮一键开启/关闭
命令面板运行「VS Code MCP 桥接:启动/停止外网隧道」
首次使用需安装 cloudflared,扩展会提示
winget自动安装或给出下载直链隧道建立后弹出通知,点击通知上的 「打开面板」 按钮
在「MCP 桥接面板」中点击 「📋 复制关键提示词」,得到:
https://xxxx-xxxx-xxxx.trycloudflare.com/mcp
请你连接使用这个MCP,了解里面的可以用的工具,然后接下来所有对话都需要使用MCP里面的工具进行完成把上面内容直接粘贴给远程智能体(网页聊天、其它电脑上的模型)即可接入
⚠️ 远程必须使用
/mcp端点。 部分网络环境(含部分 Cloudflare 隧道线路)会缓冲 SSE 长连接的正文,表现为“/sse返回 200 但收不到 endpoint 事件”;/mcp是无状态纯请求-响应,可正常穿透。
注意:临时隧道地址在每次重启(重载窗口/重启电脑/重启隧道)后都会变化,以「MCP 桥接面板」显示的当前地址为准。
「MCP 桥接面板」入口
命令面板运行「VS Code MCP 桥接:打开管理面板」
点击状态栏
MCP :3333→ 「打开管理面板」隧道开启通知上的「打开面板」按钮
面板内含:服务器/隧道状态、外网地址输入框(自动刷新)、「复制地址」「复制关键提示词」按钮、本地地址复制。
设置项
在 VS Code 设置中搜索 mcpServer:
设置 | 默认值 | 说明 |
|
| HTTP 端口(占用时自动顺延到 3333–3337) |
| 空 | HTTP Bearer 令牌;留空不鉴权 |
|
| 自动把活动文件/选区/诊断推送给已连接的智能体 |
|
| 服务器启动时自动开启外网隧道 |
|
| 终端命令执行方式( |
|
|
|
全部命令
命令 | 功能 |
VS Code MCP 桥接:启动服务器 | 启动本地 HTTP 服务器 |
VS Code MCP 桥接:停止服务器 | 停止服务器与隧道 |
VS Code MCP 桥接:重启服务器 | 重启 |
VS Code MCP 桥接:复制连接地址 | 复制本地 |
VS Code MCP 桥接:启动/停止外网隧道 | 一键开关公网隧道 |
VS Code MCP 桥接:显示/复制外网地址 | 输入框显示当前公网地址,回车复制 |
VS Code MCP 桥接:复制关键提示词 | 复制「地址 + 使用指令」提示词 |
VS Code MCP 桥接:打开管理面板 | 打开 MCP 桥接面板 |
VS Code MCP 桥接:查看状态 / 选项 | 状态栏菜单 |
工具列表(27 个)
类别 | 工具 |
上下文感知 |
|
文件操作 |
|
LSP 导航 |
|
重构/快速修复 |
|
终端(短命令) |
|
终端(长进程) |
|
其它 |
|
安全须知
公网隧道 + 无鉴权 = 任何拿到地址的人都能操作你的 VS Code(含执行终端命令)。强烈建议设置
mcpServer.authToken,并在远程客户端配置中携带请求头:"Authorization": "Bearer <你的令牌>"execute_vscode_command默认全部禁止,仅执行allowedCommands白名单中的命令临时隧道地址虽是随机词组,但一旦泄露给他人即等同交出控制权,请勿公开分享
常见问题
Q:远程连 /sse 返回 200,却一直收不到 endpoint 事件?
隧道线路缓冲了 SSE 正文。远程一律改用 /mcp 端点(无状态请求-响应),本地两种端点均可。
Q:隧道地址变了,之前的地址失效? 临时隧道(trycloudflare.com)每次启动生成新随机地址,属正常现象。打开「MCP 桥接面板」复制最新地址即可。
Q:如何查看运行日志?
输出面板(Ctrl+Shift+U)选择「MCP 桥接」频道,包含服务器、隧道、工具调用的详细日志。
Q:端口被占用?
自动顺延 3333–3337;/health 返回中的 port 字段是实际端口。
从源码构建
npm install
npm run typecheck # 类型检查
npm run build # esbuild 打包到 out/extension.js
npx vsce package --no-dependencies # 生成 VSIXvscode-mcp-api (VS Code MCP Bridge)
中文 | English
Expose your running VS Code instance to AI agents over MCP (Model Context Protocol): agents can read and write files, inspect LSP diagnostics, run terminal commands, work with git, and refactor — as if they were sitting at your computer.
Features
27 MCP tools: file I/O, visual diff, LSP (diagnostics / definition / references / hover / symbols), workspace-wide refactoring, terminal management, git status and more
Dual transport endpoints:
/sse(classic SSE for local use) and/mcp(stateless Streamable HTTP, recommended for remote or proxied setups)Built-in Cloudflare tunnel: expose your local VS Code to the public internet (trycloudflare.com) with one click, so web-based or remote agents can connect
MCP Bridge Panel: shows the current public URL in a real input box (auto-refreshing) with one-click buttons to copy the URL or the starter prompt
Optional Bearer token auth and a command allowlist to control the attack surface
Starts automatically with VS Code — no manual startup needed
Installation
Option 1: Install the VSIX from the command line
code --install-extension "vscode-mcp-api-1.0.0.vsix" --forceOption 2: Install from the VS Code UI
Open the Extensions view (
Ctrl+Shift+X)Click
···in the top-right corner → Install from VSIX...Select
vscode-mcp-api-1.0.0.vsixReload the window (
Ctrl+Shift+P→ "Reload Window")
Verify the installation
After reloading, MCP :3333 appears in the status bar. You can also run a health check:
curl http://127.0.0.1:3333/health
# {"status":"ok","version":"1.0.0","connectedAgents":0,"port":3333}The default port is 3333. If it is taken, ports 3333–3337 are tried automatically.
Usage 1: Local agents (same machine)
Configure your local MCP client (Claude Code, Cline, or any MCP-capable tool):
Endpoint | URL | Notes |
Streamable HTTP (recommended) |
| Pure request-response, best compatibility |
SSE (classic) |
| Legacy transport, also works locally |
Example config (~/.claude/mcp.json or any client supporting mcpServers):
{
"mcpServers": {
"vscode": {
"url": "http://127.0.0.1:3333/mcp"
}
}
}Then tell the agent "connect to the MCP server and list available tools" — all 27 tools will show up.
Usage 2: Remote agents (web UI / another machine)
Start the public tunnel (pick one):
Enable
mcpServer.enableCloudflareTunnelin settings (starts with the server)Click the "Public Tunnel" button in the status bar
Run "VS Code MCP Bridge: Start/Stop Public Tunnel" from the command palette
On first use you need
cloudflared; the extension offers automaticwingetinstall or a direct download linkOnce the tunnel is up, a notification appears — click "Open Panel" on it
In the MCP Bridge Panel, click "📋 Copy Starter Prompt":
https://xxxx-xxxx-xxxx.trycloudflare.com/mcp
Please connect to this MCP server, learn which tools it provides, and use those MCP tools for everything in this conversation.Paste that text to the remote agent (web chat, a model on another machine) and it will connect
⚠️ Always use the
/mcpendpoint remotely. Some networks (including certain Cloudflare tunnel routes) buffer SSE response bodies, so/ssereturns 200 but noendpointevent ever arrives./mcpis stateless request-response and traverses fine.
Note: the temporary tunnel URL changes on every restart (window reload / reboot / tunnel restart). Always use the URL currently shown in the MCP Bridge Panel.
Opening the MCP Bridge Panel
Run "VS Code MCP Bridge: Open Management Panel" from the command palette
Click
MCP :3333in the status bar → "Open Management Panel"Click "Open Panel" on the tunnel notification
The panel shows server/tunnel status, the public URL (auto-refreshing), buttons to copy the URL or the starter prompt, and local URL copy.
Settings
Search for mcpServer in VS Code settings:
Setting | Default | Description |
|
| HTTP port (auto-increments through 3333–3337 if taken) |
| empty | HTTP Bearer token; empty means no auth |
|
| Push active file / selection / diagnostics to connected agents |
|
| Start the public tunnel automatically with the server |
|
| How terminal commands run ( |
|
| Allowlist of VS Code commands for |
All commands
Command | Description |
VS Code MCP Bridge: Start Server | Start the local HTTP server |
VS Code MCP Bridge: Stop Server | Stop server and tunnel |
VS Code MCP Bridge: Restart Server | Restart |
VS Code MCP Bridge: Copy Connection URL | Copy the local |
VS Code MCP Bridge: Start/Stop Public Tunnel | Toggle the public tunnel |
VS Code MCP Bridge: Show/Copy Public URL | Show the current public URL, press Enter to copy |
VS Code MCP Bridge: Copy Starter Prompt | Copy "URL + instructions" prompt |
VS Code MCP Bridge: Open Management Panel | Open the MCP Bridge Panel |
VS Code MCP Bridge: Show Status / Options | Status bar menu |
Tool list (27 tools)
Category | Tools |
Context awareness |
|
File operations |
|
LSP navigation |
|
Refactor / quick fix |
|
Terminal (short commands) |
|
Terminal (long-running) |
|
Misc |
|
Security notes
Public tunnel + no auth = anyone with the URL can control your VS Code (including running terminal commands). Always set
mcpServer.authTokenand send the header from the remote client:"Authorization": "Bearer <your-token>"execute_vscode_commanddenies everything by default; only commands inallowedCommandsrunThe temporary tunnel URL is a random phrase, but leaking it means handing over control — never share it publicly
FAQ
Q: /sse returns 200 remotely but the endpoint event never arrives?
The tunnel buffers the SSE body. Use the /mcp endpoint remotely (stateless request-response). Both endpoints work locally.
Q: My tunnel URL changed and the old one stopped working? Temporary tunnels (trycloudflare.com) generate a new random URL on every start. Open the MCP Bridge Panel and copy the latest one.
Q: Where are the logs?
Open the Output panel (Ctrl+Shift+U) and pick the "MCP 桥接" channel — it has detailed server, tunnel, and tool-call logs.
Q: The port is already in use?
It auto-increments through 3333–3337; the port field in /health shows the actual port.
Build from source
npm install
npm run typecheck # type check
npm run build # bundle to out/extension.js with esbuild
npx vsce package --no-dependencies # produce the VSIX本项目基于开源项目 vscode-mcp-bridge 完成。 This project is based on the open-source project vscode-mcp-bridge.
This server cannot be deployed
Maintenance
Related MCP Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
The OpenRouter MCP server plugs OpenRouter into the AI tools you already use. Once connected, your assistant can pull live OpenRouter data (models, prices, your credits, rankings, and docs) and send quick test messages, all without leaving your editor.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server exposing the Backtest360 engine API as tools for AI agents.
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server to expose VS Code editing features to an LLM for AI coding9328 npm393MIT
- FlicenseNot gradedqualityNot gradedmaintenanceExposes VSCode's Language Server Protocol features through MCP, enabling AI assistants to perform language-aware operations like symbol navigation, reference tracking, safe renaming, type information retrieval, and hover documentation across codebases.-
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to leverage VS Code's language intelligence for code navigation, refactoring, and analysis via the MCP protocol.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to inspect debug state, control execution, and set breakpoints in VS Code by exposing the Debug Adapter Protocol as an MCP server.Apache 2.0