VS Code MCP Server

VS Code MCP Server

Connect Claude and other MCP clients to code directly in VS Code.

280
Stars
54
Forks
280
Watchers
6
Issues
VS Code MCP Server is a Visual Studio Code extension that enables AI coding agents, such as Claude, to interact with a user's codebase through the Model Context Protocol. It provides VS Code-specific capabilities like symbol search and document outlines, leveraging the editor's built-in features. The server communicates using a streamable HTTP MCP API and can execute shell commands for advanced operations. It is ideal for extending the coding capabilities of AI models without duplicating existing developer tools.

Key Features

Streamable HTTP MCP API support
Symbol search and document outlining in VS Code
Execution of shell commands via AI agents
Direct communication with Claude and other MCP clients
No tool duplication—leverages VS Code built-in capabilities
Efficient code exploration workflows
Integration instructions for Claude Desktop
Customizable prompt guidance for AI coding
Security guidance for shell access
Open to pull requests and community contributions

Use Cases

Enabling AI models to browse and edit code in VS Code
Extending Claude's capabilities with direct IDE integration
Automating coding workflows using AI assistants
Running safe, automated shell commands via AI
Using symbol and file navigation tools programmatically
Providing codebase context efficiently to AI agents
Enhancing developer-automation scenarios in VS Code
Facilitating precise, approval-based code modifications
Improving project understanding for AI agents through file system access
Integrating with Claude Desktop for synchronized development

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

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 for diagnostics (errors and warnings) in your workspace
  • Execute shell commands in the integrated terminal with shell integration
  • Toggle the server on and off via a status bar item

This extension enables AI assistants and other tools to interact with your VS Code workspace through the standardized MCP protocol.

How It Works

The extension creates an MCP server that:

  1. Runs locally on a configurable port (when enabled)
  2. Handles MCP protocol requests via HTTP
  3. Exposes VS Code's functionality as MCP tools
  4. Provides a status bar indicator showing server status, which can be clicked to toggle the server on/off

Supported MCP Tools

File Tools

  • list_files_code: Lists files and directories in your workspace

    • Parameters:
      • path: The path to list files from
      • recursive (optional): Whether to list files recursively
  • read_file_code: Reads file contents

    • Parameters:
      • path: The path to the file to read
      • encoding (optional): File encoding (default: utf-8)
      • maxCharacters (optional): Maximum character count (default: 100,000)

Edit Tools

  • create_file_code: Creates a new file using VS Code's WorkspaceEdit API

    • Parameters:
      • path: The path to the file to create
      • content: The content to write to the file
      • overwrite (optional): Whether to overwrite if the file exists (default: false)
      • ignoreIfExists (optional): Whether to ignore if the file exists (default: false)
  • replace_lines_code: Replaces specific lines in a file

    • Parameters:
      • path: The path to the file to modify
      • startLine: The start line number (1-based, inclusive)
      • endLine: The end line number (1-based, inclusive)
      • content: The new content to replace the lines with
      • originalCode: The original code for validation

Diagnostics Tools

  • get_diagnostics_code: Checks for warnings and errors in your workspace

    • Parameters:
      • path (optional): File path to check (if not provided, checks the entire workspace)
      • severities (optional): Array of severity levels to include (0=Error, 1=Warning, 2=Information, 3=Hint). Default: [0, 1]
      • format (optional): Output format ('text' or 'json'). Default: 'text'
      • includeSource (optional): Whether to include the diagnostic source. Default: true

    This tool is particularly useful for:

    • Code quality checks before committing changes
    • Verifying fixes resolved all reported issues
    • Identifying problems in specific files or the entire workspace

