Skip to main content
Glama

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

Related MCP server: Terminal History MCP

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.

A
license - permissive license
-
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    -
    quality
    D
    maintenance
    An MCP server that enables users to retrieve, filter, and search through Claude Code conversation history stored in local projects. It provides tools for listing projects and sessions, paginating through message history, and searching across conversations with keyword filtering.
    Last updated
    36
    11
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Developers: Search your zsh, bash, or fish shell history from Claude Code, Cline, Cursor, Zed, or any MCP client using tools like search_history (full-text with timestamp/CWD/exit code), recent_in_dir, failed_commands, and command_chains for multi-step sequences. Reindex after new activity. Local-only SQLite FTS5 with secrets redacted before storage.
    Last updated
    5
    46
    4
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    A CLI-based MCP server for managing conversation sessions, history, and multi-language support, enabling creation, switching, deletion of sessions, saving and searching messages, and exporting data.
    Last updated
    7
    MIT
  • F
    license
    -
    quality
    B
    maintenance
    Local semantic search over Claude Code sessions and shell command history, exposed to Claude Code as an MCP tool. Everything is indexed into one vector space and runs entirely on your machine.
    Last updated
    1

View all related MCP servers

Related MCP Connectors

  • Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only

  • Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rajpdus/mcp-histfile'

If you have feedback or need assistance with the MCP directory API, please join our Discord server