Skip to content

JuliaPluto/rainbow-mcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Julia MCP Server

A Model Context Protocol (MCP) server for executing Julia code through Pluto.jl notebooks. Built with direct integration using the @plutojl/rainbow package.

Features

  • Julia Code Execution: Run Julia code with comprehensive result capture
  • Type Inference: Automatic type detection for Julia values (Int64, Float64, String, etc.)
  • Package Management: Install and list Julia packages
  • State Monitoring: Real-time worker status and execution tracking
  • Session Management: Persistent Julia sessions across requests
  • Error Handling: Robust error capture and reporting
  • MCP Compliance: Full Model Context Protocol implementation

Prerequisites

  • Node.js 18+
  • Julia 1.6+
  • Pluto.jl package

Installation

  1. Install Julia and Pluto.jl:

    julia -e 'using Pkg; Pkg.add("Pluto")'
  2. Start Pluto server:

    julia -e 'using Pluto; Pluto.run(host="127.0.0.1", port=1234, launch_browser=false, require_secret_for_open_links=false, require_secret_for_access=false)'
  3. Install and build:

    npm install
    npm run build

Usage

Start the MCP server:

npm start

Development mode:

npm run dev

Run tests:

npm run test:integration

Available Tools

Execution

  • julia_execute - Execute Julia code with full output capture
  • julia_eval - Evaluate expressions with type inference

Package Management

  • julia_install_package - Install Julia packages
  • julia_list_packages - List installed packages with status

State Management

  • julia_worker_state - Get worker status and running cells
  • julia_interrupt - Interrupt long-running executions
  • julia_get_cell_result - Get detailed cell results by ID

Example Usage

// Execute Julia code
{
  "method": "tools/call",
  "params": {
    "name": "julia_execute",
    "arguments": {
      "code": "x = 5 + 3; println(\"Result: $x\"); x"
    }
  }
}

// Returns:
{
  "result": "8",
  "output": "Result: 8\n",
  "execution_time": 1234,
  "error": null
}

Architecture

Simplified Design:

  • Single SimplifiedJuliaMCPServer class
  • Direct integration with Rainbow's Host and Worker classes
  • No custom manager layers - reduced from 1080+ to ~600 lines of code

Key Components:

  • Rainbow Host: Manages Pluto server connections and worker lifecycle
  • Rainbow Worker: Handles code execution and state monitoring
  • MCP Protocol: Standard tools/resources/prompts implementation

Configuration

Environment variables:

  • PLUTO_HOST: Pluto server host (default: 127.0.0.1)
  • PLUTO_PORT: Pluto server port (default: 1234)

Development

npm run build    # Compile TypeScript
npm run lint     # Run ESLint
npm run format   # Format with Prettier

Testing

Integration tests cover all 7 MCP tools with detailed console output. Tests require a running Pluto server on localhost:1234.

npm run test:integration

License

MIT License

Related Projects

About

A julia mcp executioner based on @plutojl/rainbow 🌈 and pluto🎈

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published