Universal CLI History MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Universal CLI History MCP Server search my command history for git commits"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Universal CLI History MCP Server
一个通用的 MCP 服务器,用于管理和搜索所有 CLI 命令行工具的历史记录。
🚀 支持的工具
Shell 工具
bash -
.bash_historyzsh -
.zsh_historyfish -
fish_historyPowerShell -
ConsoleHost_history.txt
开发工具
git - git commit 历史
Node.js -
.node_repl_historyPython -
.python_historynpm/yarn - package manager 命令
系统工具
docker - docker 相关命令
apt/brew - 包管理器
curl/wget - 网络工具
ssh/scp - 远程连接
rsync - 文件同步
通用命令
ls, cd, pwd, cat, grep, find
mkdir, rm, cp, mv
所有其他系统命令
Related MCP server: Terminal History MCP
🔧 功能特性
list_history - 列出历史命令
查看所有 CLI 工具的历史命令
按工具过滤:
git,docker,npm,node,python,shell等限制返回数量
search_history - 搜索历史命令
在所有历史命令中搜索关键词
按工具过滤搜索范围
get_tool_stats - 使用统计
查看各工具的使用频率
统计总命令数
识别最常用工具
execute_command - 执行命令
执行 CLI 命令并自动记录到历史
自动识别工具类型
📊 可用资源
cli-history://all
获取所有 CLI 历史命令的 JSON 格式数据。
cli-history://stats
获取各工具使用统计的 JSON 数据。
🛠️ 安装配置
1. 通过 npm 安装(推荐)
npm install -g universal-cli-history-mcp2. 从源码安装
cd universal-cli-history-mcp
npm install
npm run build3. 配置 Claude Desktop/Code
Windows 配置:
{
"mcpServers": {
"universal-cli-history": {
"command": "node",
"args": ["C:\\Users\\gretc\\AppData\\Roaming\\npm\\node_modules\\universal-cli-history-mcp\\dist\\index.js"]
}
}
}macOS/Linux 配置:
{
"mcpServers": {
"universal-cli-history": {
"command": "node",
"args": ["/usr/local/lib/node_modules/universal-cli-history-mcp/dist/index.js"]
}
}
}使用环境变量(跨平台):
{
"mcpServers": {
"universal-cli-history": {
"command": "node",
"args": ["%APPDATA%/npm/node_modules/universal-cli-history-mcp/dist/index.js"]
}
}
}💡 提示: 使用 npm root -g 命令查找你的全局安装路径。
🚨 故障排除
常见问题
MCP error -32000: Connection closed
检查路径是否正确
确保使用双反斜杠或正斜杠
重启 Claude Desktop/Code
找不到工具
运行
npm install -g universal-cli-history-mcp重新安装验证安装:
npm list -g universal-cli-history-mcp
权限错误
Windows: 以管理员身份运行命令提示符
macOS/Linux: 使用
sudo npm install -g universal-cli-history-mcp
验证安装
# 检查是否安装成功
npm list -g universal-cli-history-mcp
# 测试 MCP 服务器
node "C:\Users\gretc\AppData\Roaming\npm\node_modules\universal-cli-history-mcp\dist\index.js"🔍 使用示例
查看最近命令
list_history { "limit": 20 }搜索 Git 命令
search_history { "query": "commit", "tool": "git" }查看统计
get_tool_stats {}执行命令
execute_command { "command": "git status" }📁 项目结构
universal-cli-history-mcp/
├── src/
│ └── index.ts # 主服务器文件
├── dist/ # 编译输出
├── package.json
├── tsconfig.json
└── README.md🔄 自动检测
服务器会自动检测和加载:
各种 shell 的历史文件
Git 仓库的提交历史
Node.js/Python REPL 历史
系统命令历史
Docker 相关命令
⚡ 开发
运行开发版本
npm run dev构建生产版本
npm run build启动生产版本
npm start📝 许可证
MIT
Available Tools
4 toolsexecute_commandC
执行CLI命令并记录到历史
Inputs: command (required), tool.
get_tool_statsB
获取各工具的使用统计
Inputs: no named parameters.
list_historyC
列出所有CLI工具的历史命令
Inputs: tool, limit.
search_historyC
搜索历史命令
Inputs: query (required), tool.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct action: listing all history, searching history, retrieving usage statistics, and executing/recording a command. The boundaries between list_history and search_history are especially clear, and get_tool_stats is unambiguous.
All names follow a consistent snake_case verb_noun pattern: list_history, search_history, get_tool_stats, execute_command. There are no mixed conventions or vague standalone verbs.
Four tools are well-scoped for a CLI history server, covering the core read/search/stats/execute workflows. Each tool earns its place without obvious redundancy.
The tool surface covers listing, searching, statistics, and recording commands, but lacks lifecycle operations such as deleting specific history entries, clearing history, or exporting history. These are notable gaps for a history-management server, though basic read workflows are covered.
Maintenance
Related MCP Connectors
One searchable history across every AI coding tool, with secret scanning and a shared task board.
Shared memory for AI tools: save once, recall word for word from Claude, ChatGPT, Codex or Gemini.
Shared memory and context across ChatGPT, Claude, Claude Code, Codex, Cursor and 20+ AI tools
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA 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.2MIT
- AlicenseAqualityBmaintenanceDevelopers: 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.711 npm5MIT
- AlicenseAqualityCmaintenanceProvides MCP tools to search, browse, and retrieve unified read-only history from CLI agents like Codex, Claude Code, and OpenCode, with connector discovery and project-folder grouping.61MIT
- FlicenseNot gradedqualityBmaintenanceEnables semantic search of shell session history, matching user intents to relevant CLI commands for keyboard-first developer workflows.8-