bg-server-mcp-shell

bg-server-mcp-shell

MCP server for running long-running processes in PTY with real-time output streaming, enabling interactive dev servers, watch modes, and CLI tools.

Category
Visit Server

README

Documentations : Main | Tests

Cover Image

bg-mcp-shell-server

MCP server for running long-running processes in PTY with real-time output streaming

✨ Features

  • Real-time output streaming - Live terminal output
  • Interactive processes - Send input to running processes
  • Multiple sessions - Control multiple processes simultaneously
  • Buffered output - Full output history preserved
  • PTY emulation - True terminal experience

👥 Perfect for

  • 🚀 Dev servers (Vite, webpack, Next.js)
  • 🔄 Watch modes (nodemon, jest --watch)
  • 🐳 Docker/Docker Compose
  • 🧪 Long-running tests
  • 💬 Interactive CLI tools

🤖 Use cases prompts

[ You ] " Run web dev server , check for errors , and fix . "

[ You ] " Run playwright tests and monitor for errors . "

[ You ] " Build and deploy to Cloudflare . "

[ You ] " Start docker-compose and tell me when postgres is ready . "

[ You ] " Tell me what processes are running . "

[ You ] " Restart processes . "

📊 Comparison

Creator Long-running processes Output in response Interaction Best for
bg ✅ Yes ✅ Buffer + terminal ✅ writeInput Dev servers, watch modes
tumf ❌ Hangs ✅ Yes ✅ Yes ls, cat, grep, git status
hdresearch ❌ Hangs ✅ Yes ✅ Yes Basic commands
run_command ⚠️ Blocking/Async ⚠️ Partial ❌ No Standard commands with user approval

🚀 Quick Start

Installation

npm install -g bg-server-mcp-shell

Configuration

Add to your MCP client config (e.g., Claude Desktop, Cline):

{
  "mcpServers": {
    "shell": {
      "command": "npx",
      "args": ["-y", "bg-server-mcp-shell@latest"],
      "env": {
        "COLOR": "false"
      }
    }
  }
}

🛠️ Functions

Quick command (wait for completion): startProcessAndWait Run command and wait for completion

echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"startProcessAndWait","arguments":{"cmd":"echo","args":["Hello"],"timeoutMs":5000}}}' | npx bg-server-mcp-shell

Start a background process: startProcessBackground Start long-running process in background

echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"startProcessBackground","arguments":{"cmd":"npm","args":["run","dev"]}}}' | npx bg-server-mcp-shell

List sessions: listSessions List all active sessions

echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"listSessions","arguments":{}}}' | npx bg-server-mcp-shell

Get output: getSessionOutput Read buffered output from session

echo '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"getSessionOutput","arguments":{"sessionId":"<id>"}}}' | npx bg-server-mcp-shell

Send input: writeInput Send input to running process

echo '{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"writeInput","arguments":{"sessionId":"<id>","data":"rs\n"}}}' | npx bg-server-mcp-shell

Stop process: stopProcess Stop a running session

echo '{"jsonrpc":"2.0","id":6,"method":"tools/call","params":{"name":"stopProcess","arguments":{"sessionId":"<id>"}}}' | npx bg-server-mcp-shell

Cleanup finished sessions: cleanupSessions Remove finished sessions from memory

# Cleanup specific session
echo '{"jsonrpc":"2.0","id":7,"method":"tools/call","params":{"name":"cleanupSessions","arguments":{"sessionId":"<id>"}}}' | npx bg-server-mcp-shell

# Or cleanup all finished sessions
echo '{"jsonrpc":"2.0","id":8,"method":"tools/call","params":{"name":"cleanupSessions","arguments":{}}}' | npx bg-server-mcp-shell

🧪 Development

Full documentation: See Tests Documentation for complete testing guide, coverage, and API reference.

📦 Technical Details

🤝 Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new features
  4. Ensure all tests pass: npm test
  5. Submit a pull request

🐛 Issues & Bug Reports

Found a bug or have a feature request? Please report it on GitHub:

Report an Issue

📄 License

MIT © Bruno Garret

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured