mcp-interactive-repl
# mcp-interactive-repl
An MCP server that provides generic interactive REPL access for Claude and other MCP clients.
Useful for working with command-line tools that have prompt-based interfaces, interactively.
> I only vibed this so that Claude could help me debug an issue in [Quinix](https://quinix.vein.io)
> using the `qvm` interactive debugger; hopefully it's useful.
## Installation
```bash
npm install -g mcp-interactive-repl
```
Or use directly with npx (no install needed).
## Usage
Add to your Claude Code MCP configuration (`~/.claude/settings.json`):
```json
{
"mcpServers": {
"repl": {
"command": "npx",
"args": ["mcp-interactive-repl"]
}
}
}
```
Or if installed globally:
```json
{
"mcpServers": {
"repl": {
"command": "mcp-interactive-repl"
}
}
}
```
## Tools
### repl_start
Start a REPL session with prompt detection. For example, to start the Python REPL:
```json
{
"command": "python",
"args": ["-i"],
"prompt": "^>>> $"
}
```
Parameters:
- `command` (required): Command to run
- `prompt` (required): Regex pattern to detect the prompt
- `args`: Command arguments (default: `[]`)
- `cwd`: Working directory (default: server's current directory)
- `env`: Additional environment variables, merged with server's environment (default: `{}`)
- `initialTimeout`: Max milliseconds to wait for initial prompt (default: 30000)
### repl_send
Send input to a session and wait for the next prompt.
```json
{
"sessionId": "...",
"input": "print('hello')",
"timeout": 30000
}
```
Parameters:
- `sessionId` (required): Session ID from `repl_start`
- `input` (required): Input to send (newline appended automatically)
- `timeout`: Max milliseconds to wait for prompt (default: 30000)
### repl_read
Non-blocking read of the current output buffer.
```json
{
"sessionId": "..."
}
```
Parameters:
- `sessionId` (required): Session ID from `repl_start`
### repl_kill
Terminate a session.
```json
{
"sessionId": "..."
}
```
Parameters:
- `sessionId` (required): Session ID from `repl_start`
### repl_list
List all active sessions. Takes no parameters.
## Development
```bash
npm install
npm run typecheck # Type check
npm run build # Build to dist/
npm run dev # Build and run
```
TDQS
Scored across 5 tools
Each tool maps to a distinct lifecycle action: start, send (blocking), read (non-blocking), kill, list. The blocking vs. non-blocking distinction between repl_send and repl_read is explicitly documented, so overlap is minimal.
All five tools use the same repl_ prefix followed by a short verb (start, send, read, kill, list). The pattern is fully predictable and readable.
Five tools is a tight, well-scoped surface for managing interactive REPL sessions, with no redundant or filler tools.
Session lifecycle (create, interact, inspect, terminate, enumerate) is fully covered. Minor gaps exist: no explicit interrupt/signal-send or status/exit-code tool, though agents can approximate these via repl_send sending control characters.