home / mcp / vscode internal command mcp server

VSCode Internal Command MCP Server

Provides an MCP server for remotely executing VSCode internal commands, listing commands, and querying workspace info via HTTP streaming.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "bestk-vscode-internal-command-mcp-server": {
      "url": "http://localhost:8080/mcp"
    }
  }
}

You turn VSCode into an MCP server that remote clients can connect to over HTTP streaming to execute VSCode commands, inspect workspace information, and monitor status in real time. This enables powerful integrations where external tools drive VSCode actions and monitor its state through the MCP protocol.

How to use

Connect to the MCP server from a client that understands the MCP protocol. Use the server endpoint to discover available tools, invoke VSCode internal commands, and fetch current workspace information. You can perform asynchronous commands that return quickly while the actual work runs in the background, and you can enable or disable notifications for completed tasks as needed. Monitor the server status from the VSCode status bar and query health status to ensure the service is healthy before issuing commands.

From your client, call the available tools to execute VSCode commands, list commands, or retrieve workspace data. Commands are executed in the VSCode security context, and you can configure a delay or a whitelist of allowed commands to control what remote clients may run. Use the health endpoint to verify the server is up before attempting operations.

How to install

Prerequisites you need before installation: a system with Node.js and npm installed, and a VSCode development environment if you plan to run and test the extension locally.

Step-by-step installation and startup flow you can follow in your environment:

# 1) Clone the project
git clone https://github.com/bestk/vscode-internal-command-mcp-server
cd vscode-internal-command-mcp-server

# 2) Install dependencies
npm install

# 3) Compile the project
npm run compile

# 4) In VSCode, open the project and run the extension in Debug Mode (F5)
# or package as a .vsix and install manually

Configuration and security

Configure the MCP server in VSCode settings to control port, host, startup behavior, asynchronous execution, and allowed commands. You can enable automatic startup, adjust execution delays, and specify a whitelist of VSCode commands that remote clients may execute.

{
  "vscode-internal-command-mcp-server.port": 8080,
  "vscode-internal-command-mcp-server.host": "localhost",
  "vscode-internal-command-mcp-server.autoStart": true,
  "vscode-internal-command-mcp-server.asyncExecution": true,
  "vscode-internal-command-mcp-server.executionDelay": 1000,
  "vscode-internal-command-mcp-server.showAsyncNotifications": false,
  "vscode-internal-command-mcp-server.allowedCommands": [
    "editor.action.formatDocument",
    "workbench.action.files.save",
    "editor.action.clipboardCopyAction"
  ]
}

Endpoints and status

MCP endpoint: http://localhost:8080/mcp. Health endpoint: http://localhost:8080/health. The status bar in VSCode shows the server state as running or stopped, and you can view detailed status with a status command in the command palette.

Tools and commands

Available MCP tools include functions to execute VSCode commands, list commands, and fetch workspace information. Use these tools to drive VSCode actions remotely and gather context about the current workspace.

Available tools

execute_vscode_command

Executes a VSCode internal command with optional arguments, returning a result or acknowledgement and supporting asynchronous execution.

list_vscode_commands

Returns a list of available VSCode commands that can be invoked through the MCP server.

get_workspace_info

Fetches information about the current workspace, including folders and the active editor.