MRP (MRMD Runtime Protocol) server for Bash
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mrmd_bash-0.1.1.tar.gz.
File metadata
- Download URL: mrmd_bash-0.1.1.tar.gz
- Upload date:
- Size: 33.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10d290a89fbc06a8d8ba89cf36153ba980ac90171844588debd6798ec8f945e6
|
|
| MD5 |
528c72b879adfc7f6f73122b52299b3d
|
|
| BLAKE2b-256 |
c1187708405181e6130c4d7d8a69cfb944c0ed95a6b514b020a955d0f4e59b3d
|
File details
Details for the file mrmd_bash-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mrmd_bash-0.1.1-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03813a2f117e20f680c8020e4c54fc5f574674f5c964a20ae9fdcb24e864defb
|
|
| MD5 |
d047881e92e59b2548b86d51a88fc15b
|
|
| BLAKE2b-256 |
244cd76752f919d7bc8b06207d5ce517377d5214a6eb57776528c0e7bab6a327
|