Symbol Tools

  • search_symbols_code: Searches for symbols across the workspace

    • Parameters:
      • query: The search query for symbol names
      • maxResults (optional): Maximum number of results to return (default: 10)

    This tool is useful for:

    • Finding definitions of symbols (functions, classes, variables, etc.) across the codebase
    • Exploring project structure and organization
    • Locating specific elements by name
  • get_symbol_definition_code: Gets definition information for a symbol in a file

    • Parameters:
      • path: The path to the file containing the symbol
      • line: The line number of the symbol
      • symbol: The symbol name to look for on the specified line

    This tool provides:

    • Type information, documentation, and source details for symbols
    • Code context showing the line where the symbol appears
    • Symbol range information

    It's particularly useful for:

    • Understanding what a symbol represents without navigating away
    • Checking function signatures, type definitions, or documentation
    • Quick reference for APIs or library functions
  • get_document_symbols_code: Gets an outline of all symbols in a file, showing the hierarchical structure

    • Parameters:
      • path: The path to the file to analyze (relative to workspace)
      • maxDepth (optional): Maximum nesting depth to display

    This tool provides:

    • Complete symbol tree for a document (similar to VS Code's Outline view)
    • Hierarchical structure showing classes, functions, methods, variables, etc.
    • Position information and symbol kinds for each symbol
    • Summary statistics by symbol type

    It's particularly useful for:

    • Understanding file structure and organization at a glance
    • Getting an overview of all symbols in a document
    • Analyzing code architecture and relationships
    • Finding all symbols of specific types within a file

Shell Tools

  • execute_shell_command_code: Executes a shell command in the VS Code integrated terminal with shell integration

    • Parameters:
      • command: The shell command to execute
      • cwd (optional): Optional working directory for the command (default: '.')

    This tool is useful for:

    • Running CLI commands and build operations
    • Executing git commands
    • Performing any shell operations that require terminal access
    • Getting command output for analysis and further processing

Caveats/TODO

Currently, only one workspace is supported. The extension also only works locally, to avoid exposing your VS Code instance to any network you may be connected to.

Extension Settings

  • vscode-mcp-server.port: The port number for the MCP server (default: 3000)
  • vscode-mcp-server.host: Host address for the MCP server (default: 127.0.0.1)
  • vscode-mcp-server.defaultEnabled: Whether the MCP server should be enabled by default on VS Code startup
  • vscode-mcp-server.enabledTools: Configure which tool categories are enabled (file, edit, shell, diagnostics, symbol)

Selective Tool Configuration: Useful for coding agents that already have certain capabilities. For example, with Claude Code you might disable file/edit tools and only enable symbol tools to add VS Code-specific symbol searching without tool duplication.

Using with MCP Clients

To connect MCP clients to this server, configure them to use:

http://localhost:3000/mcp

Or if you've configured a custom host:

http://[your-host]:3000/mcp

Remember that you need to enable the server first by clicking on the status bar item!

Contributing

Contributions are welcome! Feel free to submit issues or pull requests.

License

MIT

Star History

Star History Chart

Repository Owner

juehang
juehang

User

Repository Details

Language TypeScript
Default Branch master
Size 306 KB
Contributors 2
License MIT License
MCP Verified Nov 11, 2025

Programming Languages

TypeScript
99.23%
JavaScript
0.77%

Tags

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • MCP Claude Code

    MCP Claude Code

    Claude Code-like functionality via the Model Context Protocol.

    Implements a server utilizing the Model Context Protocol to enable Claude Code functionality, allowing AI agents to perform advanced codebase analysis, modification, and command execution. Supports code understanding, file management, and integration with various LLM providers. Offers specialized tools for searching, editing, and delegating tasks, with robust support for Jupyter notebooks. Designed for seamless collaboration with MCP clients including Claude Desktop.

    • 281
    • MCP
    • SDGLBL/mcp-claude-code
  • Claude Debugs For You

    Claude Debugs For You

    Enable LLMs like Claude to interactively debug code via a VS Code extension and MCP server.

    Claude Debugs For You provides an MCP-compliant server and Visual Studio Code extension that allow large language models, such as Claude, to perform interactive debugging and code evaluation. It supports language-agnostic debugging through the VS Code debugger and integrates easily with various clients, including Claude Desktop and Continue. The tool provides both stdio and SSE server support for flexible connectivity. Users can quickly install, configure, and leverage LLM-driven debugging workflows across multiple environments.

    • 463
    • MCP
    • jasonjmcghee/claude-debugs-for-you
  • Bifrost

    Bifrost

    VSCode Dev Tools exposed via the Model Context Protocol for AI tool integration.

    Bifrost is a Visual Studio Code extension that launches a Model Context Protocol (MCP) server, enabling external AI coding assistants to access advanced code navigation, analysis, and manipulation features from VSCode. It exposes language server capabilities, symbol search, semantic code analysis, and refactoring tools through MCP-compatible HTTP and SSE endpoints. The extension is designed for seamless integration with AI assistants, supporting multi-project environments and configuration via JSON files.

    • 184
    • MCP
    • biegehydra/BifrostMCP
  • Exa MCP Server

    Exa MCP Server

    Fast, efficient web and code context for AI coding assistants.

    Exa MCP Server provides a Model Context Protocol (MCP) server interface that connects AI assistants to Exa AI’s powerful search capabilities, including code, documentation, and web search. It enables coding agents to retrieve precise, token-efficient context from billions of sources such as GitHub, StackOverflow, and documentation sites, reducing hallucinations in coding agents. The platform supports integration with popular tools like Cursor, Claude, and VS Code through standardized MCP configuration, offering configurable access to various research and code-related tools via HTTP.

    • 3,224
    • MCP
    • exa-labs/exa-mcp-server
  • Azure MCP Server

    Azure MCP Server

    Connect AI agents with Azure services through Model Context Protocol.

    Azure MCP Server provides a seamless interface between AI agents and Azure services by implementing the Model Context Protocol (MCP) specification. It enables integration with tools like GitHub Copilot for Azure and supports a wide range of Azure resource management tasks directly via conversational AI interfaces. Designed for extensibility and compatibility, it offers enhanced contextual capabilities for agents working with Azure environments.

    • 1,178
    • MCP
    • Azure/azure-mcp
  • MCP Language Server

    MCP Language Server

    Bridge codebase navigation tools to AI models using MCP-enabled language servers.

    MCP Language Server implements the Model Context Protocol, allowing MCP-enabled clients, such as LLMs, to interact with language servers for codebase navigation. It exposes standard language server features—like go to definition, references, rename, and diagnostics—over MCP for seamless integration with AI tooling. The server supports multiple languages by serving as a proxy to underlying language servers, including gopls, rust-analyzer, and pyright.

    • 1,256
    • MCP
    • isaacphi/mcp-language-server
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results