How tjx666/vscode-mcp works
Project Type and Purpose
• This is a monorepo open-source tool (VSCode extension + accompanying server + IPC library) that “bridges” VSCode’s LSP and API into the MCP (Model Context Protocol) ecosystem for AI coding assistants.
• Its goal is to let external AI clients (Cursor, Copilot, Claude, etc.) call VSCode real-time services (diagnostics, hover, navigation, execute commands, AI agent calls) via a standard MCP protocol.
File Structure
• Top-level: project configuration (.github CI, eslint, pnpm workspace).
• packages/vscode-mcp-bridge: The VSCode Extension (TypeScript) that opens a Unix socket and exposes LSP & API calls to local clients.
• packages/vscode-mcp-ipc: A small TypeScript library defining events & dispatchers for type-safe JSON communication over the socket.
• packages/vscode-mcp-server: A CLI “MCP Server” (JSON-RPC stdio endpoint) that translates MCP calls into function calls to the IPC layer.
Key Architecture Details from README
• Three main modules:
a. MCP Client (external AI agent) speaks JSON-RPC over stdio.
b. MCP Server (Node CLI) uses the vscode-mcp-ipc library.
c. VSCode Extension (vscode-mcp-bridge) listens on a Unix socket, implements calls via VSCode API & LSP.
• Communication flows:
• JSON-RPC (stdio) ↔ MCP Server
• Function calls ↔ IPC Layer
• JSON over Unix socket ↔ VSCode Extension
• Extension ↔ VSCode API & LSP
Components
• External “MCP Client” (Cursor, GitHub Copilot, etc.)
• MCP Server
• JSON-RPC endpoint (stdio)
• Calls into vscode-mcp-ipc library
• IPC Layer
• Event definitions & dispatcher
• Unix socket transport
• VSCode Extension
• Socket listener
• VSCode API calls & LSP integration
• VSCode’s Language Server Protocol & Extension API
Architectural Patterns & Principles
• Modular layering: clear separation of concerns (client ↔ server ↔ IPC ↔ extension ↔ IDE)
• Protocol-adapter pattern: JSON-RPC ↔ internal calls ↔ socket transport ↔ VSCode API
• Type-safe event definitions in ipc package
• Per-workspace socket to isolate multi-window environments
Relevant Technologies & Frameworks
• Node.js + TypeScript
• VSCode Extension API
• Language Server Protocol (LSP) via VSCode
• JSON-RPC (protocol for MCP Server)
• Unix domain sockets for IPC
• pnpm monorepo
Final Checklist
• Components clearly named and grouped
• Call/response flows in correct order
• Notes on extensibility points for open-source contributors