Terminal Controller for MCP is a secure server that enables terminal command execution, directory navigation, and file system operations through a standardized interface, supporting both Windows and UNIX-based systems with built-in security features.
To install Terminal Controller for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @GongRzhe/terminal-controller-mcp --client claude
Install the package directly from PyPI:
pip install terminal-controller
Or using UV:
uv pip install terminal-controller
Clone the repository:
git clone https://github.com/GongRzhe/terminal-controller-mcp.git
cd terminal-controller-mcp
Run the setup script:
python setup_mcp.py
Configure Claude Desktop to use Terminal Controller in one of two ways:
Add this to your Claude Desktop configuration file:
"terminal-controller": {
"command": "uvx",
"args": ["terminal_controller"]
}
"terminal-controller": {
"command": "python",
"args": ["-m", "terminal_controller"]
}
Configuration file locations:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
For Cursor, use similar configuration settings as Claude Desktop.
For other clients, refer to their documentation on how to configure external MCP servers.
Once configured, you can use natural language to interact with your terminal:
ls -la
in the current directory"execute_command
Execute a terminal command and return its results.
Parameters:
command
: The command line command to executetimeout
: Command timeout in seconds (default: 30)Returns:
get_command_history
Get recent command execution history.
Parameters:
count
: Number of recent commands to return (default: 10)Returns:
get_current_directory
Get the current working directory.
Returns:
change_directory
Change the current working directory.
Parameters:
path
: Directory path to switch toReturns:
list_directory
List files and subdirectories in the specified directory.
Parameters:
path
: Directory path to list contents (default: current directory)Returns:
write_file
Write content to a file with overwrite or append options.
Parameters:
path
: Path to the filecontent
: Content to writemode
: Write mode ('overwrite' or 'append', default: 'overwrite')Returns:
read_file
Read content from a file with optional row selection.
Parameters:
path
: Path to the filestart_row
: Starting row to read from (0-based, optional)end_row
: Ending row to read to (0-based, inclusive, optional)Returns:
insert_file_content
Insert content at specific row(s) in a file.
Parameters:
path
: Path to the filecontent
: Content to insertrow
: Row number to insert at (0-based, optional)rows
: List of row numbers to insert at (0-based, optional)Returns:
delete_file_content
Delete content at specific row(s) from a file.
Parameters:
path
: Path to the filerow
: Row number to delete (0-based, optional)rows
: List of row numbers to delete (0-based, optional)Returns:
update_file_content
Update content at specific row(s) in a file.
Parameters:
path
: Path to the filecontent
: 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:
If you encounter issues:
python -m terminal_controller
uvx terminal_controller
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "terminal-controller" '{"command":"python","args":["-m","terminal_controller"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"terminal-controller": {
"command": "python",
"args": [
"-m",
"terminal_controller"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"terminal-controller": {
"command": "python",
"args": [
"-m",
"terminal_controller"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect