MCP server for executing Python and R scripts in containerized environments
Project description
Coala Runtime
An MCP (Model Context Protocol) server for executing Python and R scripts in containerized environments with support for dynamic package installation and file mounting.
Features
- Containerized Execution: Run Python and R scripts in isolated Docker containers
- Dynamic Package Installation:
- Python: Uses
uvfor fast package installation - R: Uses
r2uandBiocManagerfor CRAN and Bioconductor packages
- Python: Uses
- File Mounting: Bind-mount local files and directories into containers
- Pre-installed packages: Python image includes numpy, pandas, matplotlib; R image includes tidyverse
- MCP Integration: Exposes
coala_python_executorandcoala_r_executortools for LLM interaction
Prerequisites
- Docker installed and running
- Python 3.11 or higher
- Built Docker images (see Building Docker Images)
Installation
# Install dependencies
uv pip install -e .
# Or using pip
pip install -e .
Docker Images
By default, the server pulls the executor images from Docker Hub if they are not present locally:
hubentu/coala-runtime-python:latest→ tagged ascoala-runtime-python:latesthubentu/coala-runtime-r:latest→ tagged ascoala-runtime-r:latest
To build the images locally instead (e.g. for development or custom Dockerfiles), run with --build or build manually:
coala-runtime --build
# or
python -m coala_runtime --build
Manual build (same as --build):
./docker/build.sh
This creates:
coala-runtime-python:latest- Python executor imagecoala-runtime-r:latest- R executor image
Usage
As MCP Server
The server can be run as an MCP server for LLM integration:
coala-runtime
Or with the module runner:
python -m coala_runtime
Use coala-runtime --build (or python -m coala_runtime --build) to build Docker images locally before starting.
Configuration
See MCP_CONFIG.md for detailed configuration instructions for various MCP clients (Cursor, Claude Desktop, etc.).
Tool Schemas
coala_python_executor
Executes Python scripts in a containerized environment with uv package management.
Input:
scriptorscript_file(one required): Inline Python code or host path to a.pyfilepackages(optional): Additional packages to install via uv. The image already includes numpy, pandas, matplotlib. Can include version specifiers (e.g., 'requests>=2.31.0')conda_packages(optional, Python only): Conda specs installed before pip/uv (requires conda/mamba in the image)docker_image(optional): Docker image to run instead of the default Coala Python image (e.g.python:3.12-slim,quay.io/biocontainers/...)skip_package_install(optional): Iftrue, skip install step (typical whendocker_imagealready has all dependencies)input_files(optional): Map of container paths to host paths for bind-mounting (e.g., {'/input/data.csv': '/host/path/data.csv'})timeout(optional): Execution timeout in seconds (default: 300, 0 = no timeout, max: 3600)
Output:
success: Whether execution succeededexit_code: Process exit code (0 = success)stdout: Standard output from scriptstderr: Standard error outputoutput_files: List of output file paths (for files/images generated by the script)output_data: Echoed output for strings/numbers (captured via print statements)container_logs: Full container execution logs including package installationexecution_time: Execution time in seconds
coala_r_executor
Executes R scripts in a containerized environment with r2u and BiocManager.
Input:
scriptorscript_file(one required): Inline R code or host path to an.Rfilepackages(optional): Additional R packages to install. Use 'bioc::package_name' format for Bioconductor packages. The image already includes tidyverse. Examples: ['ggplot2', 'dplyr', 'bioc::Biobase']docker_image(optional): Docker image to run instead of the default Coala R image (must provideRscriptonPATH)skip_package_install(optional): Iftrue, skip install step (typical whendocker_imagealready has all dependencies)input_files(optional): Map of container paths to host paths for bind-mounting (e.g., {'/input/data.csv': '/host/path/data.csv'})timeout(optional): Execution timeout in seconds (default: 300, 0 = no timeout, max: 3600)
Output: Same as coala_python_executor
Development
# Install with dev dependencies
uv pip install -e ".[dev]"
# Run tests
pytest
# Format code
black src tests
# Lint code
ruff check src tests
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 coala_runtime-0.1.0.tar.gz.
File metadata
- Download URL: coala_runtime-0.1.0.tar.gz
- Upload date:
- Size: 84.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72671bf1df7a4e72a9268be449ab5f4c02f9ae04df0d313986ef5c82549ebf2d
|
|
| MD5 |
06019fb080f201ba90465d8d4ac804d9
|
|
| BLAKE2b-256 |
22bc31e47f07e8cfc4b84934b51ba0e9b3596e63ee5a63a019be9bd48d2f1a73
|
Provenance
The following attestation bundles were made for coala_runtime-0.1.0.tar.gz:
Publisher:
release.yml on coala-info/coala-runtime
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coala_runtime-0.1.0.tar.gz -
Subject digest:
72671bf1df7a4e72a9268be449ab5f4c02f9ae04df0d313986ef5c82549ebf2d - Sigstore transparency entry: 1453651254
- Sigstore integration time:
-
Permalink:
coala-info/coala-runtime@84a4d47474ffb2c7335f40c6080b8ec64e73cac3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/coala-info
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@84a4d47474ffb2c7335f40c6080b8ec64e73cac3 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file coala_runtime-0.1.0-py3-none-any.whl.
File metadata
- Download URL: coala_runtime-0.1.0-py3-none-any.whl
- Upload date:
- Size: 29.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5861c912801b6c96ed4104dac4ca637614a665c17dcef480d1fbd97042dd8f9b
|
|
| MD5 |
369b5c02b144e46088b41a4e1701f515
|
|
| BLAKE2b-256 |
b7f2785b6dd5866045d7535c2941bd2b4199cb037216f838ba35e9031aa19334
|
Provenance
The following attestation bundles were made for coala_runtime-0.1.0-py3-none-any.whl:
Publisher:
release.yml on coala-info/coala-runtime
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coala_runtime-0.1.0-py3-none-any.whl -
Subject digest:
5861c912801b6c96ed4104dac4ca637614a665c17dcef480d1fbd97042dd8f9b - Sigstore transparency entry: 1453651356
- Sigstore integration time:
-
Permalink:
coala-info/coala-runtime@84a4d47474ffb2c7335f40c6080b8ec64e73cac3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/coala-info
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@84a4d47474ffb2c7335f40c6080b8ec64e73cac3 -
Trigger Event:
workflow_dispatch
-
Statement type: