MCP 命令历史
一个强大的工具,用于通过 MCP(模型控制协议)接口探索、搜索和管理你的 shell 命令历史记录。此项目允许你轻松访问、搜索和检索你之前执行过的 shell 命令。
特征
命令历史记录访问:以编程方式访问 shell 命令历史记录
强大的搜索功能:使用文本查询搜索您的命令历史记录
最近的命令:快速检索最近执行的命令
MCP 集成:与 Cursor 和其他 MCP 兼容工具无缝集成
Related MCP server: Super Shell MCP Server
安装
先决条件
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 工具:
获取最近的命令:
Please show me my most recent shell commands.搜索命令历史记录:
Please search my command history for 'git commit' and show me the results.获取特定命令:您可以在搜索或列出最近的命令后通过其 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文件。
This server cannot be installed
Resources
Looking for Admin?
Admins can modify the Dockerfile, update the server description, and track usage metrics. If you are the server author, to access the admin panel.