Skip to main content
Glama

MCP 命令历史

一个强大的工具,用于通过 MCP(模型控制协议)接口探索、搜索和管理你的 shell 命令历史记录。此项目允许你轻松访问、搜索和检索你之前执行过的 shell 命令。

特征

  • 命令历史记录访问:以编程方式访问 shell 命令历史记录

  • 强大的搜索功能:使用文本查询搜索您的命令历史记录

  • 最近的命令:快速检索最近执行的命令

  • MCP 集成:与 Cursor 和其他 MCP 兼容工具无缝集成

Related MCP server: Terminal History MCP

安装

先决条件

  • Python 3.6 或更高版本

  • 具有历史记录支持的 shell(Bash、Zsh 等)

从源安装

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

# Install dependencies
pip install -r requirements.txt

用法

启动服务器

python mcp_history_server.py

默认情况下,服务器将从HISTFILE环境变量中指定的位置读取您的 shell 历史记录,或者回退到~/.bash_history

与游标一起使用

服务器运行后,您可以在 Cursor 中使用以下 MCP 工具:

  1. 获取最近的命令

    Please show me my most recent shell commands.
  2. 搜索命令历史记录

    Please search my command history for 'git commit' and show me the results.
  3. 获取特定命令:您可以在搜索或列出最近的命令后通过其 ID 检索特定命令。

API 参考

MCP 工具

  • search_commands(query: str) :在 shell 历史记录中搜索命令

  • get_recent_commands(limit: int = 10) :从历史记录中获取最近的命令

  • get_command(command_id: int) :通过ID获取特定命令

MCP 资源

  • history://recent/{limit} :获取最近的命令(HTTP 端点)

  • history://search/{query} :搜索命令(HTTP 端点)

贡献

欢迎贡献!请参阅CONTRIBUTING.md获取相关指南。

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

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
    A
    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.
    4
    25
    11
    MIT
  • A
    license
    A
    quality
    D
    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.
    5
    20
    4
    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.
    2
  • F
    license
    -
    quality
    A
    maintenance
    Local MCP server that lets your AI coding agent query its own cross-tool project history - file/command freshness, past test failures, cost & token spend, cache status, and session handoff - over stdio, 100% local, no telemetry.
    37

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