Назад к каталогу
vscode-mcp-server

vscode-mcp-server

Сообщество

от juehang

0.0
0 отзывов

MCP server to expose VS Code editing features to an LLM for AI coding

Установка

{

Описание

# VS Code MCP Server A Visual Studio Code extension (available on the [Marketplace](https://marketplace.visualstudio.com/items?itemName=JuehangQin.vscode-mcp-server)) that allows Claude and other MCP clients to code directly in VS Code! Inspired by [Serena](https://github.com/oraios/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](https://marketplace.visualstudio.com/items?itemName=JuehangQin.vscode-mcp-server) 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 PLANNING REQUIREMENTS: Before making code modifications, present a comprehensive plan including: - Confidence level (1-10) and reasoning - Specific tools you'll use and why - Files you'll modify and approach (small edits vs complete rewrites) - How you'll verify the changes work (diagnostics, testing, etc.) ERROR HANDLING: - Let errors happen naturally - don't add unnecessary try/catch blocks - For tool failures: follow the specific recovery guidance in each tool's description - If uncertain about file content: use read_file_code to verify before making changes APPROVAL PROCESS: IMPORTANT: Only run code modification tools after presenting a plan and receiving explicit approval. Each change requires separate approval. Do not add tests unless specifically requested. If you believe testing is important, explain why and let the user decide. ``` For context efficiency when exploring codebases, consider adding this to your CLAUDE.md: ``` ## VS Code Symbol Tools for Context Efficiency Use VS Code symbol tools to reduce context consumption: - `get_document_symbols_code` for file structure overview instead of reading entire files - `search_symbols_code` to find symbols by name across the project - `get_symbol_definition_code` for type info and docs without full file context - Workflow: get outline → search symbols → get definitions → read implementation only when needed ``` This extension serves as a Model Context Protocol (MCP) server, exposing VS Code's filesystem and editing capabilities to MCP clients. ## Features The VS Code MCP Server extension implements an MCP-compliant server that allows AI models and other MCP clients to: - **List files and directories** in your VS Code workspace - **Read file contents** with encoding support and size limits - **Search for symbols** across your workspace - **Get symbol definitions** and hover information by line and symbol name - **Create new files** using VS Code's WorkspaceEdit API - **Make line replacements** in files - **Check

Отзывы (0)

Пока нет отзывов. Будьте первым!