vscode-playwright-mcp
Gives LLMs full control over VS Code — click UI elements, type code, run commands, take screenshots, read editor state, and record GIFs.
README
vscode-playwright-mcp
A VS Code-aware layer on top of @playwright/mcp. Gives LLMs full control over VS Code — click UI elements, type code, run commands, take screenshots, read editor state, and record GIFs.
Use cases:
- E2E testing of VS Code extensions
- Automated VS Code workflows and tasks
- AI-driven code editing and refactoring
- Interactive demos and tutorials
- Testing themes, keybindings, and settings
How It Works
Built on top of @playwright/mcp, which provides generic Electron automation (click, type, screenshot, etc.). We add a VS Code-specific layer: isolated launch with temp user-data-dir, command palette automation, editor state scraping, and Monaco-aware tools.
Generic tools from @playwright/mcp are aliased to vscode_* names for a unified LLM experience. Before vscode_launch, only 1 tool is visible (lazy discovery saves ~10k context tokens). After launch, all 26 tools appear.
Requirements
- Node.js >= 22
- VS Code installed locally (auto-detected on macOS and Linux)
Quick Start
{
"mcpServers": {
"vscode": {
"command": "npx",
"args": ["-y", "vscode-playwright-mcp"]
}
}
}
Custom VS Code binary:
{
"mcpServers": {
"vscode": {
"command": "npx",
"args": ["-y", "vscode-playwright-mcp", "--vscode-path", "/path/to/code"]
}
}
}
Tools
Lifecycle
| Tool | Description |
|---|---|
vscode_launch |
Launch an isolated VS Code instance. Options: workspace, extensions, viewport size, settings. |
vscode_close |
Close VS Code and clean up temp files/processes. |
Vision (aliased from @playwright/mcp)
| Tool | Description |
|---|---|
vscode_screenshot |
Full-window screenshot. |
vscode_snapshot |
Accessibility tree with [ref=eN] annotations on interactive elements. |
vscode_zoom |
Cropped screenshot of a specific region (native — Monaco-aware). |
vscode_find_element |
Search a11y tree by role/name, returns refs (native). |
Mouse & Keyboard (aliased from @playwright/mcp)
| Tool | Description |
|---|---|
vscode_click |
Click by ref, element description, or coordinates. |
vscode_type |
Type text into focused element. |
vscode_press_key |
Press key combinations (e.g., Control+Shift+P). |
vscode_hover |
Hover to reveal tooltips. |
vscode_drag |
Drag from one point to another. |
vscode_click_xy |
Click at exact pixel coordinates. |
vscode_hover_xy |
Hover at exact pixel coordinates. |
vscode_drag_xy |
Drag between exact pixel coordinates. |
vscode_select_option |
Select from dropdown/combobox. |
vscode_fill_form |
Fill form inputs. |
VS Code Commands (native)
| Tool | Description |
|---|---|
vscode_run_command |
Execute a VS Code command via Command Palette automation. |
vscode_ensure_file |
Open and activate a file by path with verification. |
State (native)
| Tool | Description |
|---|---|
vscode_get_state |
Read editor state: active file, cursor, diagnostics, completions, peek widget. |
vscode_get_hover |
Read hover tooltip content as text. |
Advanced (mixed)
| Tool | Description |
|---|---|
vscode_evaluate |
Run JavaScript in the VS Code renderer process (aliased). |
vscode_wait_for |
Wait for selector state, text, or delay (aliased). |
vscode_console |
Retrieve console messages from renderer (aliased). |
vscode_resize |
Resize the VS Code window and viewport (native). |
vscode_scroll |
Scroll up/down by amount (native). |
vscode_gif |
Record actions as animated GIF (native). |
Interaction Strategies
-
Ref-based (preferred for UI):
vscode_snapshot→ see[ref=eN]annotations →vscode_click(ref="e5"). Deterministic, no coordinate guessing. -
Keyboard-first (preferred for navigation):
vscode_snapshot→ see shortcuts →vscode_press_key. Fastest for commands. -
Visual (required for editor content): Monaco editor is opaque to accessibility APIs.
vscode_screenshotorvscode_zoom→ read the image →vscode_click_xy(x, y).
How is this different from Playwright MCP?
This project is built on top of @playwright/mcp, not a replacement. Playwright MCP provides generic Electron automation. We add:
- Isolated VS Code launch with temp user-data-dir, suppressed Welcome tab, settings injection
- Command palette automation (
vscode_run_command) — execute commands by name - Editor state scraping (
vscode_get_state) — cursor, diagnostics, completions, peek widget - Monaco-aware tools (
vscode_zoom,vscode_find_element) — the editor is invisible to generic a11y tools - Lazy tool discovery — 1 tool visible before launch, all ~26 after (saves context tokens)
- GIF recording of VS Code sessions
Development
npm run build # Build with tsup
npm run dev # Build in watch mode
npm test # Run unit tests (vitest)
npm run test:integration # Run integration tests (requires VS Code)
npm run test:e2e # Run E2E tests (full MCP protocol loop)
npm run typecheck # Type-check with tsc
npm run lint # Lint with ESLint
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。