Skip to main content
Glama
aplavin
by aplavin

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

Related MCP server: HOPX MCP Server

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

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"]
    }
  }
}

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

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"]
    }
  }
}

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.

Available Tools

3 tools
julia_evalA

ALWAYS use this tool to run Julia code. NEVER run julia via command line.

Persistent REPL session with state preserved between calls. Each env_path gets its own session, started lazily. Do not type Pkg.activate() explicitly in your code; instead, specify the env_path argument to select the environment.

Args: code: Julia code to evaluate. Use display(...)/println(...) to see output. env_path: Julia project directory path. Omit for a temporary environment. timeout: Seconds (default: 60). Auto-disabled for Pkg operations. julia_cmd: Custom Julia command, should be used rarely, only when explicitly requested. Examples: "julia +1.11", "julia --check-bounds=yes", "/path/to/julia".

ParametersJSON Schema
NameRequiredDescriptionDefault
codeYes
env_pathNo
timeoutNo
julia_cmdNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.8/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description fully discloses behavior: persistent REPL session with state preserved, lazy session creation per env_path, timeout auto-disabled for Pkg operations, and the need for display/println to see output. It lacks details on error handling or side effects, but covers key behavioral traits adequately.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured: a bold directive first, then a line about session behavior, then a bullet-point list for arguments. Every sentence adds value, and there is no redundant information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 4 parameters, no annotations, and an existing output schema, the description covers purpose, usage guidelines, behavior, and parameter details comprehensively. It explains session persistence, environment management, and special timeout behavior, making the tool easy to use correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, but the description explains every parameter's purpose and usage: code requires display/println, env_path defaults to a temporary environment, timeout auto-disables for Pkg, and julia_cmd is rarely used with examples. This adds significant meaning beyond the schema's field names and types.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states 'ALWAYS use this tool to run Julia code' and explains it as a persistent REPL session. The verb 'run' and resource 'Julia code' are specific, and the instruction 'NEVER run julia via command line' distinguishes it from command-line execution, setting it apart from siblings like julia_list_sessions and julia_restart.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear directives: 'ALWAYS use this tool to run Julia code' and 'NEVER run julia via command line.' It also advises against typing Pkg.activate() explicitly, recommending the env_path argument instead. This explicitly communicates when to use this tool and how to use it correctly.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

julia_list_sessionsA

List all active Julia sessions and their environments.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavior. It mentions 'active' but does not explain what constitutes active, nor does it cover output format, side effects, or error cases. This is insufficient for a tool with no annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no redundant or unnecessary words. It conveys the core purpose efficiently.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a straightforward list tool with no parameters and an output schema present, the description is largely complete. However, it could briefly mention what 'environments' entails or the structure of the output for added clarity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has no parameters, and the description correctly implies no inputs are needed. Schema coverage is 100%, so the description adds minimal extra semantic value, but it reinforces the parameterless nature.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly specifies the tool's action ('list') and resource ('active Julia sessions and their environments'), which distinguishes it from siblings like julia_eval (evaluation) and julia_restart (restarting).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool over siblings or when it is appropriate. The context signals and sibling names provide implicit differentiation, but the description itself lacks direct usage recommendations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

julia_restartA

Restart a Julia session, clearing all state.

IMPORTANT: Restarting is slow and loses all session state. Very rarely needed. Revise.jl is loaded automatically in every session, so code changes to loaded packages are picked up without restarting. Only restart as a last resort when the session is truly broken, or code changes that Revise cannot fix. Do NOT restart just because source files were edited between script or test runs — Revise picks up those changes automatically.

Args: env_path: Environment to restart. If omitted, restarts the temporary session (NOT every active session) — most callers should pass the same env_path they used in julia_eval.

ParametersJSON Schema
NameRequiredDescriptionDefault
env_pathNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Without annotations, the description fully discloses behavioral traits: restarting is slow, loses all state, Revise.jl is loaded automatically, and the default behavior of env_path restarts only the temporary session.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured. It starts with the core purpose, then provides crucial context in an IMPORTANT note, and includes a clear Args section for the parameter. Every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the presence of an output schema (which can describe return values), the description covers all other aspects: purpose, behavior, parameter semantics, and usage context. It is complete for the tool's complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% coverage for the single parameter env_path. The description adds essential meaning: environment to restart, default behavior (restarts temporary session, not all active), and recommends using the same env_path from julia_eval.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Restart a Julia session, clearing all state,' which is a specific verb-resource pair. It distinguishes from siblings julia_eval and julia_list_sessions, which evaluate code and list sessions respectively.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says 'Only restart as a last resort' and explains that Revise.jl automatically picks up code changes, so restarting is rarely needed. Provides clear when-to-use and when-not-to-use guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 3 tool updatesv0.1.0
    • First observedjulia_eval
    • First observedjulia_list_sessions
    • First observedjulia_restart

TDQS

A4.4/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: julia_eval runs code, julia_list_sessions lists active sessions, and julia_restart restarts a session. There is no overlap or ambiguity.

Naming Consistency5/5

All tool names follow a consistent 'julia_verb' pattern with snake_case, making it easy to predict and understand the function of each tool.

Tool Count5/5

With 3 tools, the server covers the essential interactions with a Julia REPL (evaluating code, listing sessions, restarting). The count is well-scoped for the server's purpose.

Completeness4/5

The tool set covers core lifecycle operations (evaluate, list, restart). Minor gaps like obtaining session metadata or clearing state without restarting exist, but the surface is functional for typical usage.

Maintenance

ActivityMaintained
ResponsivenessResponsive

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aplavin/julia-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server