Navigation
MCP Command History: Cross-Platform Sharing & Instant Retrieval - MCP Implementation

MCP Command History: Cross-Platform Sharing & Instant Retrieval

MCP Command History: Seamlessly share & retrieve bash/zsh command history across Cursor, Claude, and MCP clients. Boost productivity effortlessly!

Developer Tools
4.3(156 reviews)
234 saves
109 comments

This tool saved users approximately 6919 hours last month!

About MCP Command History

What is MCP Command History: Cross-Platform Sharing & Instant Retrieval?

MCP Command History is a powerful tool designed to simplify how you interact with your shell command history. By leveraging the Model Control Protocol (MCP) interface, it allows users to programmatically access, search, and retrieve previously executed commands across different platforms. Whether you work on Linux, macOS, or other Unix-like systems, this tool bridges the gap between your shell environment and modern development workflows, ensuring seamless command management and collaboration.

Key Features of MCP Command History: Cross-Platform Sharing & Instant Retrieval

At its core, this tool delivers three transformative capabilities:

  • Universal Access: Query your entire command history programmatically, no matter which shell you use (Bash, Zsh, etc.).
  • Instant Search: Use natural language or keyword-based queries to quickly locate specific commands like 'git commit' or 'docker run.'
  • Real-Time Retrieval: Pull up recent commands instantly or fetch command details by ID after a search—all through the MCP interface.
  • Seamless Ecosystem Integration: Works flawlessly with Cursor and other MCP-enabled tools, turning your command history into a reusable asset across projects.

MCP Command History Features

How to Use MCP Command History: Cross-Platform Sharing & Instant Retrieval

Getting started is straightforward:

Installation Steps

  1. Ensure Python 3.6+ and a supported shell (e.g., Bash) are installed.
  2. Clone the repository and install dependencies:
    git clone https://github.com/yourusername/mcp-cmd-history.git
    cd mcp-cmd-history
    pip install -r requirements.txt

Launching the Server

Run python mcp_history_server.py to activate the MCP service. By default, it reads from your shell's HISTFILE (fallback: ~/.bash_history).

Interacting with Cursor

Once running, execute these MCP commands in Cursor:

  • Retrieve recent commands: Please show me my most recent shell commands.
  • Search for commands: Please search my command history for 'git commit'.
  • Get command details: Use the ID from search results to fetch specific commands.

Use Cases of MCP Command History: Cross-Platform Sharing & Instant Retrieval

Here's how developers leverage this tool daily:

  • Efficient Debugging: Re-run or modify previous complex commands without manual retyping.
  • Team Collaboration: Share command patterns across teams by embedding MCP history queries in documentation or CI/CD pipelines.
  • Historical Analysis: Automate audits or performance reviews by programmatically parsing command execution logs.
  • Learning Aid: New developers can explore team workflows by reviewing executed commands through the search interface.

MCP Command History FAQ

FAQ from MCP Command History: Cross-Platform Sharing & Instant Retrieval

Q: Does this work with Zsh or only Bash?
Yes! The tool automatically detects your shell's history file location, supporting any shell that maintains a HISTFILE.

Q: Can I customize the history search?
Advanced filtering parameters are planned for future releases. Currently, exact text matches work best for precise results.

Q: How do I contribute?
Check CONTRIBUTING.md for guidelines—whether improving search algorithms or adding platform support, your input is valued!

Q: Is there an API reference available?
Yes! The MCP tools search_commands() and get_recent_commands() provide programmatic access, documented in the project's API section.

Content

MCP Command History

A powerful tool for exploring, searching, and managing your shell command history through the MCP (Model Control Protocol) interface. This project allows you to easily access, search, and retrieve your previously executed shell commands.

Features

  • Command History Access : Access your shell command history programmatically
  • Powerful Search : Search through your command history with text queries
  • Recent Commands : Quickly retrieve your most recently executed commands
  • MCP Integration : Seamlessly integrates with Cursor and other MCP-compatible tools

Installation

Prerequisites

  • Python 3.6 or higher
  • A shell with history support (Bash, Zsh, etc.)

Install from Source

# Clone the repository
git clone https://github.com/yourusername/mcp-cmd-history.git
cd mcp-cmd-history

# Install dependencies
pip install -r requirements.txt

Usage

Starting the Server

python mcp_history_server.py

By default, the server will read your shell history from the location specified in the HISTFILE environment variable, or fall back to ~/.bash_history.

Using with Cursor

Once the server is running, you can use the following MCP tools in Cursor:

  1. Get Recent Commands :

    Please show me my most recent shell commands.

  2. Search Command History :

    Please search my command history for 'git commit' and show me the results.

  3. Get Specific Command : You can retrieve a specific command by its ID after searching or listing recent commands.

API Reference

MCP Tools

  • search_commands(query: str): Search for commands in shell history
  • get_recent_commands(limit: int = 10): Get the most recent commands from history
  • get_command(command_id: int): Get a specific command by ID

MCP Resources

  • history://recent/{limit}: Get recent commands (HTTP endpoint)
  • history://search/{query}: Search for commands (HTTP endpoint)

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Related MCP Servers & Clients