MCP Connector

Securely Execute Terminal Commands and Manage Files

Terminal Controller MCP server runs shell commands and row-level file edits through a secure, timeout-controlled interface.


90
Spark score
out of 100
Updated Jun 2025
Version 0.1.7
Models
universal

Add to Favorites

Why it matters

This asset provides a secure and standardized interface for executing terminal commands, navigating directories, and performing file system operations. It offers built-in security measures and cross-platform support for enhanced control and safety.

Outcomes

What it gets done

01

Execute terminal commands with timeout control and output capture.

02

Manage files including reading, writing, inserting, updating, and deleting content.

03

Navigate and list directory contents securely.

04

Track and retrieve command history.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-terminal-control | bash

Capabilities

Tools your agent gets

execute_command

Executes a terminal command and returns results with timeout control

get_command_history

Retrieves the history of recently executed commands

get_current_directory

Gets the current working directory

change_directory

Changes the current working directory

list_directory

Lists files and subdirectories in the specified directory

write_file

Writes content to a file with overwrite or append options

read_file

Reads file content with optional line selection

insert_file_content

Inserts content at specified line(s) in a file

+2 tools

Overview

Terminal-Control MCP Server

Terminal Controller MCP server lets an AI assistant run shell commands, navigate directories, and make row-level file edits through ten tools, with timeout controls and a dangerous-command blacklist. Use it when an AI assistant needs to run terminal commands, navigate the filesystem, or make precise row-level edits to files.

What it does

Terminal Controller is an MCP server that enables secure terminal command execution, directory navigation, and file system operations through a standardized interface, with cross-platform support for Windows and UNIX-based systems. It provides ten tools: execute_command (run a command with a configurable timeout, capturing stdout, stderr, and execution status), get_command_history (retrieve recent command executions), get_current_directory and change_directory (inspect and navigate the working directory), list_directory (list contents with formatting for directories and files), and five row-level file editing tools - read_file (optionally scoped to a row range), write_file (overwrite or append, with write verification), insert_file_content, delete_file_content, and update_file_content (each targeting one or more specific rows in a file).

When to use - and when NOT to

Use this connector when an AI assistant needs to run shell commands, navigate directories, or make precise row-level edits to files through natural language - for example "read the content of config.json" or "update line 5 in my script.py file."

It is not a fit for interactive commands, since the interface is explicitly non-interactive, or for commands expected to run longer than the configured timeout - only commands that complete within the timeout window return results, and the server blacklists explicitly dangerous operations like rm -rf /, format, and mkfs.

Capabilities

execute_command(command, timeout) runs a shell command and returns stdout, stderr, and status; get_command_history(count) returns recent executions; get_current_directory() and change_directory(path) inspect and navigate the working directory; list_directory(path) lists contents; read_file(path, start_row?, end_row?) reads full or partial file content; write_file(path, content, mode) overwrites or appends with write verification; insert_file_content, delete_file_content, and update_file_content each operate on specific row numbers within a file.

pip install terminal-controller

How to install

Install via Smithery for automatic Claude Desktop setup (npx -y @smithery/cli install @GongRzhe/terminal-controller-mcp --client claude), via PyPI with the command above (or uv pip install terminal-controller), or from source by cloning the repository and running python setup_mcp.py. Requires Python 3.11+, an MCP-compatible client, and optionally UV/UVX. For Claude Desktop, configure either the recommended UVX method ({"command": "uvx", "args": ["terminal_controller"]}) or direct Python invocation ({"command": "python", "args": ["-m", "terminal_controller"]}) in the platform-specific config file location (~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows); Cursor uses similar configuration. If setup fails, verify the Python version, run python -m terminal_controller directly to surface errors, and check the client's logs.

Who it's for

Anyone who wants an AI assistant to run terminal commands, navigate the filesystem, and make precise row-level file edits directly - with built-in timeout controls, a dangerous-command blacklist, and access scoped to only the commands and directories explicitly granted, rather than unrestricted shell access. The project is MIT-licensed.

Source README

Terminal Controller for MCP

A Model Context Protocol (MCP) server that enables secure terminal command execution, directory navigation, and file system operations through a standardized interface.


smithery badge

Features

  • Command Execution: Run terminal commands with timeout controls and comprehensive output capture
  • Directory Management: Navigate and list directory contents with intuitive formatting
  • Security Measures: Built-in safeguards against dangerous commands and operations
  • Command History: Track and display recent command executions
  • Cross-Platform Support: Works on both Windows and UNIX-based systems
  • File Operations: Read, write, update, insert, and delete file content with row-level precision

Installation

Installing via Smithery

To install Terminal Controller for Claude Desktop automatically via Smithery:

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

Prerequisites

  • Python 3.11+
  • An MCP-compatible client (such as Claude Desktop)
  • UV/UVX installed (optional, for UVX method)

Method 1: PyPI Installation (Recommended)

Install the package directly from PyPI:

pip install terminal-controller

Or if you prefer to use UV:

uv pip install terminal-controller

Method 2: From Source

If you prefer to install from source:

  1. Clone this repository:

    git clone https://github.com/GongRzhe/terminal-controller-mcp.git
    cd terminal-controller-mcp
    
  2. Run the setup script:

    python setup_mcp.py
    

Client Configuration

Claude Desktop

There are two ways to configure Claude Desktop to use Terminal Controller:

Option 1: Using UVX (Recommended)

Add this to your Claude Desktop configuration file:

"terminal-controller": {
  "command": "uvx",
  "args": ["terminal_controller"]
}
Option 2: Using Python Directly
"terminal-controller": {
  "command": "python",
  "args": ["-m", "terminal_controller"]
}

The configuration path varies by operating system:

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

Cursor

For Cursor, use similar configuration settings as Claude Desktop.

Other MCP Clients

For other clients, refer to their documentation on how to configure external MCP servers.

Usage

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

  • "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"

API Reference

Terminal Controller exposes the following MCP tools:

execute_command

Execute a terminal command and return its results.

Parameters:

  • command: The command line command to execute
  • timeout: Command timeout in seconds (default: 30)

Returns:

  • Output of the command execution, including stdout, stderr, and execution status

get_command_history

Get recent command execution history.

Parameters:

  • count: Number of recent commands to return (default: 10)

Returns:

  • Formatted command history record

get_current_directory

Get the current working directory.

Returns:

  • Path of current working directory

change_directory

Change the current working directory.

Parameters:

  • path: Directory path to switch to

Returns:

  • Operation result information

list_directory

List files and subdirectories in the specified directory.

Parameters:

  • path: Directory path to list contents (default: current directory)

Returns:

  • List of directory contents, formatted with icons for directories and files

write_file

Write content to a file with overwrite or append options.

Parameters:

  • path: Path to the file
  • content: Content to write
  • mode: Write mode ('overwrite' or 'append', default: 'overwrite')

Returns:

  • Operation result information including verification of successful write

read_file

Read content from a file with optional row selection.

Parameters:

  • path: Path to the file
  • start_row: Starting row to read from (0-based, optional)
  • end_row: Ending row to read to (0-based, inclusive, optional)

Returns:

  • File content or selected lines

insert_file_content

Insert content at specific row(s) in a file.

Parameters:

  • path: Path to the file
  • content: Content to insert
  • row: Row number to insert at (0-based, optional)
  • rows: List of row numbers to insert at (0-based, optional)

Returns:

  • Operation result information

delete_file_content

Delete content at specific row(s) from a file.

Parameters:

  • path: Path to the file
  • row: Row number to delete (0-based, optional)
  • rows: List of row numbers to delete (0-based, optional)

Returns:

  • Operation result information

update_file_content

Update content at specific row(s) in a file.

Parameters:

  • path: Path to the file
  • content: New content to place at the specified row(s)
  • row: Row number to update (0-based, optional)
  • rows: List of row numbers to update (0-based, optional)

Returns:

  • Operation result information

Security Considerations

Terminal Controller implements several security measures:

  • Timeout controls to prevent long-running commands
  • Blacklisting of dangerous commands (rm -rf /, format, mkfs)
  • Proper error handling and isolation of command execution
  • Access only to the commands and directories specifically granted

Limitations

  • Only commands that complete within the timeout period will return results
  • By default, the server has access to the same file system permissions as the user running it
  • Some interactive commands may not work as expected due to the non-interactive nature of the terminal interface

Troubleshooting

If you encounter issues:

  1. Check that your Python version is 3.11 or higher
  2. Verify that your Claude Desktop configuration is correct
  3. Try running the terminal controller directly to check for errors:
    python -m terminal_controller
    
  4. For UVX-related issues, try:
    uvx terminal_controller
    
  5. Review your MCP client's logs for connection errors

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.