Skip to main content
Glama

MCP 命令历史

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

特征

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

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

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

  • MCP 集成:与 Cursor 和其他 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文件。

-
security - not tested
A
license - permissive license
-
quality - not tested

Related MCP Servers

  • A
    security
    A
    license
    A
    quality
    A secure shell command execution server implementing the Model Context Protocol (MCP). This server allows remote execution of whitelisted shell commands with support for stdin input.
    Last updated -
    1
    154
    MIT License
    • Apple
  • A
    security
    -
    license
    A
    quality
    An MCP server that enables secure execution of shell commands across Windows, macOS, and Linux with built-in whitelisting and approval mechanisms for enhanced security.
    Last updated -
    9
    429
    9
    MIT License
    • Linux
    • Apple
  • A
    security
    A
    license
    A
    quality
    A server that uses the Model Context Protocol (MCP) to allow AI agents to safely execute shell commands on a host system.
    Last updated -
    1
    31
    6
    MIT License
    • Linux
    • Apple
  • -
    security
    -
    license
    -
    quality
    A simple MCP server that provides a terminal tool for executing shell commands with safety features like timeouts and error handling.
    Last updated -

View all related MCP servers

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