Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@VSCode Automation MCPopen the Problems panel and list all current errors"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
VSCode Automation MCP Server
A Model Context Protocol (MCP) server that enables AI agents to automate and control VSCode: give your AI assistant the ability to interact with the VSCode UI, execute commands, inspect the DOM, read editor content, and perform complex automation workflows.
Built on top of vscode-extension-tester, this mcp server is ideal for:
AI-assisted VSCode extension development - Let AI agents test and interact with your extensions
Automated UI testing - Build automation scripts driven by AI
Development workflow automation - Automate repetitive VSCode tasks
Extension debugging - Inspect UI state, DOM structure, and diagnostics
🚀 Features
DOM Inspection - Get the full DOM structure, UI regions, and accessibility tree for AI understanding
Execute VSCode Commands - Run any command from the Command Palette programmatically
UI Automation - Click elements, type text, navigate the UI
Keyboard Input - Press key combinations, shortcuts, and special keys
File Operations - Open files at specific lines and columns
Screenshots - Capture the VSCode window for debugging and verification
Element Inspection - Get detailed information about UI elements
Element Queries - Find multiple elements matching selectors with attributes
JavaScript Execution - Run arbitrary JS in the VSCode window (like DevTools console)
Diagnostics - Access errors and warnings from the Problems panel
Editor Content - Read and verify editor content
Webview Support - Interact with extension webviews
Wait & Synchronization - Wait for elements, text, or idle state
Notifications - Get, dismiss, and handle notifications
Dialogs - Handle InputBox, QuickPick, and confirmation dialogs
IntelliSense - Trigger completions, get items, select suggestions
Code Navigation - Go to definition, hover tooltips, signature help
Context Menus - Open and interact with context menus
Output Channels - Read from VSCode output channels and extension logs
Console Logs - Capture and filter browser console logs
Performance Metrics - Memory usage, DOM stats, timing info
📋 Requirements
Node.js >= 18.0.0
Internet connection (for first run to download VSCode and ChromeDriver)
Note: The server automatically downloads a standalone VSCode instance and matching ChromeDriver on first run. It does NOT use your installed VSCode - this ensures consistent behavior and prevents conflicts with your main VSCode instance.
📦 Installation
Quick Start (Recommended)
No installation required! Just add to your MCP client configuration:
Global Installation
Then run directly:
From Source
⚙️ Configuration
Claude Desktop
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Or if installed globally:
VSCode (GitHub Copilot / Copilot Chat)
Add to your VSCode settings.json or .vscode/mcp.json:
Cursor
Add to Cursor's MCP configuration:
Environment Variables
You can customize the server behavior using environment variables:
Variable | Description | Default |
| VSCode version to download (e.g., |
|
| Directory to store VSCode and ChromeDriver | System temp dir |
| Set to |
|
| Log level: |
|
Example with environment variables:
ChromeDriver Compatibility: The server automatically downloads the correct ChromeDriver version that matches the VSCode/Electron version. You don't need to manage ChromeDriver manually.
🛠️ Available Tools
Command Tools
Tool | Description |
| Execute any VSCode command with optional arguments |
| List available VSCode commands with optional filter |
UI Action Tools
Tool | Description |
| Click a UI element by CSS/XPath/accessibility selector |
| Type text into an input field or focused element |
| Open a file in the editor at a specific line/column |
Inspection Tools
Tool | Description |
| Capture a screenshot of the VSCode window |
| Get properties and text of a UI element |
| Open an extension's webview panel |
| Get all diagnostic messages from Problems panel |
DOM Inspection Tools
Tool | Description |
| Get the full DOM structure of VSCode in tree, HTML, or JSON format |
| Get structure of specific UI regions (sidebar, editor, panel, etc.) |
| Find all elements matching a CSS selector with attributes |
| Get the semantic accessibility tree with ARIA roles and labels |
DOM Navigation Tools
Tool | Description |
| Get direct children or descendants of an element for incremental exploration |
| Get the parent chain (ancestors) of an element |
| Get sibling elements at the same level |
| Find all buttons, inputs, links, tabs within a container |
| Search DOM by text, ID, class, aria-label, title, or role |
| Dump full DOM to a file for incremental exploration by AI |
JavaScript Execution & DOM Query Tools
Tool | Description |
| Execute arbitrary JavaScript in the VSCode window (like DevTools console) |
| Direct document.querySelector() / querySelectorAll() wrapper |
| Get element by ID (document.getElementById wrapper) |
| Get elements by class name (document.getElementsByClassName wrapper) |
| Get elements by tag name (document.getElementsByTagName wrapper) |
Testing Tools
Tool | Description |
| Get the current editor's text content |
| Verify UI element presence and state |
| Assert text content in editor or elements |
| Check if a specific file is open |
Keyboard & Input Tools
Tool | Description |
| Press keyboard keys or key combinations (Ctrl+S, Ctrl+Shift+P, Enter, Escape, etc.) |
| Focus a UI element by CSS selector |
| Scroll an element in a direction or to top/bottom |
| Drag and drop between elements |
| Hover over an element for a duration |
Wait & Sync Tools
Tool | Description |
| Wait for an element to appear or disappear |
| Wait for text to appear or disappear in an element |
| Wait for VSCode to become idle (no pending operations) |
Notification & Dialog Tools
Tool | Description |
| Get all visible notifications with type, message, and actions |
| Dismiss a notification by index or message text |
| Handle modal dialogs (InputBox, QuickPick, confirmations) |
| Get items from the QuickPick/Command Palette |
| Select a QuickPick item by text or index |
Extension Testing Tools
Tool | Description |
| Trigger hover on an element and get tooltip content |
| Open context menu (right-click) on an element |
| Get items from visible menus |
| Click a menu item by text |
| Get currently visible tooltip content |
| Trigger IntelliSense/code completion (Ctrl+Space) |
| Get IntelliSense completion items |
| Select and accept a completion item |
| Get problems from Problems panel with severity and location |
| Trigger Go to Definition (F12) |
| Trigger signature help (Ctrl+Shift+Space) |
Debug & Performance Tools
Tool | Description |
| Get captured console logs (log, info, warn, error, debug) |
| Clear captured console logs |
| List available output channels |
| Read content from an output channel |
| Get performance metrics (memory, timing, DOM stats) |
| Get extension-related logs, optionally filtered by extension ID |
| Get DevTools-style window/document/navigator info |
Utility Tools
Tool | Description |
| Pre-initialize the VSCode driver |
| Get the current driver status |
📖 Usage Examples
Execute a Command
Click UI Elements
Type Text
Open Files
Take Screenshots
Get Diagnostics
Inspect the DOM (for AI Agents)
Incremental DOM Exploration (for Large DOMs)
Execute JavaScript (DevTools Console Style)
Simple DOM Queries (querySelector style)
Keyboard & Input
Waiting & Synchronization
Notifications & Dialogs
IntelliSense & Code Navigation
Debug & Performance
Verify UI State
Get Editor Content
🔧 Common Command IDs
Here are some frequently used VSCode command IDs:
File Operations
workbench.action.files.save- Save fileworkbench.action.files.saveAll- Save all filesworkbench.action.files.newUntitledFile- New fileworkbench.action.closeActiveEditor- Close editor
Navigation
workbench.action.quickOpen- Quick Open (Ctrl+P)workbench.action.gotoLine- Go to Lineeditor.action.revealDefinition- Go to Definition
View
workbench.action.toggleSidebarVisibility- Toggle Sidebarworkbench.action.togglePanel- Toggle Panelworkbench.action.terminal.toggleTerminal- Toggle Terminal
Editor
editor.action.formatDocument- Format Documenteditor.action.commentLine- Toggle Line Comment
Git
git.commit- Git Commitgit.push- Git Pushgit.pull- Git Pull
🧪 Testing the MCP Server
Manual Testing
Build the project:
npm run build npm run validateTest with MCP Inspector (recommended):
npx @modelcontextprotocol/inspector node dist/index.jsThis opens a web UI where you can call each tool interactively.
Test with Claude Desktop:
Add the server to your Claude Desktop config (see Configuration section)
Restart Claude Desktop
Ask Claude to use the vscode_automation tools
Test basic functionality:
# Start the server manually to check for startup errors node dist/index.jsThe server communicates via stdio, so you won't see output unless there are errors.
What Gets Tested
vscode_get_status- Always works, returns server statevscode_initialize- Launches VSCode with WebDriver (requires display)All other tools - Require
vscode_initializeto be called first
Notes on Testing
The server uses vscode-extension-tester which launches a real VSCode instance
First run may take time to download ChromeDriver
VSCode must be installed on the system
Requires a display (or virtual display on Linux)
🐛 Troubleshooting
VSCode Not Found
Make sure VSCode is installed and accessible from the command line:
ChromeDriver Issues
The server uses ChromeDriver to automate VSCode. If you encounter issues:
Make sure Chrome/Chromium is installed
The correct ChromeDriver version will be downloaded automatically
Check that no other automation tools are conflicting
Timeout Errors
If operations are timing out:
Increase the timeout in the tool options
Make sure VSCode has finished loading
Call
vscode_initializebefore other operations
Element Not Found
If selectors aren't finding elements:
Use
vscode_take_screenshotto see the current stateTry different selector types (css, xpath, accessibility, text)
Check if the element is in a webview (requires different handling)
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add some amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
Model Context Protocol - The protocol that makes this possible
MCP TypeScript SDK - The SDK used to build this server
vscode-extension-tester - The automation library powering this server
Anthropic - For creating Claude and the MCP specification
Built with ❤️ by Sukarth