home / mcp / vs code mcp server

VS Code MCP Server

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

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "juehang-vscode-mcp-server": {
      "url": "http://localhost:3000/mcp"
    }
  }
}

You can run a Visual Studio Code MCP Server locally to expose your workspace to AI models and other MCP clients. It lets you list, read, edit, and navigate your codebase, run shell commands in a controlled terminal, and get real-time diagnostics—all through a standardized MCP interface.

How to use

Connect an MCP client to the server URL http://localhost:3000/mcp. Once connected, you can explore your workspace by listing files, read file contents, and perform edits through the MCP tools. You can search for symbols across the project, view symbol definitions and hover information, and check for diagnostics to catch errors or warnings. You can also execute shell commands in the integrated terminal and toggle the MCP server on or off from the status bar.

How to install

Prerequisites: ensure you have Node.js and npm installed, and you are running VS Code.

Step 1: Install the extension from the Marketplace within VS Code.

Step 2: If you prefer building from source, clone the project, install dependencies, and compile.

Step 3: Open VS Code, ensure the MCP server is enabled, and look for the status bar item to start the server.

Configuration and usage notes

Server runs locally by default on port 3000. You can enable or disable the server via a status bar item. The server exposes a range of tools for file operations, edits, diagnostics, symbol tooling, and shell execution. Use the MCP URL http://localhost:3000/mcp to connect clients. If you customize host/port, point clients to the updated URL.

Environment variables are not required by default for the server, but you can configure them if you extend functionality. Ensure you trust your MCP client when enabling shell execution, as it can pose security risks if the port is exposed unintentionally.

Troubleshooting and tips

If the server fails to start, verify that port 3000 is not in use and that VS Code has permission to run the extension. Check diagnostics for errors and ensure the server is enabled via the status bar item. When making changes to files, re-check diagnostics to confirm there are no new issues.

Available tools

list_files_code

Lists files and directories in your workspace from a given path, enabling exploration of the project structure.

read_file_code

Reads contents of a file with specified encoding and optional maximum character limit.

move_file_code

Moves a file or directory using VS Code's WorkspaceEdit API, preserving references during refactoring.

rename_file_code

Renames a file or directory and updates references accordingly.

copy_file_code

Copies a file to a new location, with optional overwrite control.

create_file_code

Creates a new file using VS Code's WorkspaceEdit API with optional overwrite behavior.

replace_lines_code

Replaces a specific range of lines in a file with new content.

get_diagnostics_code

Checks for warnings and errors in the workspace, with optional filtering by path and severity.

search_symbols_code

Searches for symbols across the workspace by name, returning matching results.

get_symbol_definition_code

Retrieves definition information for a given symbol, including type and docs.

get_document_symbols_code

Provides an outline of all symbols in a file, including structure and positions.

execute_shell_command_code

Executes a shell command in the integrated terminal with optional working directory.