MCP ExplorerExplorer

Mcpterm

@dwrtzon 9 months ago
4 MIT
FreeCommunity
AI Systems
#mcp-server#model-context-protocol
A MCP tool server that provides stateful, text user interface compatible terminal sessions.

Overview

What is Mcpterm

mcpterm is an MCP tool server that provides stateful, TUI-compatible terminal sessions, enabling users to run commands in a persistent terminal environment.

Use cases

Use cases for mcpterm include running commands in a persistent terminal session, utilizing TUI applications like vim or Python REPL, and integrating with desktop applications like Claude for enhanced terminal functionality.

How to use

To use mcpterm, clone the repository from GitHub, compile it using ‘make’, and move the generated binary to a directory in your PATH. Additionally, configure it in the Claude Desktop settings to integrate with the application.

Key features

Key features of mcpterm include stateful terminal sessions, compatibility with TUI applications, and the ability to run commands in a specific directory context.

Where to use

mcpterm can be used in software development environments, particularly for tasks that require terminal interactions, such as coding, debugging, and running scripts.

Content

mcpterm

An MCP tool server that provides stateful, TUI-compatible terminal sessions.

This is a proof-of-concept using mcp-go.

Works quite well with Claude Desktop.

Usage

Clone the repo and run make to generate bin/mcpterm.

git clone https://github.com/dwrtz/mcpterm.git
cd mcpterm
make

Move the mcpterm binary to a directory in your PATH.

sudo mv bin/mcpterm /usr/local/bin/mcpterm

Add to Claude Desktop

Edit your claude_desktop_config.json (on Mac it’s in ~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "mcpterm": {
      "command": "mcpterm",
      "args": []
    }
  }
}

Restart Claude Desktop. Now Claude should see the 2 tools provided by mcpterm.

Tools

run: Runs a command in a stateful terminal session. E.g. if you cd into a directory, subsequent commands will run in that directory.

runScreen: Runs a command or series of keystrokes and returns the screen output. Intended for TUI apps such as vim or a python REPL.

Tips:

You may want to tell Claude to use following control sequences with the runScreen tool:

"^X": "\x18", // Ctrl+X
"^O": "\x0F", // Ctrl+O
"^J": "\x0A", // Enter
"^C": "\x03", // Ctrl+C
"^D": "\x04", // Ctrl+D
"^Z": "\x1A", // Ctrl+Z
"^[": "\x1B", // Escape
"^H": "\x08", // Backspace
"^M": "\x0D", // Carriage return
"^L": "\x0C", // Form feed
"^G": "\x07", // Bell
"^U": "\x15", // Clear line
"^W": "\x17", // Delete word
"^Y": "\x19", // Paste from kill buffer
"^V": "\x16", // Literal input
"^K": "\x0B", // Kill line
"^E": "\x05", // End of line
"^A": "\x01", // Beginning of line
"^I": "\x09", // Tab

While not perfect, it works pretty well. Claude is able to use vim to write a Dockerfile, then run the container in an interactive session, then run commands in the container such as a python REPL.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers