Back to MCP Catalog

Terminal Controller MCP Server

Command LinePython
Secure terminal command execution and file system operations through a standardized interface
Available Tools

execute_command

Execute a terminal command and return its results

commandtimeout

get_command_history

Get recent command execution history

count

get_current_directory

Get the current working directory

change_directory

Change the current working directory

path

list_directory

List files and subdirectories in the specified directory

path

write_file

Write content to a file with overwrite or append options

pathcontent

read_file

Read content from a file

path

update_file_line

Update specific line(s) in a file

pathline_numbernew_content

delete_file_line

Delete specific line(s) from a file

pathline_number

insert_file_line

Insert content at a specific line in a file

pathline_numbercontent

Terminal Controller provides a secure way to interact with your computer's terminal through natural language. It enables command execution, directory navigation, and file system operations with built-in security measures to prevent dangerous commands. The MCP server works across platforms (Windows and UNIX-based systems) and offers comprehensive features like command history tracking, timeout controls, and row-level file operations. It's designed to integrate seamlessly with MCP-compatible clients such as Claude Desktop and Cursor.

Overview

Terminal Controller is an MCP server that provides a secure interface for terminal operations. It allows AI assistants to execute commands, navigate directories, and perform file operations on your behalf through natural language instructions.

Installation

Prerequisites

  • Python 3.11 or higher
  • An MCP-compatible client (Claude Desktop, Cursor, etc.)
  • UV/UVX (optional, for the recommended installation method)

Installation Methods

Method 1: PyPI Installation (Recommended)

Install directly from PyPI using pip:

pip install terminal-controller

Or using UV:

uv pip install terminal-controller

Method 2: From Source

If you prefer installing from source:

  1. Clone the repository:
git clone https://github.com/GongRzhe/terminal-controller-mcp.git
cd terminal-controller-mcp
  1. Run the setup script:
python setup_mcp.py

Automated Installation via Smithery

For Claude Desktop users, you can use Smithery for automatic installation:

npx -y @smithery/cli install @GongRzhe/terminal-controller-mcp --client claude

Client Configuration

Claude Desktop

Configure Claude Desktop by editing its configuration file:

Location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Option 1: Using UVX (Recommended)

"mcpServers": {
  "terminal-controller": {
    "command": "uvx",
    "args": ["terminal_controller"]
  }
}

Option 2: Using Python Directly

"mcpServers": {
  "terminal-controller": {
    "command": "python",
    "args": ["-m", "terminal_controller"]
  }
}

Cursor and Other MCP Clients

Use similar configuration settings as Claude Desktop, adjusting according to the client's specific requirements.

Usage Examples

Once configured, you can use natural language to interact with your terminal:

  • "Run the command ls -la in the current directory"
  • "Navigate to my Documents folder"
  • "Show me the contents of my Downloads directory"
  • "Show me my recent command history"
  • "Read the content of config.json"
  • "Update line 5 in my script.py file with 'print("Hello World")'"
  • "Delete lines 10-15 from the log file"
  • "Insert a new line at the beginning of my text file"

Security Considerations

Terminal Controller includes built-in safeguards against potentially dangerous commands. However, as with any tool that can execute commands on your system, you should be cautious about the instructions you give to the AI assistant.

Troubleshooting

If you encounter issues:

  1. Ensure Python 3.11+ is installed and in your PATH
  2. Verify your client configuration is correct
  3. Check that the terminal-controller package is properly installed
  4. Look for error messages in your client's logs

Related MCPs

iTerm Terminal Control
Command LineTypeScript

Execute and interact with commands in your active iTerm terminal session

Command Runner
Command LineTypeScript

Run shell commands directly from your AI assistant

CLI Command Executor
Command LinePython

Secure command-line interface with customizable security policies

About Model Context Protocol

Model Context Protocol (MCP) allows AI models to access external tools and services, extending their capabilities beyond their training data.

Generate Cursor Documentation

Save time on coding by generating custom documentation and prompts for Cursor IDE.