VS Code MCP Serverのロゴ

VS Code MCP Server

コミュニティ
juehang

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

公開者juehang
リポジトリvscode-mcp-server
言語TypeScript
フォーク
81
スター
394
利用可能なツール
9
通信方式stdio
カテゴリ
ライセンスMIT
リンク
  • ツールをAIワークフローに接続

    VS Code MCP Serverは、対応するAIクライアントやAIエージェントから利用できるMCP機能を提供します。

  • 9個の利用可能なツール

    呼び出し可能なアクションを以下で確認できます。サーバーから提供されている場合は、名前や説明も表示されます。

  • コピーして使える設定

    セットアップ用の設定例を使って、お好みのMCPクライアントにこのサーバーを設定できます。

  • オープンソースの注目度

    リンク先のリポジトリには394件のスターと81件のフォークがあります。

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
  • Move files and directories with proper refactoring support for imports
  • Rename files and directories with automatic reference updates
  • Copy files to new locations (files only, not directories)
  • 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)
  • move_file_code: Moves a file or directory to a new location using VS Code's WorkspaceEdit API

    • Parameters:
      • sourcePath: The current path of the file or directory to move
      • targetPath: The new path where the file or directory should be moved to
      • overwrite (optional): Whether to overwrite if target already exists (default: false)
  • rename_file_code: Renames a file or directory using VS Code's WorkspaceEdit API

    • Parameters:
      • filePath: The current path of the file or directory to rename
      • newName: The new name for the file or directory
      • overwrite (optional): Whether to overwrite if a file with the new name already exists (default: false)
  • copy_file_code: Copies a file to a new location using VS Code's file system API

    • Parameters:
      • sourcePath: The path of the file to copy
      • targetPath: The path where the copy should be created
      • overwrite (optional): Whether to overwrite if target already exists (default: false)

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

インストール

TypingMind
前提条件:

Node.js 18+

{
  "mcpServers": {
    "juehang-vscode-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "vscode-mcp-server"
      ]
    }
  }
}

利用可能なツール

  • 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.

VS Code MCP ServerのMCPを複数のAIモデルで活用

TypingMindはワークスペース単位でMCPツールに接続します。そのため、一度VS Code MCP Serverに接続すれば、モデルごとに個別に設定することなく、TypingMind内のさまざまなAIモデルで利用できます。 このMCPは、デバイス上のTypingMind MCPコネクタを通じてローカルで動作します。

ローカルコネクタのセットアップガイド

MCPサーバーが、お使いのコンピューター上のローカルファイル、アプリ、非公開リソースにアクセスする必要がある場合は、この方法を使います。

1

MCP設定を開く

TypingMindで「設定」、「詳細設定」、「MCP」の順に進み、「コネクタを設定」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 設定アイコンをクリックしてください。
  3. 「詳細設定」に移動してください。
  4. 「MCP」セクションを開いてください。
  5. 「コネクタを設定」をクリックし、「このデバイス」を選択してください。
「このデバイス」が選択されたTypingMindのMCPコネクタ設定画面
2

コネクタのコマンドを実行

「このデバイス」を選択し、TypingMindからコマンドをコピーしてターミナルで実行してください。MCPの使用中は、プロセスを実行したままにしてください。

  1. TypingMindに表示されるセットアップコマンドをコピーしてください。
  2. macOSではターミナルを、WindowsではWindows Terminalを開いてください。
  3. コマンドを貼り付けて実行してください。
  4. ターミナルで続行の確認を求められた場合は、パッケージのインストールを承認してください。
  5. MCPツールの使用中は、ターミナルウィンドウを開いたまま、プロセスの実行を継続してください。
3

VS Code MCP Serverをサーバーとして追加

コネクタのステータスが「準備完了」になったら、「サーバーを編集」をクリックし、MCPサーバーの設定を貼り付けてください。

  1. コネクタのステータスが「準備完了」になるまでお待ちください。
  2. 「サーバーを編集」をクリックしてください。
  3. VS Code MCP ServerのMCPサーバー設定を貼り付けてください。
  4. サーバー一覧を保存してください。
  5. コネクタが引き続き使用可能か確認するには、更新してください。
稼働中のサーバーと「サーバーを編集」ボタンが表示されたTypingMindのMCP設定画面
{
  "mcpServers": {
    "juehang-vscode-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "vscode-mcp-server"
      ]
    }
  }
}
4

複数のモデルで同じ接続を使用

サーバー一覧を保存し、「プラグイン」を開いてVS Code MCP ServerのMCPツールを有効にしてください。その後、TypingMindで対応するAIモデルを選択し、チャットでツールを使うか、AIエージェントに割り当ててください。

  1. TypingMindの「プラグイン」ページを開いてください。
  2. VS Code MCP ServerのMCPツールを有効にしてください。
  3. チャットを開始し、使用するAIモデルを選択してください。
  4. MCPツールをチャットで使うか、AIエージェントに割り当ててください。
  5. MCPに再接続することなく、必要に応じて別のAIモデルに切り替えられます。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
VS Code MCP Serverを使ってこのタスクを手伝ってもらえますか?
VS Code MCP Server
はい、読みました。
VS Code MCP Serverで調べた結果をお伝えします。

よくある質問

VS Code MCP Server MCPサーバーは何に使いますか?

VS Code MCP Serverは、対応するAIクライアントを外部ツールやコンテキストに接続するためのMCPサーバーです。TypingMindでは、このMCPサーバーを一度追加するだけで、AIワークスペース内でそのツールを利用できるようになります。

TypingMindでVS Code MCP Server MCPを複数のAIモデルと併用できますか?

はい。TypingMindはワークスペース単位でMCPツールに接続するため、モデルごとにMCPサーバーを設定する必要はありません。Claude、ChatGPT、Geminiや、TypingMindで設定したその他のAIモデルでVS Code MCP Serverを利用できます。

TypingMindでVS Code MCP Server MCPを使うメリットは何ですか?

TypingMindは、複数のAIモデル、プロンプト、プラグイン、AIエージェント、APIキー、MCPツールを1つのワークスペースにまとめられる、LLMチャット向けの優れたフロントエンドです。VS Code MCP Serverを接続すると、TypingMindでチャットのワークフローを整理しながら、お好みのモデルでそのMCPツールを利用できます。

VS Code MCP Server MCPをTypingMindに接続するにはどうすればよいですか?

VS Code MCP ServerはTypingMindのローカルMCPコネクタ経由で動作します。MCPサーバーがコンピューター上のローカルファイル、デスクトップアプリ、コマンドラインツール、プライベートリソースにアクセスする必要がある場合に最適です。

TypingMindでVS Code MCP Server MCPのどのようなツールを利用できますか?

VS Code MCP Serverは9個のMCPツールを提供しています。TypingMindのプラグインページで有効にすると、チャットで使用したり、AIエージェントに割り当てたりできます。

VS Code MCP Server MCPを使うには、APIキーをTypingMindと共有する必要がありますか?

いいえ。TypingMindはローカルファーストの設計で、モデルプロバイダー、APIキー、プロンプト、MCP設定をご自身で管理できます。VS Code MCP Serverで認証が必要な場合は、接続の作成時に、そのMCPサーバーに必要なヘッダー、OAuth設定、またはローカル設定を追加してください。

関連するMCPサーバー

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