An open API service indexing awesome lists of open source software.

https://github.com/tjx666/vscode-mcp

MCP server for Cloud Code/VSCode/Cursor/Windsurf to use editor self functionality. ⚡ Get real-time LSP diagnostics, type information, and code navigation for AI coding agents without waiting for slow tsc/eslint checks.
https://github.com/tjx666/vscode-mcp

agent ai claude cursor eslint language-server-protocol lint llm lsp mcp mcp-server stylelint tsc typescript vscode vscode-extension windsurf

Last synced: 10 months ago
JSON representation

MCP server for Cloud Code/VSCode/Cursor/Windsurf to use editor self functionality. ⚡ Get real-time LSP diagnostics, type information, and code navigation for AI coding agents without waiting for slow tsc/eslint checks.

Awesome Lists containing this project

README

          

# VSCode MCP


VSCode MCP


Connect VSCode with MCP (Model Context Protocol) for enhanced AI assistant capabilities


Design Motivation
Available Tools
Installation
Architecture
License

[![MCP Badge](https://lobehub.com/badge/mcp/tjx666-vscode-mcp)](https://lobehub.com/mcp/tjx666-vscode-mcp) ![CI](https://github.com/tjx666/vscode-mcp/actions/workflows/vscode-extension-ci.yml/badge.svg) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](http://makeapullrequest.com) [![Github Open Issues](https://img.shields.io/github/issues/tjx666/vscode-mcp)](https://github.com/tjx666/vscode-mcp/issues) [![LICENSE](https://img.shields.io/badge/license-Anti%20996-blue.svg?style=flat-square)](https://github.com/996icu/996.ICU/blob/master/LICENSE)

## Overview

VSCode MCP is a comprehensive monorepo solution that enables MCP (Model Context Protocol) clients to access rich VSCode context information in real-time. This project bridges the gap between AI assistants and your development environment, providing accurate code analysis, diagnostics, and intelligent code navigation.

## Design Motivation

**VSCode MCP Bridge primarily serves AI IDEs (like Cursor) and AI coding agents**, helping them develop and analyze code more efficiently.

Traditional AI coding agents often need to execute time-consuming commands when validating code modifications:

- `tsc --noEmit` - TypeScript type checking
- `eslint .` - Code style checking
- `npm run build` - Project building

These commands run slowly in large projects, severely impacting AI development efficiency. VSCode MCP Bridge provides real-time LSP (Language Server Protocol) information, allowing AI agents to:

- **Get fast diagnostics** (`get-diagnostics`) - Replace time-consuming type checking and lint commands
- **Access real-time type information** (`get-hover`) - Get accurate type definitions without compilation
- **Navigate code efficiently** (`get-definition`, `get-references`) - Understand code structure and dependencies
- **Call IDE AI agents** (`call-agent`) - Integrate with built-in AI assistants like Cursor Composer, GitHub Copilot, and others

### Core Advantages

1. **Real-time**: Leverage VSCode's LSP for real-time code state without executing slow commands
2. **Accuracy**: Precise analysis based on language servers, more reliable than static analysis
3. **Efficiency**: Significantly reduce AI coding agent wait times
4. **Integration**: Deep integration with VSCode ecosystem, supporting multiple languages and extensions
5. **AI Collaboration**: Enable AI agents to work together by calling IDE-native AI assistants (Cursor Composer, GitHub Copilot, etc.)

## Available Tools

VSCode MCP provides the following tools through the MCP protocol:

| Tool | Description | Parameters |
| ---------------------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------- |
| **call_agent** | Call IDE's AI agent with prompts and context | `prompt`, `files?`, `images?`, `model?`, `mode?`, `ide_type?` |
| **execute_command** | Execute VSCode commands with arguments | `command`, `args?` |
| **get_commands** | Get all available VSCode commands in workspace | `include_internal?`, `filter?`, `category?`, `limit?` |
| **get_definition** | Get symbol definition locations | `uri`, `line`, `character` |
| **get_diagnostics** | Get diagnostic information with Git integration | `uris` (array, empty = all git modified files) |
| **get_hovers** | Get hover information for multiple positions | `positions` (array), `includeAllHovers?` |
| **get_references** | Get symbol reference locations | `uri`, `line`, `character`, `includeDeclaration?` |
| **get_signature_help** | Get function signature help | `uri`, `line`, `character` |
| **health_check** | Test connection and get extension status | None |
| **highlight_code** | Open file and highlight specific code sections | `uri`, `ranges` (array with line numbers, messages, types, colors), `showEditor?`, `timeout?` |
| **open_diff** | Open diff editor to compare files or text | `before?`, `after?`, `beforeText?`, `afterText?`, `beforeLabel?`, `afterLabel?`, `language?` |
| **open_files** | Open multiple files with optional editor display | `files` (array with `uri` and `showEditor?`) |
| **rename_symbol** | Rename symbols across all files in workspace | `uri`, `line`, `character`, `newName` |
| **request_input** | Request simple text input from user | `prompt`, `placeholder?`, `title?`, `password?`, `validateInput?` |

> **⚠️ Security Warning**: The `execute_command` tool can execute arbitrary VSCode commands and potentially trigger dangerous operations. Use with extreme caution and only with trusted AI models.

### AI Agent Integration

The `call_agent` tool enables seamless integration between external AI assistants and IDE-native AI agents. This creates a powerful collaborative AI ecosystem where different AI agents can work together on complex coding tasks.

**Supported IDEs:**

- **Cursor**: Integrates with Cursor Composer for advanced code generation
- **VSCode**: Supports GitHub Copilot, Cline, Continue, and other popular extensions
- **Windsurf**: Integrates with Windsurf's native AI capabilities
- **Trae**: Supports Trae's AI assistant features

**Supported AI Agents:**

- **Cursor Composer**: Advanced code generation and refactoring
- **GitHub Copilot**: Code completion and chat assistance
- **Cline**: Interactive coding assistant with file management
- **Continue**: Open-source coding assistant
- **Roocode & Kilocode**: Specialized coding tools

**Key Features:**

- **Auto-detection**: Automatically detects your IDE and available AI extensions
- **Flexible Input**: Supports text prompts, file attachments, and image inputs
- **Smart Routing**: Chooses the best available AI agent based on capability and priority
- **Cross-platform**: Works across different operating systems and IDE configurations

All tools require the `workspace_path` parameter to target specific VSCode instances.

## Installation

> **🚨 IMPORTANT**: Before installing the MCP server, you must first install the VSCode MCP Bridge extension in your VSCode instance. The extension is required for the MCP server to communicate with VSCode.

### Step 1: Install VSCode Extension

Install the VSCode MCP Bridge extension using ID: `YuTengjing.vscode-mcp-bridge`

[![Install VSCode Extension](https://img.shields.io/badge/VSCode%20Marketplace-Install%20Extension-007ACC?style=for-the-badge&logo=visualstudiocode)](https://marketplace.visualstudio.com/items?itemName=YuTengjing.vscode-mcp-bridge)

Or search for "VSCode MCP Bridge" in the VSCode Extensions marketplace.

### Step 2: Install MCP Server

#### Install in Cursor ✅ Tested

##### ⚠️ Gemini 2.5 Pro Compatibility Note

The `execute_command` tool is currently not compatible with Gemini 2.5 Pro in Cursor due to potential security restrictions. If you plan to use Gemini 2.5 Pro, it is **highly recommended** to disable this tool to prevent any issues.

You can disable it by adding a command-line argument to the MCP server configuration in Cursor's settings.

1. Go to `Cursor Settings` -> `Tools & Integrations`.
2. Find your `vscode-mcp` server configuration and click `Edit`.
3. In the `args` array, add the following argument: `"--disable-tools=execute_command"`
4. Your final config should look similar to this:

```json
{
"mcpServers": {
"vscode-mcp": {
"command": "npx",
"args": ["@vscode-mcp/vscode-mcp-server@latest", "--disable-tools=execute_command"]
}
}
}
```

This will prevent the `execute_command` tool from being registered with the server, ensuring compatibility with Gemini 2.5 Pro.

##### Click the button to install

[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=vscode-mcp&config=eyJjb21tYW5kIjoibnB4IEB2c2NvZGUtbWNwL3ZzY29kZS1tY3Atc2VydmVyQGxhdGVzdCJ9)

##### Or install manually

Go to `Cursor Settings` -> `Tools & Integrations` -> `New MCP Server`. Name to your liking, use `command` type with the command `npx @vscode-mcp/vscode-mcp-server@latest`. You can also verify config or add command line arguments via clicking `Edit`.

```json
{
"mcpServers": {
"vscode-mcp": {
"command": "npx",
"args": ["@vscode-mcp/vscode-mcp-server@latest"]
}
}
}
```

## Architecture

VSCode MCP follows a modular architecture with three main components communicating through Unix sockets:

```mermaid
graph TB
subgraph "MCP Client"
Client[AI Assistant
Cursor/Claude/etc]
end

subgraph "vscode-mcp-server"
Server[MCP Server
Protocol Implementation]
end

subgraph "vscode-mcp-ipc"
IPC[IPC Layer
Type-safe Communication]
Socket[Unix Socket
Cross-platform]
end

subgraph "VSCode Instance"
Extension[VSCode Extension
vscode-mcp-bridge]
LSP[Language Server Protocol]
API[VSCode API]
end

Client <-->|JSON-RPC
stdio| Server
Server <-->|TypeScript
Function Calls| IPC
IPC <-->|JSON
Unix Socket| Socket
Socket <-->|Local Connection| Extension
Extension <-->|Extension API| API
Extension <-->|Diagnostics
Navigation| LSP

classDef client fill:#e1f5fe
classDef server fill:#f3e5f5
classDef ipc fill:#e8f5e8
classDef vscode fill:#fff3e0

class Client client
class Server server
class IPC,Socket ipc
class Extension,LSP,API vscode
```

### Communication Flow

1. **MCP Client** sends requests via JSON-RPC over stdio
2. **MCP Server** translates requests to TypeScript function calls
3. **IPC Layer** handles type-safe communication and validation
4. **Unix Socket** provides fast, local-only communication
5. **VSCode Extension** executes operations using VSCode APIs
6. **LSP Integration** provides real-time code analysis and navigation

### Multi-Workspace Support

Each VSCode workspace gets its own socket connection:

- `/Users/user/frontend` → `/tmp/vscode-mcp-a1b2c3d4.sock`
- `/Users/user/backend` → `/tmp/vscode-mcp-e5f6g7h8.sock`

### How It Works

Once installed and configured, VSCode MCP works seamlessly with MCP-compatible clients:

1. **VSCode Extension**: Runs in your VSCode instance and provides access to LSP data
2. **MCP Server**: Translates MCP protocol calls to VSCode extension requests
3. **Socket Communication**: Uses Unix sockets for fast, local-only communication
4. **AI Integration**: MCP clients can access real-time code context through standard tools

The system operates transparently - MCP clients use standard tool calls, and VSCode MCP handles all the complexity of communicating with VSCode's APIs.

All tools require the `workspace_path` parameter to target specific VSCode instances. Each VSCode workspace gets its own socket connection for multi-window support.

## License

This project is licensed under the [Anti 996](https://github.com/996icu/996.ICU/blob/master/LICENSE) License.