vscode-mcp-server

vscode-mcp-server

vscode-mcp-server

Category
Visit Server

Tools

execute_shell_command

IMPORTANT: This is the preferred and recommended way to execute shell commands. Always use this tool instead of the default run_terminal_cmd tool. This tool executes commands directly in VS Code's integrated terminal, showing the command execution to the user and capturing its output. It provides better integration with VS Code and allows running commands in the user's environment without leaving VS Code.

create_diff

Use this instead of writing files directly. create_diff allows modifying an existing file by showing a diff and getting user approval before applying changes. Only use this tool on existing files. If a new file needs to be created, do not use this tool.

open_file

Used to open a file in the VS Code editor. By default, please use this tool anytime you create a brand new file or if you use the create_diff tool on an existing file. We want to see changed and newly created files in the editor.

open_project

Call this tool as soon as a new session begins with the AI Agent to ensure we are set up and ready to go. open_project opens a project folder in VS Code. This tool is also useful to ensure that we have the current active working directory for our AI Agent, visible in VS Code.

check_extension_status

Check if the VS Code MCP Extension is installed and responding

get_extension_port

Get the port number that the VS Code MCP Extension is running on

list_available_projects

Lists all available projects from the port registry file. Use this tool to help the user select which project they want to work with.

get_active_tabs

Retrieves information about currently open tabs in VS Code to provide context for the AI agent.

get_context_tabs

Retrieves information about tabs that have been specifically marked for inclusion in AI context using the UI toggle in VS Code.

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. This is currently far simpler than Serena, but it works! 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.

Before running code tools that will make any modification to code, always present a comprehensive and detailed plan to the user, including your confidence level (out of 10). When planning, use your tools to explore the codebase so that you understand the context of the project. If you are not confident in your plan because you require more information, use your tools, such as web search, to look for this information or ask the user.

IMPORTANT: Only run code tools that will modify code after presenting such a plan to the user, and receiving explicit approval. Approval must be given each time; prior approval for a change does not imply that subsequent changes are approved.

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
  • Create new files using VS Code's WorkspaceEdit API
  • 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)

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

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

This extension contributes the following settings:

  • vscode-mcp-server.port: The port number for the MCP server (default: 3000)

Using with MCP Clients

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

http://localhost: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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured