[Showcase] framework-shells: Lightweight Process Orchestration for MCP & Codex Servers
Hi everyone,
I’m sharing framework-shells, a Python-based process orchestration engine for managing long-running background processes—like hosting a Codex MCP server, running JSON-RPC stdio servers, or providing interactive PTYs for agents/tools.
In the context of MCP/Codex CLI, it handles the “heavy lifting” of process lifecycle management: start/stop/restart, PID tracking, log capture, and (optionally) persistence across restarts via dtach.
Why use it for MCP?
- Multiple Backends: Use
PTYfor interactive terminals,Pipesfor JSON-RPC/stdio servers, ordtachfor persistent sessions. - Runtime Namespacing: Namespaced storage based on repo fingerprints and secrets—useful for multi-project environments.
- Live Monitoring: Built-in FastAPI router with a dashboard and real-time logs via WebSockets.
- Shellspec (YAML): Define your server configurations in simple YAML files for easy deployment.
Note: this is not a security sandbox by itself; it’s a lifecycle/orchestration layer. If you need stronger containment, pair it with allowlisted shellspecs and OS-level sandboxing.
Example Use Case
If you are building an MCP server that needs to host a persistent shell or a sidecar LSP server, you can orchestrate it via framework-shells to get automatic logging, PID tracking, and graceful shutdowns out of the box.
Here’s a tiny example of managing a stdio-style server (like an MCP server) as a long-lived process:
from framework_shells import get_manager
mgr = await get_manager()
rec = await mgr.spawn_shell_pipe(["codex", "mcp-server"], label="mcp:codex")
# Subscribe to output and stream it elsewhere (logs/UI/WebSocket)
q = await mgr.subscribe_output(rec.id)
# Send input (JSON-RPC) into the process
await mgr.write_to_pty(rec.id, '{"jsonrpc":"2.0","id":1,"method":"ping"}\\n')
Quick Start
You can install it directly via pip:
python -m pip install "framework-shells @ git+https://github.com/mrsurge/framework-shells@main"
Improvement
- Tell me where I need improvement, I’m actively developing this framework… And im sure I am missing a bunch of use cases, scenarios, pain points, etc …

