Get the FREE Ultimate OpenClaw Setup Guide →

vscode-internal-command

MCP server from bestK/vscode-internal-command-mcp-server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio bestk-vscode-internal-command-mcp-server node out/fastMcpServer.js

How to use

This MCP server exposes a remote interface for controlling VSCode and querying workspace information using the Model Context Protocol. It runs as a FastMCP-based server that communicates over HTTP streaming (SSE) and provides endpoints to execute VSCode internal commands, list available commands, and fetch current workspace details. External clients can connect with the MCP SDK and perform tool calls such as execute_vscode_command, list_vscode_commands, and get_workspace_info. The server also supports asynchronous execution with optional delays, a command whitelist for security, and real-time health status via the /health endpoint.

To use it, start the MCP server (the server binds to a configurable port, defaulting to 8080 if not overridden). Connect via the MCP SDK by creating a StreamableHTTPClientTransport pointing at http://<host>:<port>/mcp and then instantiate a Client. You can call tools like execute_vscode_command with a command ID (and optional arguments), retrieve the list of available VSCode commands, or fetch workspace information. If you enable asynchronous execution, commands are submitted to a background queue and results can be monitored via the provided task identifiers and optional notifications.

How to install

Prerequisites:

  • Node.js and npm installed
  • VSCode environment for development and debugging
  1. Clone the repository and install dependencies
git clone https://github.com/bestk/vscode-internal-command-mcp-server
cd vscode-internal-command-mcp-server
npm install
  1. Compile the TypeScript sources to JavaScript
npm run compile
  1. Run the MCP server locally
node out/fastMcpServer.js
  1. (Optional) Run in development mode or tests
npm run watch
# or use debugging in VSCode
  1. Connect a client (example using MCP SDK)
// Student example: connect to server and call a tool
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
import { Client } from '@modelcontextprotocol/sdk/client/index.js';

const transport = new StreamableHTTPClientTransport(new URL('http://localhost:8080/mcp'), {
  requestInit: {
    headers: {
      'Content-Type': 'application/json',
      Accept: 'application/json, text/event-stream'
    }
  }
});

const client = new Client({ name: 'example-client', version: '1.0.0' });

await client.connect(transport);
const result = await client.callTool({
  name: 'execute_vscode_command',
  arguments: { command: 'editor.action.formatDocument' }
});
console.log(result);

Additional notes

Tips and notes:

  • The server provides a health endpoint at /health and an MCP endpoint at /mcp. Use curl to verify connectivity.
  • You can configure the VSCode server via the vscode-internal-command-mcp-server.* settings in VSCode, including port, host, autoStart, asyncExecution, and allowedCommands.
  • For security, configure a command whitelist. If the list is empty, all commands may be allowed depending on runtime policy.
  • The server uses HTTP streaming (text/event-stream). Ensure clients can handle SSE for real-time updates.
  • In production, consider binding to a specific host IP and applying appropriate CORS/authorization controls.

Related MCP Servers

Sponsor this space

Reach thousands of developers