LO

Local History MCP Server for Cursor, VS Code

Access Cursor and VS Code local history via an MCP server for AI-powered recovery and seamless context-aware file restoration.

Quick Install
npx -y @xxczaki/local-history-mcp

Overview

This MCP (Model Context Protocol) server exposes the Local History snapshots created by Cursor and Visual Studio Code to AI assistants and other MCP clients. Local History records file snapshots at save points — unlike undo/redo — so it can recover content lost by accidental overwrites, refactors, or destructive edits. The Local History MCP Server acts as a local bridge so AI tools can query file histories, search past contents, and restore earlier versions in a context-aware way.

For developers, this means AI assistants (for example, Cursor, Claude, or other MCP-compatible tools) can access a structured view of your local file history to provide better diagnostic suggestions, automated recovery, or richer code-completion context. The server is designed for personal, local use and integrates into existing MCP workflows for Cursor and VS Code.

Features

  • Exposes Cursor and VS Code Local History via the Model Context Protocol (MCP)
  • Browse files that have Local History snapshots
  • Inspect full history for a specific file and fetch individual entries
  • Search text across all saved history entries
  • Restore a file to a previous snapshot (creates a backup before writing)
  • Simple CLI install and a source build path for contributors
  • MCP-compatible — works with any client that supports custom MCP servers

Installation / Configuration

Quick install with a package runner:

# npm
npx local-history-mcp

# pnpm
pnpm dlx local-history-mcp

# yarn
yarn global add local-history-mcp

# bun
bunx local-history-mcp

From source:

git clone https://github.com/xxczaki/local-history-mcp.git
cd local-history-mcp
pnpm install
pnpm build
pnpm start

Typical development commands:

pnpm dev        # run in development mode
pnpm test       # run tests
pnpm lint       # lint code
pnpm inspector  # launch MCP inspector (development helper)

Registering the MCP server with clients:

  • Cursor: you can install via the one-click MCP install (or add manually via Cursor’s MCP docs).

    • One-click install: https://cursor.com/en/install-mcp?name=local-history&config=eyJjb21tYW5kIjogIm5weCIsICJhcmdzIjogWyIteSIsICJsb2NhbC1oaXN0b3J5LW1jcCJdfQo%3D
    • Cursor MCP docs: https://docs.cursor.com/en/context/mcp
  • Claude (CLI/Desktop):

    • Claude Code (CLI):
      claude mcp add local-history -- npx -y local-history-mcp
      
    • See Anthropic’s MCP docs for desktop setup.
  • Visual Studio Code:

    • Follow VS Code instructions to add an MCP server: https://code.visualstudio.com/docs/copilot/chat/mcp-servers#_add-an-mcp-server

After installation, start the server and register the reported endpoint with your MCP client.

Available Tools

Tool nameDescription
list_history_filesList files that have Local History snapshots
get_file_historyRetrieve the full history list for a given file
get_history_entryFetch the content of a single history entry
restore_from_historyRestore the workspace file from a selected history entry (creates a backup)
search_history_contentFull-text search across all saved history entries
get_history_statsReturn summary statistics (counts, sizes, timestamps)

These tools are exposed through MCP method calls so your assistant can invoke them directly as part of a context request.

Use Cases

  • Recover an accidentally overwritten implementation: locate the previous snapshot for a .js/.py file and restore the missing function without restoring the entire repository.
  • Assist AI troubleshooting: feed a model the past few save points for a module so it can infer when a bug was introduced and propose targeted fixes.
  • Search historical code: locate previous implementations or comments that were removed during a refactor.
  • Audit and forensics: collect timestamps and content of past saves for a file when tracking changes across development sessions.
  • Improve completion/context: give an AI assistant access to older versions so it can suggest more accurate refactors or reinstate removed behavior.

Concrete example — quick recovery:

  1. Start server: npx local-history-mcp
  2. From your MCP-enabled assistant, call list_history_files to find affected files.
  3. Use get_file_history and get_history_entry to preview an older snapshot.
  4. Use restore_from_history to restore the file (the server creates a backup of the current version).

Notes on privacy & safety

  • The server reads Local History stored on the machine and is intended for local/personal use. Register MCP endpoints only with trusted assistants and clients.
  • Restores create backups by default to avoid accidental data loss.
  • Review your editor’s Local History retention settings if you need longer or shorter snapshot retention.

Repository and issues: https://github.com/xxczaki/local-history-mcp

License: MIT