Skip to content

A high-performance MCP server for terminal command execution and file system operations, written in Rust

License

Notifications You must be signed in to change notification settings

BangRocket/rustterm-mcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rustterm-mcp

A high-performance MCP (Model Context Protocol) server for terminal command execution and file system operations, written in Rust.

Built with the official rmcp SDK.

Features

  • Command Execution - Execute terminal commands with configurable timeouts
  • Command History - Track recent command executions with timestamps and status
  • Directory Navigation - Navigate and list directory contents
  • File Operations - Read, write, and manipulate file contents with row-level precision
  • Cross-Platform - Works on Windows, macOS, and Linux
  • Security - Blocks dangerous commands like rm -rf /
  • Fast - Native compiled binary with async I/O

Installation

From Source

git clone https://github.com/bangrocket/rustterm-mcp.git
cd rustterm-mcp
cargo build --release

The binary will be at target/release/rustterm-mcp.

Pre-built Binaries

Check the Releases page for pre-built binaries.

Usage

With Claude Desktop

Add to your Claude Desktop configuration:

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

{
  "mcpServers": {
    "rustterm": {
      "command": "/path/to/rustterm-mcp"
    }
  }
}

With Cursor

Add to your Cursor MCP configuration (.cursor/mcp.json):

{
  "mcpServers": {
    "rustterm": {
      "command": "/path/to/rustterm-mcp"
    }
  }
}

Available Tools

Tool Description
execute_command Execute a terminal command with optional timeout
get_command_history Retrieve recent command execution history
get_current_directory Get the current working directory
change_directory Change the current working directory
list_directory List files and directories
read_file Read file contents with optional row selection and JSON parsing
write_file Write content to a file (overwrite or append)
insert_file_content Insert content at specific row(s)
delete_file_content Delete row(s) or substrings within rows
update_file_content Update/replace content at specific row(s)

Tool Reference

execute_command

Execute a terminal command with optional timeout.

Parameter Type Required Default Description
command string Yes - The command to execute
timeout integer No 30 Timeout in seconds

Example:

{"command": "ls -la", "timeout": 10}

get_command_history

Retrieve recent command execution history.

Parameter Type Required Default Description
count integer No 10 Number of entries (max 50)

get_current_directory

Get the current working directory. No parameters required.

change_directory

Change the current working directory.

Parameter Type Required Description
path string Yes Path to change to (absolute or relative)

list_directory

List files and directories.

Parameter Type Required Default Description
path string No Current dir Path to list

read_file

Read file contents with optional filtering.

Parameter Type Required Default Description
path string Yes - Path to the file
start_row integer No - Starting row (0-based)
end_row integer No - Ending row (0-based, inclusive)
as_json boolean No false Parse and pretty-print as JSON

write_file

Write content to a file.

Parameter Type Required Default Description
path string Yes - Path to the file
content string Yes - Content to write
mode string No "overwrite" "overwrite" or "append"

insert_file_content

Insert content at specific row(s).

Parameter Type Required Description
path string Yes Path to the file
content string Yes Content to insert
row integer No* Single row number (0-based)
rows array No* Multiple row numbers

*Must specify either row or rows

delete_file_content

Delete row(s) or substrings.

Parameter Type Required Description
path string Yes Path to the file
row integer No* Single row number (0-based)
rows array No* Multiple row numbers
substring string No Delete only this substring within rows

*Must specify either row or rows

update_file_content

Update/replace content at specific row(s).

Parameter Type Required Description
path string Yes Path to the file
content string Yes New content
row integer No* Single row number (0-based)
rows array No* Multiple row numbers
substring string No Replace only this substring within rows

*Must specify either row or rows

Configuration

Environment Variable Description Default
RUST_LOG Log level (trace, debug, info, warn, error) info

Security

The server blocks potentially dangerous commands including:

  • rm -rf /
  • rm -rf /*
  • mkfs
  • Fork bombs (:(){:|:&};:)

File operations are limited to 10 MB to prevent memory exhaustion.

Building from Source

Requirements

  • Rust 1.70+ (install via rustup)

Debug Build

cargo build

Release Build (Optimized)

cargo build --release

The release build includes LTO and is stripped for minimal binary size.

License

MIT - see LICENSE

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

A high-performance MCP server for terminal command execution and file system operations, written in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages