Headless Terminal (ht) MCP
A high-performance MCP server for the headless terminal (ht), implemented in Rust.
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)
brew tap memextech/tap
brew install ht-mcp
š¦ Pre-built Binaries
Download from releases:
# 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/
š¦ Cargo
# From crates.io (stable)
cargo install ht-mcp
# From git (latest)
cargo install --git https://github.com/memextech/ht-mcp
š§ Build from Source
git clone https://github.com/memextech/ht-mcp.git
cd ht-mcp
git submodule update --init --recursive
cargo install --path .
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:
{
"mcpServers": {
"ht-mcp": {
"command": "ht-mcp",
"args": ["--debug"]
}
}
}
For custom installation paths:
{
"mcpServers": {
"ht-mcp": {
"command": "/path/to/ht-mcp",
"args": []
}
}
}
Usage Example
# Start the MCP server
ht-mcp
# With debug logging
ht-mcp --debug
Once configured in your MCP client:
- Create session:
ht_create_sessionā Returns session ID - Run commands:
ht_execute_commandwith session ID and command - Interactive input:
ht_send_keysfor multi-step interactions - Check state:
ht_take_snapshotto see current terminal - Clean up:
ht_close_sessionwhen finished
Response Format
This server returns human-readable text responses (not JSON), designed for natural language interaction:
# 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$
Requirements
- Rust: 1.75+ (install via rustup)
- Supported OS: Linux, macOS, Windows (experimental)
Development
# 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
Troubleshooting
Installation Issues:
- Ensure Rust 1.75+ is installed
- Check internet connection for git submodules
- Verify
~/.cargo/binis in PATH
Runtime Issues:
- Use
ht-mcp --debugfor 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
Related Servers
Cygnus MCP Server
A simple MCP server exposing Cygnus tools for demonstration, including 'cygnus_alpha' and 'invoke-service'.
OpenAI Image Generation
Generate and edit images using OpenAI's DALL-E models via the official Python SDK.
Choose MCP Server
An MCP server for integration with the Claude Desktop Client, with optional DBT manifest path configuration.
Databutton
An MCP server for initial app planning and creating a good starting point for an app.
RandomWeb3MCP
A random element generation service based on EVM block hash for games, finance, testing, and other fields.
MLflow Prompt Registry
Access prompt templates managed in an MLflow Prompt Registry. Requires a running MLflow server configured via the MLFLOW_TRACKING_URI environment variable.
Laravel Loop
An MCP server for Laravel applications to connect with AI assistants using the MCP protocol.
Prometheus MCP
Expose Prometheus monitoring tools to an LLM for querying and analysis.
SVG to PNG MCP Server
A server that converts SVG code to PNG images using the cairosvg library.
Mastra/mcp
Client implementation for Mastra, providing seamless integration with MCP-compatible AI models and tools.