Sandbox
@aplavin/julia-mcp

MCP server for persistent Julia sessions

julia-mcp connects an AI assistant to Julia through a stdio MCP server. It keeps a Julia process alive per project directory, so state survives across calls and sessions recover after crashes. You can also restart a session or list active sessions from the assistant.

86 stars17 forksPythonUpdated 25d ago
Who it's for

Builders who want their agent to run Julia code with remembered state and project-specific sessions.

What it delivers

You can iterate on Julia code without redoing startup, reloading packages, or re-explaining context.

What it does

Persistent Julia execution

`julia_eval` runs code in a long-lived Julia session so variables, functions, and loaded packages stay available.

Session restart

`julia_restart` clears state by restarting the session for a project or temporary workspace.

Session listing

`julia_list_sessions` shows the active sessions and their status.

Isolated project sessions

Each `env_path` gets its own Julia process, so separate projects do not share state.

Stdio transport

The server uses stdio only, so it does not open ports or sockets.

Crash recovery

Sessions start on demand and can recover after crashes without manual management.

How to get it

  1. 1First, clone the repository
    cd /any_directory
    git clone https://github.com/aplavin/julia-mcp.git
  2. 2User-wide (recommended — makes Julia available in all projects)
    claude mcp add --scope user julia -- uv run --directory /any_directory/julia-mcp python server.py
  3. 3Project-scoped (only available in the current project)
    claude mcp add --scope project julia -- uv run --directory /any_directory/julia-mcp python server.py
  4. 4Append Julia flags after server.py to override the defaults (--startup-file=no…
    claude mcp add --scope user julia -- uv run --directory /any_directory/julia-mcp python server.py --threads=1 --startup-file=yes
  5. 5User-wide — makes Julia available in all projects
    codex mcp add julia -- uv run --directory /any_directory/julia-mcp server.py
  6. 6Append Julia flags after server.py to override the defaults (--startup-file=no…
    codex mcp add julia -- uv run --directory /any_directory/julia-mcp server.py --threads=1 --startup-file=yes

README

julia-mcp

MCP server that gives AI assistants access to efficient Julia code execution. Avoids Julia's startup and compilation costs by keeping sessions alive across calls, and persists state (variables, functions, loaded packages) between them — so each iteration is fast.

  • Sessions start on demand, persist state between calls, and recover from crashes — no manual management
  • Each project directory gets its own isolated Julia process
  • Pure stdio transport — no open ports or sockets

Tools

  • julia_eval(code, env_path?, timeout?) — execute Julia code in a persistent session. env_path sets the Julia project directory (omit for a temporary session). timeout defaults to 60s and is auto-disabled for Pkg operations.
  • julia_restart(env_path?) — restart a session, clearing all state. If env_path is omitted, restarts the temporary session.
  • julia_list_sessions — list active sessions and their status

Requirements

  • uv (you might already have it installed)
  • Julia – any version, julia binary must be in PATH
    • Recommended packages – used automatically if available in the global environment:
    • Revise.jl - to pick code changes up without restarting
    • TestEnv.jl — to properly activate test environment when env_path points to /test/

The server itself is written in Python since the Python MCP protocol implementation is very mature.

Usage

First, clone the repository:

cd /any_directory
git clone https://github.com/aplavin/julia-mcp.git

Then register the server with your client of choice (see below).

That's it! Your AI assistant can now execute Julia code more efficiently, saving of TTFX.

Claude Code

User-wide (recommended — makes Julia available in all projects):

claude mcp add --scope user julia -- uv run --directory /any_directory/julia-mcp python server.py

Project-scoped (only available in the current project):

claude mcp add --scope project julia -- uv run --directory /any_directory/julia-mcp python server.py
Custom Julia CLI arguments

Append Julia flags after server.py to override the defaults (--startup-file=no --threads=auto):

claude mcp add --scope user julia -- uv run --directory /any_directory/julia-mcp python server.py --threads=1 --startup-file=yes

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "julia": {
      "command": "uv",
      "args": ["run", "--directory", "/any_directory/julia-mcp", "python", "server.py"]
    }
  }
}
Custom Julia CLI arguments

Append Julia flags after server.py to override the defaults (--startup-file=no --threads=auto):

{
  "mcpServers": {
    "julia": {
      "command": "uv",
      "args": ["run", "--directory", "/any_directory/julia-mcp", "python", "server.py", "--threads=1", "--startup-file=yes"]
    }
  }
}

Codex CLI

User-wide — makes Julia available in all projects:

codex mcp add julia -- uv run --directory /any_directory/julia-mcp server.py
Custom Julia CLI arguments

Append Julia flags after server.py to override the defaults (--startup-file=no --threads=auto):

codex mcp add julia -- uv run --directory /any_directory/julia-mcp server.py --threads=1 --startup-file=yes

VS Code Copilot

Add to .vscode/mcp.json:

{
  "servers": {
    "julia": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/julia-mcp", "python", "server.py"]
    }
  }
}
Custom Julia CLI arguments

Append Julia flags after server.py to override the defaults (--startup-file=no --threads=auto):

{
  "servers": {
    "julia": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/julia-mcp", "python", "server.py", "--threads=1", "--startup-file=yes"]
    }
  }
}

GitHub Copilot CLI

Edit $HOME/.copilot/mcp-config.json, and enter

{
  "mcpServers": {
    "julia": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "--directory", "/path/to/julia-mcp", "python", "-u", "server.py"]
    }
  }
}

Beware that on Windows, \ must be escaped (so write as C:\\my_folder\\...)

GitHub Copilot Cloud Agent

To enable the MCP for a single repo, go to Settings, then scroll down the left panel until you get to Copilot, open that dropdown and select Cloud agent. Then scroll down to the section Model Context Protocol (MCP) and add the following

{
  "mcpServers": {
    "julia": {
      "type": "local",
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/aplavin/julia-mcp",
        "julia-mcp"
      ],
      "tools": ["*"]
    }
  }
}

Details

  • Each unique env_path gets its own isolated Julia session. Omitting env_path uses a temporary session that is cleaned up on MCP shutdown.
  • If env_path ends in /test/, the parent directory is used as the project and TestEnv is activated automatically. For this to work, TestEnv must be installed in the base environment.
  • Julia is launched with --threads=auto and --startup-file=no by default. Pass custom Julia CLI flags after server.py to override these defaults entirely.

Alternatives

Other projects that give AI agents access to Julia:

  • MCPRepl.jl and REPLicant.jl require you to manually start and manage Julia sessions. julia-mcp handles this automatically.
  • DaemonConductor.jl (linux only) runs Julia scripts, but calls are independent and don't share variables. julia-mcp retains state between calls.

Files in the repo

Repository payload7 top-level entries
  • .gitignore
  • LICENSE
  • pyproject.toml
  • README.md
  • server.py
  • test_server.py
  • uv.lock

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

43k

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

14k
okf-memory/
okf-agent-memory

Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.

547
tirth8205/
code-review-graph

Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

31k
2akouwu/
reverify

Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.

1.1k
t8y2/dbxConnectors

20 MB lightweight cross-platform database client for 90+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 90+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP Server。

19k