GG MCP
标准协议文档
v1.1.0
GG MCP for VSCode 是一款专为 VS Code 设计的 Model Context Protocol (MCP) 服务扩展。它通过建立本地服务端,让 Claude Desktop、Cursor、Windsurf 以及 Antigravity 等 AI 客户端能够直接、安全地访问和操作您的本地代码库。
该扩展充当了本地代码与 AI 助手之间的桥梁:由 Claude 或其他客户端发起指令,本插件作为服务端在您的工作区执行具体的开发任务——包括读取文件、编辑代码、运行终端命令等,从而实现真正意义上的自动化辅助编程。

✨ 核心特性
- 多 IDE 支持:深度适配 VS Code、Cursor、Windsurf 和 Antigravity。
- Claude Desktop 集成:无缝对接 Claude Desktop,处理复杂的自动化编程任务。
- 标准化兼容:完全符合 Model Context Protocol (MCP) 规范,支持所有主流 MCP 客户端。
- 零配置启动:安装即用,VS Code 启动时会自动运行本地 MCP 服务。
- 全能工具集:
- 📂 文件操作:支持文件的读取、写入、创建以及增量补丁(Patch)。
- 💻 终端控制:执行命令、管理后台任务并捕获实时输出。
- 🔧 Git 集成:支持代码提交、推送、拉取、查看差异(Diff)及分支管理。
- 🐛 调试功能:支持设置断点和管理启动配置。
- 🔍 代码分析:快速查找符号、引用及定义。
- 安全架构:服务仅绑定于
localhost,确保代码隐私安全。 - 智能管理:具备自动端口冲突检测与解决机制,并在状态栏提供实时通知。
- 跨平台:完美支持 Windows、macOS 和 Linux。
- 性能优化:内置文件内容缓存机制,大幅提升大项目下的响应速度。
🚀 快速上手
1. 安装扩展
- 在 VS Code 插件市场搜索 "GG MCP for VSCode" 并安装。
- 或通过链接直接安装:点击安装
2. 推荐配置方案
- Claude Desktop 集成:配合此扩展,Claude 可以获得对代码库的直接读写权限,实现全自动的代码修复和功能实现。
- MCPxHub:推荐配合 MCPxHub 插件使用,以获得更佳的管理体验。
3. 验证服务器状态
安装完成后,MCP 服务器将自动启动。您可以查看 VS Code 右下角的状态栏进行确认:
- 🔄 MCP Server - 服务器正在启动。
- 🔌 [Port] - 服务器运行中(例如
🔌 9961)。 - ❌ MCP Server - 服务器启动失败。
点击状态栏图标可查看详细运行日志或手动重启服务。
4. 配合 AI 助手使用
当您使用支持 MCP 的 AI 助手时,它可以调用的能力包括:
- 查看当前打开的文件。
- 直接修改代码逻辑。
- 执行复杂的项目重构。
- 在集成终端中运行测试或部署脚本。
💻 配合 Claude Desktop 实现自动化开发
通过 GG MCP for VSCode,Claude Desktop 可以实现以下深度操作:
- 全量代码库分析:理解项目架构与依赖关系。
- 功能实现与 Bug 修复:AI 编写代码并直接应用到本地文件。
- 代码重构:安全地跨文件更改变量名或重组逻辑。
- 任务执行:自动运行安装命令、构建脚本及测试用例。
⚙️ 配置选项
您可以在 VS Code 设置中搜索 ggMCP 来调整以下参数:
- 端口范围 (Port range):自定义 MCP 服务监听的端口。
- 终端超时 (Terminal timeout):设置命令执行的最长等待时间。
- 文件自动重载:配置文件的实时同步策略。
- 文件缓存行为:
- 开启缓存可减少磁盘 I/O,优化大文件读取性能。
- 文件被修改后缓存会自动失效,确保 AI 获取的是最新内容。
📄 常用命令
通过 VS Code 命令面板(Ctrl+Shift+P 或 Cmd+Shift+P)运行:
MCP: Show Server Status- 查看当前服务器运行详情。MCP: Restart Server- 手动重启 MCP 服务。
🛠️ 可用工具概览 (共计 44 个)
| 类别 | 工具数量 | 示例工具 |
|---|---|---|
| 编辑器工具 | 5 | get_open_in_editor_file_text, replace_selected_text, open_file_in_editor |
| 文件工具 | 9 | get_file_text_by_path, create_new_file_with_text, replace_specific_text |
| 代码分析 | 3 | get_symbols_in_file, find_references, refactor_code_at_location |
| 调试工具 | 4 | toggle_debugger_breakpoint, run_configuration |
| 终端工具 | 5 | execute_terminal_command, run_command_on_background, get_terminal_info |
| Git 工具 | 10 | get_project_vcs_status, commit_changes, switch_branch, get_file_diff |
| 项目工具 | 2 | get_project_modules, get_project_dependencies |
| 动作工具 | 3 | list_available_actions, execute_action_by_id |
相关链接:
版本历史
Changelog
All notable changes to the GG MCP for VSCode extension will be documented in this file.
[1.3.0] - 2024-12-09
Changed
- Better UX: Replaced intrusive pop-up dialogs with subtle status bar messages.
- Auto Port Management: Automatically resolves port conflicts and manages server connections.
- UI Update: Status bar now clearly displays the active server port.
[1.2.4] - 2024-12-08
Changed
- Stability: Fixed issues with file line endings and improved test reliability.
- Documentation: Standardized documentation structure for better readability.
[1.2.1] - 2025-12-07
Documentation
- Updated guide with clearer setup instructions for Antigravity, Cursor, and Windsurf.
[1.2.0] - 2025-12-07
Added
- New Tools:
replace_specific_text: Precision text replacement.append_file_content: Add text to the end of files.rewrite_file_content: Completely update file contents.run_command_on_background: Execute long-running commands.get_terminal_info: View terminal system details.
- Git Integration: Added suite of Git tools (
get_file_history,commit_changes,switch_branch, etc.). - Performance: Added file caching for faster operations.
Changed
- Documentation: Complete rewrite of tool documentation with examples.
- Standardization: Updated API responses to fully comply with MCP standards.
- Protocol: Upgraded to standard JSON-RPC 2.0.
[1.1.1] - 2025-03-30
Added
- Rebranding: Updated display name to "GG MCP for VSCode".
- Localization: Improved Chinese language support.
[1.0.0] - 2025-03-22
Released
- Initial Release: Launched with core file and editor operation tools.
- Localization: Added Chinese documentation.
使用 GFM 标准渲染的 Markdown 内容