Sponsored by Deepsite.site

Terminator

Created By
iris-networks5 months ago
A lightweight Model Context Protocol (MCP) server written in Go that enables secure terminal command execution on macOS and Linux. Supports persistent shell sessions, configurable timeouts, and both HTTP (StreamableHTTP) and STDIO transports. Designed for AI integrations and automation use cases with flexible session management and platform-aware execution.
Content

MCP Terminal Server

A Model Context Protocol (MCP) server written in Go that provides secure terminal command execution with configurable timeouts and platform-specific support.

Features

  • Cross-platform support: Works on macOS and Linux
  • Configurable timeouts: Set custom timeout values for command execution
  • Secure execution: Commands run in controlled environment with proper error handling
  • Platform-aware: Automatically detects and adapts to the host platform
  • Flexible shell support: Configurable shell for command execution
  • Multiple transport modes:
    • STDIO mode for traditional MCP clients
    • 🌐 StreamableHTTP transport: Standards-compliant HTTP-based MCP transport for web integrations
  • Flexible session management: Use any session ID you want - no pre-registration required
  • 🎉 Persistent shell sessions: Maintain shell state between commands (working directory, environment variables, etc.)

Quick Start

# Build the server
make build

# Run in HTTP mode with StreamableHTTP transport
./mcp-terminal-server --http --port 8080

# Run in STDIO mode (default)
./mcp-terminal-server

🚀 Quick Testing

Test StreamableHTTP Transport

# Start server in HTTP mode
./mcp-terminal-server --http --port 8080

# Test MCP initialization
curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "test-client", "version": "1.0.0"}}}'

# Test tools listing (use session ID from initialize response)
curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -H "Mcp-Session-Id: <session-id>" \
  -d '{"jsonrpc": "2.0", "id": 2, "method": "tools/list"}'

# Execute a command
curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -H "Mcp-Session-Id: <session-id>" \
  -d '{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "execute_command", "arguments": {"command": "echo Hello StreamableHTTP!"}}}'

Test Persistent Shell

# Test persistent shell functionality
chmod +x examples/persistent_shell_examples.sh
./examples/persistent_shell_examples.sh

Documentation

📚 Complete Documentation

Available Tools

  1. execute_command - Execute single commands with timeout
  2. persistent_shell - Execute commands in persistent shell sessions
  3. session_manager - Manage shell sessions (list, close)

Server Endpoints

When running in HTTP mode (--http flag), the server provides:

  • POST /mcp - StreamableHTTP transport endpoint for all MCP operations
    • Supports initialize, tools/list, tools/call methods
    • Requires Mcp-Session-Id header for authenticated requests
    • Returns session ID in response headers for initialize calls

MCP Protocol Support

The server implements the Model Context Protocol specification:

  • JSON-RPC 2.0 communication
  • Session management with UUID-based session IDs
  • Tool execution with structured input/output
  • Error handling with standard JSON-RPC error codes

Platform Support

  • macOS (darwin): Full support - AMD64 & ARM64
  • Linux: Full support - AMD64 & ARM64
  • Docker: Multi-architecture support via buildx

Integration

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "terminal": {
      "command": "/path/to/mcp-terminal-server",
      "env": {
        "MCP_COMMAND_TIMEOUT": "30"
      }
    }
  }
}

Docker

# Run AMD64 image
docker run --rm -p 8080:8080 terminal-mcp:latest-linux-amd64 --http --port 8080

# Run ARM64 image  
docker run --rm -p 8080:8080 terminal-mcp:latest-linux-arm64 --http --port 8080

# Run with persistent shell session
docker run --rm -p 8080:8080 -v /tmp:/tmp terminal-mcp:latest-linux-amd64 --http --port 8080

Other MCP Clients

The server follows the standard MCP protocol and should work with any compliant MCP client.

Development

Building

# Build for current platform
make build

# Build for all platforms
make build-all

# Build Docker images
make docker-build

# Build and push Docker images
REGISTRY=your-registry.com make docker-push

# Build DXT package for distribution
make dxt

Dependencies

  • github.com/mark3labs/mcp-go - MCP Go library
  • Go 1.23+ (automatically managed)

Production Deployment

For production environments, it's recommended to run the server with proper process management and security measures:

Process Management

  • s6: Lightweight process supervision with automatic restart
  • systemd: Full-featured service management with resource limits
  • Docker: Containerized deployment with security isolation
  • Supervisor: Python-based process management

Security Features

  • Non-root execution: Run with dedicated user account for limited privileges
  • Resource limits: CPU, memory, and file access restrictions
  • Network isolation: Bind to localhost only for enhanced security
  • AppArmor/SELinux: Additional mandatory access controls
  • File permissions: Restricted access to necessary directories only

📋 See Process Management Guide for detailed setup instructions

Integration with Iris Agent

This MCP server is used by the Iris Computer Use Agent, our advanced computer use agent for automated terminal interactions.

License

This project is provided as-is for development purposes.

Server Config

{
  "mcpServers": {
    "terminal": {
      "type": "streamable-http",
      "url": "http://localhost:8080/mcp",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-p",
        "8080:8080",
        "-e",
        "MCP_COMMAND_TIMEOUT=30",
        "-e",
        "MCP_SHELL=/bin/bash",
        "shanurcsenitap/terminator:latest",
        "--http",
        "--host",
        "0.0.0.0",
        "--port",
        "8080"
      ]
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
ChatWiseThe second fastest AI chatbot™
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Tavily Mcp
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Playwright McpPlaywright MCP server
CursorThe AI Code Editor
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
WindsurfThe new purpose-built IDE to harness magic
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Serper MCP ServerA Serper MCP Server
Amap Maps高德地图官方 MCP Server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
DeepChatYour AI Partner on Desktop
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.