Built as a high-performance Rust implementation, providing a Model Context Protocol server for headless terminal interactions
ht-mcp
A high-performance Rust implementation of a Model Context Protocol (MCP) server for headless terminal ht.
Features
- 🚀 Pure Rust: Single binary MCP server, no external dependencies
- 🔗 Direct Integration: Embed excellent ht headless terminal library for optimal performance
- 🖥️ Multi-Session: Concurrent terminal session management
- 🌐 Web Interface: Optional live terminal preview
Demo
ht-mcp in Memex
ht-mcp in Claude Code
Installation
🍺 Homebrew (Recommended)
📦 Pre-built Binaries
Download from releases:
🦀 Cargo
🔧 Build from Source
See docs/INSTALLATION.md for detailed installation options.
MCP Tools
Tool | Description | Parameters |
---|---|---|
ht_create_session | Create new terminal session | command? , enableWebServer? |
ht_send_keys | Send keystrokes to session | sessionId , keys[] |
ht_take_snapshot | Capture terminal state | sessionId |
ht_execute_command | Execute command and get output | sessionId , command |
ht_list_sessions | List all active sessions | None |
ht_close_session | Close terminal session | sessionId |
Note: Parameters use camelCase (e.g.,
sessionId
,enableWebServer
) for MCP compatibility.
Configuration
Add to your MCP client configuration:
For custom installation paths:
Usage Example
Once configured in your MCP client:
- Create session:
ht_create_session
→ Returns session ID - Run commands:
ht_execute_command
with session ID and command - Interactive input:
ht_send_keys
for multi-step interactions - Check state:
ht_take_snapshot
to see current terminal - Clean up:
ht_close_session
when finished
Response Format
This server returns human-readable text responses (not JSON), designed for natural language interaction:
Requirements
- Rust: 1.75+ (install via rustup)
- Supported OS: Linux, macOS, Windows (experimental)
Development
Troubleshooting
Installation Issues:
- Ensure Rust 1.75+ is installed
- Check internet connection for git submodules
- Verify
~/.cargo/bin
is in PATH
Runtime Issues:
- Use
ht-mcp --debug
for verbose logging - Check MCP client configuration syntax
- Verify binary path:
which ht-mcp
Performance
Compared to the original TypeScript implementation:
- 40x faster startup (~50ms vs ~2s)
- 70% less memory (~15MB vs ~50MB)
- Single binary (4.7MB vs ~200MB Node.js)
- Zero subprocess overhead
License
Apache 2.0 License
Copyright (c) 2025 Atlas Futures Inc.
See LICENSE for details.
Contributing
Contributions welcome! Please read CONTRIBUTING.md for guidelines.
Built with Memex✨
Fixed submodule commit reference
This server cannot be installed
ht-mcp is useful for enabling Agents to use terminals (e.g. bash, zsh, fish) in the same way a human does.
It solves the challenge of agents stalling when they encounter interactive terminal commands.
Related MCP Servers
- -securityAlicense-qualityAn enhanced MCP server that grants AI assistants the ability to execute terminal commands on a user's system with improved security controls, designed for use in controlled environments.Last updated -PythonMIT License
- AsecurityAlicenseAqualityA server that uses the Model Context Protocol (MCP) to allow AI agents to safely execute shell commands on a host system.Last updated -1762TypeScriptMIT License
- -securityFlicense-qualityAn MCP server that allows AI models to execute system commands on local machines or remote hosts via SSH, supporting persistent sessions and environment variables.Last updated -101TypeScript
- -securityAlicense-qualityAn MCP server that bridges AI agents with GUI automation capabilities, allowing them to control mouse, keyboard, windows, and take screenshots to interact with desktop applications.Last updated -PythonMIT License