How acomagu/vscode-as-mcp-server works
Main Components
• VSCode Extension Core: This is the primary component that initializes the MCP server inside VSCode. It contains the extension entry point (packages/extension/src/extension.ts) along with several submodules.
• Built-in MCP Server & Tools: These include the various tools for code editing, diagnostics, terminal operations, preview URL, and other commands (e.g., execute_command, code_checker, list_directory) located in packages/extension/src/tools and packages/extension/src/integrations.
• Transport Layers: Modules such as bidi-http-transport, sock-transport, and sse-transport that likely handle the communication between the extension and the client (e.g., LLM or Claude Desktop) should be shown as separate components.
• Terminal Integration: Detail the integration modules (in packages/extension/src/integrations/terminal) which manage terminal processes, output extraction, and the terminal registry for command execution.
• Relay Module: Represent the relay package (packages/relay) that functions to expose or integrate other MCP servers and acts as an experimental bridge to external tools.
Relationships and Interactions
• The Extension Core initializes the MCP server and registers the different tools.
• The MCP server interacts with the Transport Layers to handle external communications with MCP clients.
• The Core then forwards requests to dedicated modules:
– Code operations and diagnostics are handled via the code editing support tools.
– Terminal-related requests are channeled to the Terminal Integration component.
– URL preview and file operations are managed by their designated tools under packages/extension/src/tools.
• The Relay package stands as an optional branch that receives inputs either directly or via the extension core to expose built-in MCP services externally.
Architectural Patterns & Design Principles
• Modularity: The project is split into multiple packages (extension and relay) and clearly divided between integration, transport, and utility modules.
• Command Pattern: The way tool commands (execute_command, code_checker, etc.) are designed and invoked hints at an MVC or command pattern architecture.
• Separation of Concerns: Each module (e.g., transport, terminal, tools) handles a particular aspect of the extension’s functionality.
Incorporating Technologies & Frameworks
• VSCode Extension API – the integration point that ties all the components together.
• TypeScript is used throughout with associated configuration (tsconfig.json files).
• Build tools including webpack (webpack.config.js) and build scripts (build.js in the extension package).
• Testing frameworks indicated by the presence of test directories and files.