ht-mcp
 
无头终端模型上下文协议(MCP)服务器的高性能Rust实现 高温.
特性
- 🚀 纯锈:单个二进制MCP服务器,无外部依赖关系
- 🔗 直接积分法:嵌入优秀 高温 无头终端库,实现最佳性能
- 🖥️ 多会话:并发终端会话管理
- 🌐 web界面:可选实时终端预览
演示
ht-mcp in Memex
ht-mcp in 克劳德代码
安装
🍺 自制(推荐)
brew tap memextech/tap
brew install ht-mcp📦 预构建二进制文件
下载自 发布:
# macOS Intel
curl -L https://github.com/memextech/ht-mcp/releases/latest/download/ht-mcp-x86_64-apple-darwin -o ht-mcp
# macOS Apple Silicon
curl -L https://github.com/memextech/ht-mcp/releases/latest/download/ht-mcp-aarch64-apple-darwin -o ht-mcp
# Linux
curl -L https://github.com/memextech/ht-mcp/releases/latest/download/ht-mcp-x86_64-unknown-linux-gnu -o ht-mcp
# Windows (PowerShell)
curl.exe -L https://github.com/memextech/ht-mcp/releases/latest/download/ht-mcp-x86_64-pc-windows-msvc -o ht-mcp.exe
# Make executable and install
chmod +x ht-mcp && sudo mv ht-mcp /usr/local/bin/🦀 职位
# From crates.io (stable)
cargo install ht-mcp
# From git (latest)
cargo install --git https://github.com/memextech/ht-mcp🔧 从源代码构建
git clone https://github.com/memextech/ht-mcp.git
cd ht-mcp
git submodule update --init --recursive
cargo install --path .看 docs/INSTALLATION.md 有关详细的安装选项。
MCP工具
| 工具 | 说明 | 参数 |
|---|---|---|
ht_create_session | 创建新的终端会话 | command?, enableWebServer? |
ht_send_keys | 向会话发送击键 | sessionId, keys[] |
ht_take_snapshot | 捕获终端状态 | sessionId |
ht_execute_command | 执行命令并获取输出 | sessionId, command |
ht_list_sessions | 列出所有活动会话 | 无 |
ht_close_session | 关闭终端会话 | sessionId |
备注:参数使用camelCase(例如。,sessionId,enableWebServer)为了MCP兼容性。
配置
添加到MCP客户端配置中:
{
"mcpServers": {
"ht-mcp": {
"command": "ht-mcp",
"args": ["--debug"]
}
}
}对于自定义安装路径:
{
"mcpServers": {
"ht-mcp": {
"command": "/path/to/ht-mcp",
"args": []
}
}
}用法示例
# Start the MCP server
ht-mcp
# With debug logging
ht-mcp --debug在MCP客户端中配置后:
- 创建会话:
ht_create_session→ 返回会话ID - 运行命令:
ht_execute_command带有会话ID和命令 - 交互式输入:
ht_send_keys用于多步骤交互 - 检查状态:
ht_take_snapshot查看当前终端 - 清理:
ht_close_session完成时
响应格式
此服务器返回 人类可读的文本响应 (非JSON),专为自然语言交互而设计:
# Create session response
HT session created successfully!
Session ID: abc123-def456-789...
🌐 Web server enabled! View live terminal at: http://127.0.0.1:3618# Terminal snapshot response
Terminal Snapshot (Session: abc123...)
bash-3.2$ ls -la
total 16
drwxr-xr-x 4 user staff 128 Jun 13 10:30 .
-rw-r--r-- 1 user staff 45 Jun 13 10:30 file.txt
bash-3.2$需求
- 锈:1.75+(通过安装 安宁)
- 支持的操作系统:Linux、macOS、Windows(实验版)
发展
# Clone with submodules
git clone --recursive https://github.com/memextech/ht-mcp.git
cd ht-mcp
# Build
cargo build
# Run
cargo run
# Test
cargo test故障排除
安装问题:
- 确保安装了Rust 1.75+
- 检查git子模块的互联网连接
- 验证
~/.cargo/bin在PATH中
运行时问题:
- 使用
ht-mcp --debug用于详细日志记录 - 检查MCP客户端配置语法
- 验证二进制路径:
which ht-mcp
演出
与原版相比 TypeScript实现:
- 启动速度提高40倍 (~50ms vs ~2s)
- 内存减少70% (约15MB对约50MB)
- 单个二进制 (4.7MB对比约200MB Node.js)
- 零子流程开销
许可证
Apache 2.0许可证
版权所有(c)2025 Atlas Futures股份有限公司。
看 许可证 了解详情。
贡献
欢迎投稿!请阅读 贡献.md 作为指导方针。
______________________________________________________________________
内置于 Memex✨
