Skip to main content
Glama

mcp-histfile

by rajpdus

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

local-only server

The server can only run on the client's local machine because it depends on local resources.

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

  1. 特征
    1. 安装
      1. 先决条件
      2. 从源安装
    2. 用法
      1. 启动服务器
      2. 与游标一起使用
    3. API 参考
      1. MCP 工具
      2. MCP 资源
    4. 贡献
      1. 执照

        Related MCP Servers

        • A
          security
          A
          license
          A
          quality
          This MCP server enables users to execute shell commands in the current iTerm2 session through integration with Claude Desktop, facilitating seamless command execution via the Model Context Protocol.
          Last updated -
          3
          514
          296
          TypeScript
          MIT License
          • Apple
        • 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
          74
          Python
          MIT License
          • Apple
        • A
          security
          A
          license
          A
          quality
          A secure terminal execution server that enables controlled command execution with security features and resource limits via the Model Context Protocol (MCP).
          Last updated -
          1
          12
          1
          JavaScript
          MIT License
          • Apple
        • -
          security
          -
          license
          -
          quality
          A secure server that implements the Model Context Protocol (MCP) to enable controlled execution of authorized shell commands with stdin support.
          Last updated -
          Python

        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