Skip to main content

mrmd-bash

MRP (MRMD Runtime Protocol) server for Bash. Enables notebook-style editors to execute Bash code with persistent sessions, completions, and variable inspection.

Installation

pip install mrmd-bash

Or with uv:

uv pip install mrmd-bash

Usage

Start the server:

mrmd-bash --port 8001

The server will be available at http://localhost:8001/mrp/v1/.

Options

--host HOST       Host to bind to (default: 127.0.0.1)
--port PORT       Port to bind to (default: 8001)
--cwd PATH        Working directory for bash sessions
--log-level LEVEL Log level: debug, info, warning, error (default: info)
--reload          Enable auto-reload for development

Features

Feature Support Notes
execute ✅ Run code and return result
executeStream ✅ Stream output via SSE
interrupt ✅ Cancel running execution (SIGINT)
complete ✅ Completions via compgen
inspect ❌ Not supported
hover ✅ Variable values and command types
variables ✅ Environment and shell variables
variableExpand ❌ Bash variables are flat
reset ✅ Restart bash session
isComplete ✅ Detect incomplete statements
format ❌ Not supported
assets ❌ Not supported

API Examples

Check capabilities

curl http://localhost:8001/mrp/v1/capabilities

Execute code

curl -X POST http://localhost:8001/mrp/v1/execute \
  -H "Content-Type: application/json" \
  -d '{"code": "echo Hello, World!"}'

Get completions

curl -X POST http://localhost:8001/mrp/v1/complete \
  -H "Content-Type: application/json" \
  -d '{"code": "ec", "cursor": 2}'

List variables

curl -X POST http://localhost:8001/mrp/v1/variables \
  -H "Content-Type: application/json" \
  -d '{"session": "default"}'

Stream execution

curl -X POST http://localhost:8001/mrp/v1/execute/stream \
  -H "Content-Type: application/json" \
  -d '{"code": "for i in 1 2 3; do echo $i; sleep 1; done"}'

Sessions

Sessions maintain persistent Bash state:

  • Environment variables persist between executions
  • Working directory changes persist
  • Shell functions and aliases persist
# Create a session
curl -X POST http://localhost:8001/mrp/v1/sessions \
  -H "Content-Type: application/json" \
  -d '{"id": "my-session"}'

# Execute in session
curl -X POST http://localhost:8001/mrp/v1/execute \
  -H "Content-Type: application/json" \
  -d '{"code": "export MY_VAR=hello", "session": "my-session"}'

# Variable persists
curl -X POST http://localhost:8001/mrp/v1/execute \
  -H "Content-Type: application/json" \
  -d '{"code": "echo $MY_VAR", "session": "my-session"}'

# Reset session (clear state)
curl -X POST http://localhost:8001/mrp/v1/sessions/my-session/reset

# Delete session
curl -X DELETE http://localhost:8001/mrp/v1/sessions/my-session

Completions

The server provides completions via bash's compgen:

  • Commands: builtins, functions, aliases, executables
  • Files: paths with / prefix
  • Variables: names with $ prefix

Development

# Clone and install in development mode
git clone <repo>
cd mrmd-bash
pip install -e ".[dev]"

# Run with auto-reload
mrmd-bash --reload

# Run tests
pytest

Protocol

This server implements the MRMD Runtime Protocol (MRP).

License

MIT

Metadata

Release files for mrmd-bash 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mrmd-bash 0.1.2
File Size Uploaded
mrmd_bash-0.1.2.tar.gz 34.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mrmd-bash 0.1.2
File Interpreter ABI Platform
mrmd_bash-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 59.0 kB

Release files / mrmd_bash-0.1.2.tar.gz

Download URL mrmd_bash-0.1.2.tar.gz
Size 34.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e72c635096f1e837cea6d5a2bf6fd110a4384478841f391e651b36d209a4d2fb
BLAKE2b-256 checksum
How to use checksums
aeabf790f5486882beee53e4a660767af41ead601aea89fb201ee00e72c72aec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / mrmd_bash-0.1.2-py3-none-any.whl

Download URL mrmd_bash-0.1.2-py3-none-any.whl
Size 24.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4fd32ead91af52a6727ac4abe568c1df301e97104b2959d9d0ffb46a08363d2
BLAKE2b-256 checksum
How to use checksums
1f322fd5c88681ad93012cdaba79babb573ec3fd1dac3503a4b1b473787c854a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page