Skip to main content
Glama
opencode VS Code Pipe Bridge

opencode VS Code Pipe Bridge

opencode VS Code Pipe Bridge

CI License: MIT

Give an external MCP agent (opencode, Claude Desktop, Cursor, or any MCP client) control of your VS Code window over a named pipe or Unix domain socket instead of TCP.

This exists because localhost is not always yours. Transparent proxies, corporate MITM appliances, and sandbox tools can intercept loopback TCP and turn a working editor bridge into 502 Bad Gateway and hangs. Kernel IPC sidesteps that entirely.

Why not just use a localhost port?

  • Many editor MCP bridges bind 127.0.0.1:<port>. If anything intercepts loopback (e.g. a proxy with "proxy localhost" enabled), the handshake fails.

  • Named pipes (Windows) and Unix domain sockets (macOS/Linux) are not TCP and are not routed through HTTP proxies.

  • The endpoint is token-gated and the token lives in a user-only file, so other local users cannot trivially connect.

Related MCP server: vscode-mcp-api

How it works

┌──────────────┐   stdio JSON-RPC   ┌────────────┐   pipe / socket   ┌───────────────┐
│  MCP client  │ ◄────────────────► │    shim    │ ◄───────────────► │  VS Code ext. │
│  (opencode)  │  newline-delimited │  (Node.js) │   token auth      │ (extension.js)│
└──────────────┘                    └────────────┘                   └───────────────┘
  • The extension serves MCP on \\.\pipe\ocvscode-<id> (Windows) or <runtime-dir>/ocvscode-<id>.sock (macOS/Linux), where <id> = sha1(normalized workspace path)[0:12].

  • It writes %LOCALAPPDATA%\opencode-vscode-pipe\<id>.json (or $XDG_RUNTIME_DIR/opencode-vscode-pipe/<id>.json) with the endpoint and a random token.

  • The shim discovers that file, authenticates, and proxies JSON-RPC. If the editor is not running it stays connected in a degraded mode so your agent session survives a restart.

See docs/ARCHITECTURE.md for the protocol details.

Tools

Tool

What it does

get_workspace_state

Folders, active file, selection text, open editors

list_commands

List VS Code command IDs (filterable)

execute_command

Run any VS Code command (privileged)

get_diagnostics

Problems from language servers

open_file

Open a file at a line/column

show_diff

Diff editor between two files

run_in_terminal

Send text to an integrated terminal (not captured)

get_document_symbols

Symbol outline

go_to_definition

Definition at a position

find_references

References at a position

get_hover

Hover / type info

get_code_actions

Quick fixes and refactors

rename_symbol

Rename and apply the workspace edit

add_breakpoint

Add a source breakpoint

list_debug_configurations

Launch configurations

start_debugging

Start a debug session by name

stop_debugging

Stop the active session

Lines are 1-based; characters are 0-based.

Requirements

  • VS Code 1.80 or newer (desktop).

  • Node.js 18+ for the shim (opencode ships with a suitable runtime).

Install

From a release

Download the .vsix from Releases, then either:

code --install-extension opencode-vscode-pipe.vsix

or use Extensions: Install from VSIX... in the Command Palette. Reload the window when prompted.

From source

git clone https://github.com/sadguychronicle/opencode-vscode-pipe.git
cd opencode-vscode-pipe
npm run package
code --install-extension dist/opencode-vscode-pipe.vsix

Configure opencode

  1. Open the Command Palette and run opencode Pipe: Copy opencode MCP Config. This copies a ready-to-paste block and writes the shim to a stable path.

  2. Paste it under the top-level mcp key of your opencode config, for example:

{
  "mcp": {
    "vscode-pipe": {
      "type": "local",
      "command": ["node", "C:\\Users\\<you>\\AppData\\Local\\opencode-vscode-pipe\\shim.js"],
      "enabled": true
    }
  }
}
  1. Restart opencode and check the connection:

opencode mcp list
# ✓ vscode-pipe connected

The shim is copied into the registry directory on activation, so the path stays the same across extension updates. On macOS/Linux the path is under $XDG_RUNTIME_DIR/opencode-vscode-pipe/shim.js (or the system temp dir).

Security

This is remote control for your editor. Read SECURITY.md.

  • Local IPC only; no TCP port is opened.

  • Token-authenticated; token stored in a user-only (0600) file.

  • execute_command and run_in_terminal can run arbitrary code.

  • Tool output is untrusted input; beware prompt injection from repositories.

  • Disable the extension when you are not using an agent.

Compatibility

  • Windows: named pipes. macOS/Linux: Unix domain sockets.

  • The extension declares extensionKind: ["workspace"], so in Remote/SSH/WSL windows it runs on the remote. The MCP client must run in the same environment as the extension to reach the pipe/socket.

  • One endpoint per window, keyed to the first workspace folder.

Development

npm run check    # node --check on both entrypoints
npm test         # unit + shim integration tests (node:test)
npm run package  # build dist/*.vsix with @vscode/vsce

No runtime dependencies; nothing to bundle.

Publishing

Tagged releases (v*) are packaged in CI. To publish automatically, add repository secrets:

  • VSCE_PAT for the VS Code Marketplace

  • OVSX_TOKEN for Open VSX

The release workflow publishes only the marketplaces whose token is present and always attaches the VSIX to the GitHub release.

Limitations

  • Only the first workspace folder per window is exposed.

  • run_in_terminal is fire-and-forget; it does not capture output.

  • Language features depend on a language server being active.

  • No TCP fallback by design.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to interact with VS Code's language server protocol features (definitions, references, diagnostics) and debugger (breakpoints, stepping, variable inspection) via an MCP server.
      1
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables MCP clients and AI coding agents to pull real-time editor intelligence from a running VSCode instance, including LSP diagnostics and hover/definition/signature info, symbol references with usage context, workspace-wide renames, and file opening across open workspaces. This replaces slow tsc/eslint/build round-trips with instant language-server results over a per-workspace socket.
      -
    • A
      license
      Not graded
      quality
      F
      maintenance
      Enables external MCP clients to discover and read a trusted VS Code workspace, inspect diagnostics and symbols, preview and apply conflict-safe edits, and run individually approved terminal commands through a local authenticated bridge.
      MIT