Shell Command History MCP

Shell Command History MCP lets an assistant search and retrieve a selected local shell-history file through FastMCP tools.

Local serverstdioPythonMIT

What is the Shell Command History MCP Server?

Shell Command History MCP lets an assistant search and retrieve a selected local shell-history file through FastMCP tools.

Retrieve previously used commands

The implementation exposes search_commands, get_recent_commands and get_command. It reads the selected shell-history file and returns command records for an assistant to inspect. It is a retrieval interface; those tools do not execute the returned command text.

Use a compatible SDK launcher

The source defines a FastMCP object but does not call its run method. The README's bare Python command therefore is not a complete serving entry point. Use the SDK CLI to load the file as a stdio server, with a compatible SDK version for the source's FastMCP import. The setup below pins that import-compatible SDK generation.

Choose a test history file

HISTFILE selects the source; the implementation falls back to a Bash history path. Start with a small synthetic history file and compare search results with its lines. Shell formats differ, and fallback timestamps should not be treated as the original execution time. History can contain credentials and private commands, so expose only the file intended for the task.

Project documentation

Repository and setup guide

Recorded tools

Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.

ToolWhat it does
search_commandsSearch stored shell command text.
get_recent_commandsRetrieve recent command records.
get_commandRetrieve a command record by its identifier.

How to install the Shell Command History MCP Server

{
  "mcpServers": {
    "shell-history": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp[cli]<2",
        "mcp",
        "run",
        "/ABSOLUTE_PATH/mcp-histfile/mcp_history_server.py"
      ],
      "env": {
        "HISTFILE": "/ABSOLUTE_PATH/test-history.txt"
      }
    }
  }
}

Configuration

Python 3.10 or later, uv, an SDK version compatible with the source’s FastMCP import and the intended history file.

VariableDescriptionRequired
HISTFILEPath of the intended history file. Use a synthetic file for a first trial.Optional

Example prompts to try

  • “Use MCP Command History to Prerequisites.”

Frequently asked questions

No. The implemented tools search and retrieve stored command text.