UNPKG

vscode-mcp-comprehensive

Version:

Comprehensive MCP server exposing all VSCode features to AI agents with 101 tools including advanced debugging and console access

229 lines (178 loc) โ€ข 7.13 kB
# VSCode MCP Server A comprehensive Model Context Protocol (MCP) server that exposes all VSCode features and settings to AI agents. This extension provides 80+ tools covering every aspect of VSCode functionality, including advanced debugging tools with console access and developer tools integration. ## ๐Ÿš€ Features ### **Complete VSCode API Coverage** - **Workspace Management**: File operations, configuration, folder management - **Editor Operations**: Text manipulation, selections, formatting, folding - **Language Features**: IntelliSense, diagnostics, code actions, symbol navigation - **UI Controls**: Messages, dialogs, status bar, progress indicators - **Terminal Integration**: Terminal creation, command execution, output capture - **Advanced Debugging**: Breakpoints, call stacks, variables, console access - **Developer Tools**: Browser console, network monitoring, performance profiling - **Task Management**: Task execution, monitoring, termination - **Extension Management**: Extension information, configuration, status ### **๐Ÿ› Advanced Debugging Features** - **Debug Session Control**: Start, stop, pause, continue, step debugging - **Breakpoint Management**: Regular, conditional, and logpoint breakpoints - **Variable Inspection**: Local, global, and watch expressions - **Call Stack Analysis**: Frame navigation and inspection - **Console Access**: Debug console, output panels, browser console - **Developer Tools Integration**: Network requests, performance metrics, memory snapshots - **Exception Handling**: Exception breakpoints and error information ### **๐Ÿ“Š 80+ Available Tools** #### Workspace Tools (12 tools) - `workspace_get_folders` - Get all workspace folders - `workspace_read_file` - Read file contents - `workspace_write_file` - Write content to file - `workspace_delete_file` - Delete files - `workspace_get_configuration` - Get settings - `workspace_update_configuration` - Update settings - And more... #### Editor Tools (14 tools) - `editor_get_active` - Get active editor - `editor_get_text` - Get editor content - `editor_set_text` - Replace editor content - `editor_insert_text` - Insert text at position - `editor_format_document` - Format code - And more... #### Language Tools (9 tools) - `language_get_completions` - Get IntelliSense completions - `language_get_hover` - Get hover information - `language_get_definition` - Go to definition - `language_get_diagnostics` - Get errors/warnings - `language_get_code_actions` - Get available fixes - And more... #### Debug Tools (25+ tools) - `debug_start_session` - Start debugging - `debug_add_breakpoint` - Add breakpoints - `debug_console_read` - Read debug console - `debug_get_call_stack` - Get call stack - `debug_evaluate_expression` - Evaluate expressions - `devtools_console_read` - Read browser console - `devtools_network_get_requests` - Monitor network - And more... #### UI Tools (12 tools) - `ui_show_information_message` - Show notifications - `ui_show_input_box` - Show input dialogs - `ui_create_status_bar_item` - Create status items - `ui_show_progress` - Show progress indicators - And more... #### Terminal Tools (8 tools) - `terminal_create` - Create terminals - `terminal_send_text` - Send commands - `terminal_execute_command` - Execute and wait - And more... ## ๐Ÿ“ฆ Installation ### From VSCode Marketplace (Coming Soon) 1. Open VSCode 2. Go to Extensions (Ctrl+Shift+X) 3. Search for "VSCode MCP Server" 4. Click Install ### From Source 1. Clone this repository 2. Run `npm install` 3. Run `npm run compile` 4. Press F5 to run in development mode ## ๐Ÿ› ๏ธ Configuration Configure the extension in your VSCode settings: ```json { "vscode-mcp-server.port": 3000, "vscode-mcp-server.autoStart": true, "vscode-mcp-server.enableDebugTools": true, "vscode-mcp-server.enableDeveloperTools": true } ``` ### Configuration Options - **`port`**: Port for the MCP server (default: 3000) - **`autoStart`**: Automatically start server on VSCode startup (default: true) - **`enableDebugTools`**: Enable advanced debugging tools (default: true) - **`enableDeveloperTools`**: Enable developer tools integration (default: true) ## ๐Ÿš€ Usage ### Starting the Server The server starts automatically by default. You can also control it manually: - **Command Palette**: `VSCode MCP Server: Start` - **Command Palette**: `VSCode MCP Server: Stop` - **Command Palette**: `VSCode MCP Server: Restart` - **Command Palette**: `VSCode MCP Server: Status` ### Using with AI Agents Once running, AI agents can connect to the MCP server and use any of the 80+ available tools: ```typescript // Example: Reading a file const result = await mcpClient.callTool('workspace_read_file', { uri: 'file:///path/to/file.ts' }); // Example: Getting completions const completions = await mcpClient.callTool('language_get_completions', { uri: 'file:///path/to/file.ts', position: { line: 10, character: 5 } }); // Example: Starting debug session const debugSession = await mcpClient.callTool('debug_start_session', { configuration: { type: 'node', request: 'launch', program: '${workspaceFolder}/app.js' } }); // Example: Reading debug console const consoleOutput = await mcpClient.callTool('debug_console_read', { lines: 50 }); ``` ## ๐Ÿงช Testing Run the comprehensive test suite: ```bash npm test ``` The test suite includes: - Unit tests for all tool categories - Integration tests with VSCode APIs - Error handling validation - Configuration testing ## ๐Ÿ“š API Documentation ### Tool Categories 1. **Workspace Tools**: File system operations, configuration management 2. **Editor Tools**: Text editing, selection management, formatting 3. **Language Tools**: IntelliSense, diagnostics, code navigation 4. **UI Tools**: User interface interactions, notifications, dialogs 5. **Terminal Tools**: Terminal management and command execution 6. **Debug Tools**: Comprehensive debugging with console access 7. **Command Tools**: VSCode command execution and registration 8. **Task Tools**: Task management and execution 9. **Extension Tools**: Extension information and management ### Error Handling All tools return standardized responses: ```typescript // Success response { content: [{ type: 'text', text: 'Result data or message' }] } // Error response { content: [{ type: 'text', text: 'Error: Description of the error' }], isError: true } ``` ## ๐Ÿค Contributing 1. Fork the repository 2. Create a feature branch 3. Make your changes 4. Add tests for new functionality 5. Run the test suite 6. Submit a pull request ## ๐Ÿ“„ License MIT License - see LICENSE file for details. ## ๐Ÿ”— Links - [Model Context Protocol](https://modelcontextprotocol.io/) - [VSCode Extension API](https://code.visualstudio.com/api) - [Issues](https://github.com/your-repo/vscode-mcp-server/issues) ## ๐ŸŽฏ Roadmap - [ ] WebView integration tools - [ ] Git/SCM operation tools - [ ] Notebook API integration - [ ] Custom language server tools - [ ] Performance optimization - [ ] Real-time collaboration features --- **Made with โค๏ธ for the AI development community**