This repository provides a tool to access, search, and manage shell command history through the MCP interface, enabling users to retrieve recent commands and search for specific commands easily.
This project provides a tool for exploring, searching, and managing shell command history through the MCP (Model Control Protocol) interface. It allows users to access, search, and retrieve previously executed shell commands.
git clone https://github.com/yourusername/mcp-cmd-history.git
cd mcp-cmd-history
pip install -r requirements.txt
python mcp_history_server.py
The server reads shell history from the HISTFILE
environment variable or ~/.bash_history
.
Example MCP tools in Cursor:
Please show me my most recent shell commands.
Please search my command history for 'git commit'.
search_commands(query: str)
: Searches shell history.get_recent_commands(limit: int = 10)
: Gets recent commands.get_command(command_id: int)
: Gets a command by ID.history://recent/{limit}
: Recent commands (HTTP endpoint).history://search/{query}
: Search commands (HTTP endpoint).rajpdus/mcp-histfile
March 13, 2025
March 23, 2025
Python