Skip to content
| Marketplace
Sign in
Visual Studio Code>AI>Workspace Tools MCP ServerNew to Visual Studio Code? Get it now.
Workspace Tools MCP Server

Workspace Tools MCP Server

Alejandro Antúnez

|
1 install
| (0) | Free
Exposes the open VS Code workspace to AI agents through a Model Context Protocol (MCP) server: files, search, terminal commands and diagnostics.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Workspace Tools MCP Server

A VS Code extension that exposes the open workspace to AI agents through a Model Context Protocol server (Streamable HTTP, stateless). It starts with VS Code and serves http://127.0.0.1:7823/mcp.

It offers a small, conventional set of tools, written so that models of any family can use them without special prompting:

Tool What it does
get_workspace_info Workspace folders, OS and shell, active editor with cursor and selected text, open editors
read_file Line-numbered file content (cat -n style), paged with offset/limit; shows unsaved editor changes
list_directory Directory entries, directories first and marked with /; optional depth
find_files Glob search (*.py matches at any depth); honours files.exclude / search.exclude
search_text Regex search with VS Code's bundled ripgrep; path:line: text results
write_file Create or overwrite a file (creates parent directories)
edit_file Exact, unique string replacement; returns the edited region with line numbers
run_command Shell command in the workspace; combined output, exit code, timeout
get_diagnostics Errors and warnings from VS Code's language servers

Design choices for broad model compatibility

  • Plain schemas. Only type, properties, required, description and enum. No $schema, anyOf, additionalProperties, default or numeric bounds, which some providers (Gemini, OpenAI-compatible local runtimes) reject. Defaults and limits are stated in the descriptions.
  • Familiar names and formats. snake_case tools and arguments (path, old_string, new_string, replace_all, offset, limit), cat -n line numbers, path:line: text search hits and path:line:col: severity: message diagnostics: the formats models already know.
  • Lenient input. "5" and "true" are coerced, common alternative names (file_path, filePath, oldString, cmd, …) are accepted, unknown keys are ignored.
  • Errors are tool results (isError: true) that say what to do next: a missing file, a directory passed to read_file ("use list_directory"), an ambiguous edit ("occurs 2 times (lines 2, 4)…"), an edit that only differs in whitespace ("starts at line 12; copy that text exactly"), a missing argument (with usage).
  • Bounded output with context. Reads page at 2000 lines and say how to continue; command output keeps the head and tail (30 000 chars); searches cap results and say how to narrow them.
  • Server instructions tell the client where the workspace is and how relative paths resolve.

Install

npm install
npm run package                      # → dist/workspace-tools-mcp-server.vsix
code --install-extension dist/workspace-tools-mcp-server.vsix

The status bar shows MCP :7823; click it to copy a client configuration. Commands: MCP Server: Restart Server / Stop Server / Show Log / Copy Client Configuration.

Client configuration

Oh-My-Pi (.omp/mcp.json in a project, or ~/.omp/agent/mcp.json), Claude Code (.mcp.json), Cursor and most other clients take the same shape:

{
  "mcpServers": {
    "vscode": {
      "type": "http",
      "url": "http://127.0.0.1:7823/mcp",
      "headers": { "Authorization": "Bearer <token, if you set one>" }
    }
  }
}

Settings

Setting Default
vscodeMcpServer.enabled true Start with VS Code
vscodeMcpServer.host 127.0.0.1 Bind address. A non-loopback address requires a token
vscodeMcpServer.port 7823 Next free port up to +10 is used if taken (one server per window)
vscodeMcpServer.authToken "" Require Authorization: Bearer <token>; also read from VSCODE_MCP_TOKEN
vscodeMcpServer.enableRunCommand true Expose run_command
vscodeMcpServer.enableWriteTools true Expose write_file and edit_file

Security

run_command and the write tools give a client full control of your user account. The server therefore binds to loopback by default, refuses to listen elsewhere without a token, rejects requests from browsers (any Origin header) unless a token is set, checks the Host header against DNS rebinding, and only runs in trusted workspaces. Paths are not confined to the workspace.

Notes

  • get_diagnostics with a file path opens that file in a background tab (focus is not moved) and closes it again: VS Code's TypeScript extension only checks files that are open in a tab. Without a path it returns what is already known, which normally means open files only.
  • Each POST is handled by a fresh protocol server (stateless mode), so there are no sessions to expire; GET /mcp returns 405. GET /health reports status and the enabled tools.

Tests

The test harness runs real VS Code (desktop build, on Xvfb) in Docker with the packaged extension and a small sample workspace (a Python module with a failing test, a TypeScript file with a type error), then:

npm run test:container   # build the .vsix and image, start the container on 127.0.0.1:7823
npm run test:protocol    # 38 protocol checks with the MCP SDK client: schemas, every tool, error paths, auth
npm run test:e2e         # Oh-My-Pi agent tasks, each verified inside the container with docker exec
npm run test:e2e -- --model omlx/Inkling-2-Mini-oQ4e-mtp   # any omp model
node test/mcp-call.mjs read_file '{"path":"README.md"}'  # call one tool by hand

The e2e suite gives omp only the MCP tools, and the workspace exists only inside the container, so every action goes through the extension. Scenarios: find all uses of a symbol (read-only), fix a failing unit test without touching the tests, fix a TypeScript error using get_diagnostics, and add a method plus a test (checked by a hidden test). Results and transcripts go to test/.results/.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft