Core Concepts

How Mouse Works

Understanding the MCP server architecture

Architecture Overview

Mouse implements the Model Context Protocol (MCP) to provide AI coding assistants with precise file editing capabilities.

`` ┌─────────────────┐ ┌──────────────┐ ┌─────────────┐ │ AI Assistant │────▶│ MCP Protocol │────▶│ Mouse Server│ │ (Claude, etc.) │◀────│ (stdio) │◀────│ (VS Code) │ └─────────────────┘ └──────────────┘ └─────────────┘ │ ┌─────┴─────┐ │ Files │ └───────────┘ `

Key Components

MCP Server

The extension runs a local MCP server that:
  • Receives tool calls from AI assistants
  • Validates operations against file state
  • Stages changes for review (Dialog Box)
  • Applies atomic edits with rollback support
  • Tool Interface

    Mouse exposes tools via MCP:
  • quick_edit - Single operations
  • batch_quick_edit - Multiple operations
  • find_in_file - Pattern search
  • save_changes / cancel_changes` - Commit/rollback
  • Dialog Box

    Large or risky operations trigger a review dialog:
  • Visual diff of proposed changes
  • Approve/reject per-operation
  • Full rollback on cancel
  • Why MCP?

    Traditional AI code editing relies on:

  • Full file rewrites (token inefficient)
  • Line-based patches (brittle)
  • Search/replace (ambiguous)
  • Mouse's approach:

  • Atomic operations with precise targeting
  • Staged changes for human review
  • Rollback support for safety