SuperAPIAI Directory

vscode-mcp-server

github.com · AI coding

Work in a VS Code workspace: read the directory structure, see linter and language server problems, read code files and make edits.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

VS Code MCP Server is a Visual Studio Code extension (already listed on the Marketplace) that allows Claude and other MCP clients to write code directly in VS Code. It is inspired by Serena but is implemented based on VS Code's built-in capabilities, making it suitable for extending existing coding agents such as Claude Code with VS Code-specific capabilities (such as symbol search and document outlines) without duplicating tools they already have. Note that this extension uses the streamable HTTP API, not the SSE API.

Purpose and Positioning This extension acts as a Model Context Protocol (MCP) server, exposing VS Code's file system and editing capabilities to MCP clients, enabling AI models and other MCP clients to interact with the VS Code workspace through the standardized MCP protocol. The extension runs on a locally configurable port (when enabled), handles MCP protocol requests over HTTP, exposes VS Code features as MCP tools, and displays the server status through a status bar indicator that can be clicked to turn the server on or off.

Security Notice This extension can execute shell commands, which means there is a potential security risk and caution is required when using it: make sure you trust the MCP client you are using, and make sure the port is not exposed to any external parties. Authentication mechanisms would help, but because the MCP authentication specification is still changing, authentication has not yet been implemented.

Installation You can 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 configure this extension as an MCP server, which requires corresponding configuration in claude_desktop_config.json. In addition, this extension is also suitable for use in Claude projects in order to specify additional instructions for Claude; when exploring a codebase, to improve context efficiency, relevant prompts can be added to CLAUDE.md.

Supported MCP Tools File and directory operations:

  • list_files_code: Lists files and directories in the workspace. Parameters: path (the path of the files to list), recursive (optional, whether to list recursively).
  • read_file_code: reads file contents. Parameters: path (the file path to read), encoding (optional, file encoding, default utf-8), maxCharacters (optional, maximum number of characters, default 100,000).
  • move_file_code: uses VS Code's WorkspaceEdit API to move a file or directory to a new location. Parameters: sourcePath (the current path of the file or directory to move), targetPath (the destination path to move to), overwrite (optional, whether to overwrite if the target already exists, default false).
  • rename_file_code: uses VS Code's WorkspaceEdit API to rename a file or directory. Parameters: filePath (the current path of the file or directory to rename), newName (the new name), overwrite (optional, whether to overwrite if a file with the same name already exists, default false).
  • copy_file_code: uses VS Code's file system API to copy a file to a new location. Parameters: sourcePath (the file path to copy), targetPath (the copy destination path), overwrite (optional, whether to overwrite if the target already exists, default false).
  • create_file_code: uses VS Code's WorkspaceEdit API to create a new file. Parameters: path (the file path 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 file path to modify), startLine (start line number, starting from 1, inclusive), endLine (end line number, starting from 1, inclusive), content (the new content to replace these lines with), originalCode (the original code used for verification).

Diagnostic tools:

  • get_diagnostics_code: checks for warnings and errors in the workspace. Parameters: path (optional, the file path to check, if not providedthen checks the entire workspace), severities (optional, an 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 diagnostic sources, default true). This tool is suitable for code quality checks before committing changes, verifying whether fixes resolve all reported issues, and identifying problems in specific files or the entire workspace.

Symbol-related tools:

  • search_symbols_code: searches for symbols in the workspace. Parameters: query (symbol name search query), maxResults (optional, maximum number of results to return, default 10). Suitable for finding definitions of symbols (functions, classes, variables, etc.) in the codebase, exploring project structure and organization, and locating specific elements by name.
  • get_symbol_definition_code: gets definition information for a symbol in a file. Parameters: path (path of the file containing the symbol), line (line number where the symbol is located), symbol (name of the symbol to find in the specified line). Provides type information, documentation, and source details for the symbol, displays the code context of the line where the symbol is located, and information about the symbol's range. Suitable for understanding the meaning of a symbol without jumping to it, viewing function signatures/type definitions/documentation, and quickly consulting APIs or library functions.
  • get_document_symbols_code: gets an outline of all symbols in a file, showing the hierarchical structure. Parameters: path (path of the file to analyze, relative to the workspace), maxDepth (optional, maximum nesting depth to display). Provides the complete symbol tree of the document (similar to VS Code's Outline view), displays the hierarchical structure of classes/functions/methods/variables, etc., the location information and symbol kind of each symbol, and summary information counted by symbol type. Suitable for quickly understanding file structure and organization, getting an overview of all symbols in a document, analyzing code architecture and relationships, and finding all symbols of a specific type in a file.

Terminal tools:

  • execute_shell_command_code: executes shell commands through shell integration in the VS Code integrated terminal. Parameters: command (the shell command to execute), cwd (optional, the working directory for the command, default '.'). Suitused for running CLI commands and build operations, executing git commands, performing any shell operations that require terminal access, and obtaining command output for analysis and further processing.

Notes The README of this extension mentions that PRs are welcome. Apart from the above, other facts such as other features, charges, pricing, platforms, and usage restrictions are not yet provided.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools