Supercharging AI-Powered Code Editing with VSC-MCP - Part One
See all posts

Supercharging AI-Powered Code Editing with VSC-MCP - Part One

ai
developer-tools
model-context-protocol
lsp
vsc-mcp

Ever asked an AI assistant to change a function logic, and instead of simple update, it ends up rewriting chunks of unrelated code? remove code that works? Or maybe your shiny new AI coding assistant spends more time saying “Let me have a look…” than actually editing anything? I’ve been there too.

That’s exactly why I started building VSC-MCP.

The Problem

Today’s AI editors like Windsurf or Cursor can be magical when working on small files or simple projects.

But as your codebase grows—think monorepo or anything with hundreds of files, they start to break down.

You’ve probably seen it:

  • AI assistants saying “Analyzing project…” and just spinning
  • Missed or incorrect refactors because the AI didn’t have proper symbol resolution
  • A simple rename turning into a 5-minute operation
  • And worst of all, hallucinated edits because the AI lacks precision in file editing context

These issues stem from a simple limitation: these tools don’t have targeted, programmatic access to the Language Server Protocol (LSP) understanding of the code.

They operate by guessing structure from plain text, instead of working with the actual code model.

The VSC-MCP Approach

That’s where VSC-MCP comes in. The idea is simple: give AI clients (like Claude Desktop and Cursor, virtually anyone that can use MCP) the right tools to work with your code—tools that integrate directly with Language Server Protocol (LSP) features and expose them via Model Context Protocol (MCP).

The core idea is to allow AI-driven actions like:

  • Editing symbols (functions, methods, classes, variables)
  • Reading and modifying files safely
  • Navigating and identifying symbols
  • Automating content replacements

This simplifies tasks such as automated refactoring, AI-driven code reviews, and intelligent code manipulation.

By targeting symbols instead of entire files, VSC-MCP significantly reduces hallucinations and makes AI edits surgical and reliable.

Why LSP + MCP?

LSP is already the foundation of many modern editors like VS Code. It knows your codebase deeply: all definitions, references, usages, diagnostics—it’s basically the brain behind IntelliSense.

MCP builds on this by wrapping these LSP capabilities into tool interfaces that AI can understand and invoke safely and precisely.

Instead of asking AI to read a whole file and rewrite it with the updated content, we give it the power to say:

Find the implementation of fetchUserData, and update its signature to include a new options parameter.

That’s a real instruction the MCP tool can handle, and it will update the right places without touching unrelated code.

Real-World Use Case

Let’s say Claude Desktop is connected to a repo with thousands of files. It wants to rename a method and update all its call sites.

Without VSC-MCP:

  • Claude scrapes the code text.
  • Tries to guess what needs changing.
  • Often misses call sites or changes things that shouldn’t be changed.

With VSC-MCP:

  • It calls the readFile tool to get all usage locations.
  • It calls the editSymbol tool with exact line/character positions.
  • The changes are done reliably—in seconds—not minutes.

Getting Started with VSC-MCP

The initial setup is straightforward, requiring Bun and Node.js:

git clone https://github.com/thomasgazzoni/vsc-mcp.git
 
bun install

Next, configure the MCP servers in your AI client (e.g., Claude Desktop), and you’re ready to go!

{
  "mcpServers": {
    "vsc-mcp": {
      "command": "bun",
      "args": [
        "/path/to/your/vsc-mcp/src/index.ts"
      ],
      "env": {
        "LOG_DIR": "/path/to/your/vsc-mcp/logs",
        "ALLOWED_DIRECTORIES": "/path/to/your/working/project"
      }
    }
  }
}

What's Next?

Still an early project, I plan to:

  • Add support for more languages (e.g., Python, Rust)
  • Explore additional tools (e.g., find all references, deep refactoring, etc.)
  • Run in an isolate container, like OpenVSCode Server

In upcoming posts, I’ll document my progress, challenges encountered, iterative improvements, and real-world integrations.

This is just the beginning of an exciting exploration—join me as we dive deeper into making AI a seamless part of code editing workflows.

Feedback Wanted

This is an early project and I’m actively working on it. If you’re experimenting with AI editors, building dev tools, or just curious about MCP integration, check out the repo, open an issue, or drop me a note.

Let’s build better tooling for the next generation of AI-first developers.

Thanks for reading, and let me know what you think!