I suppose you need some spec file that instructs to not change .julia this way, or at least ask for permission first. For anything other than installing packages possibly. I’m new to agentic coding, and spec files. I suppose people should collaborate on good Julia-specific spec files.
Until then, previous idea: Julia stdlib/Base was made read-only, maybe you can do the same for .julia. Except that would be bad for installing packages…
I don’t know of a good sandboxing for this, and I suppose tools like Claude Code, might also think they need to change to read/write and have that power, same as you do…
I want to try having a depot stack with a read only depot with most packages preinstalled and then a per session depot where the agent can do whatever it wants. In my experience the LLM usually ignore generic instructions if it cycles for long enough.
Here’s a julia-mcp bash script for Linux that automatically Git-clones julia-mcp, downloads uv download and starts it, isolated in a platform-specific directory. (Disclaimer: contains Gemini-generated code.)
#!/bin/bash -e
git_clone_if_missing() {
local repo_url="$1"
local target_dir="$2"
if [[ -z "$repo_url" || -z "$target_dir" ]]; then
echo "ERROR: Usage: git_clone_or_update <git_url> <target_directory>" >&2
exit 1
fi
if [[ ! -d "$target_dir" ]]; then
echo "INFO: Directory "$target_dir" does not exist. Cloning \"$repo_url\"." >&2
git clone "$repo_url" "$target_dir"
else
echo "INFO: Directory "$target_dir" already exists." >&2
if [[ ! -d "$target_dir/.git" ]]; then
echo "ERROR: '$target_dir' exists but is not a git repository." >&2
exit 1
fi
fi
}
install_uv_if_missing() {
local target_bin_dir="$1"
if [[ -z "$target_bin_dir" ]]; then
echo "ERROR: Usage: ensure_uv_installed <bin_directory_path>" >&2
exit 1
fi{
"servers": {
"julia": {
"type": "stdio",
"command": "julia-mcp"
}
},
"inputs": []
}
local uv_binary="$target_bin_dir/uv"
if [[ -f "$uv_binary" ]]; then
echo "INFO: uv installed in \"$target_bin_dir\"." >&2
else
echo "INFO: uv not found in \"$target_bin_dir\". Installing..." >&2
# Ensure the directory exists
mkdir -p "$target_bin_dir"
# 3. Install using the official script
# We set UV_INSTALL_DIR so it installs to the specific target folder.
# We set INSTALLER_NO_MODIFY_PATH=1 to prevent it from editing your .bashrc/.zshrc
export UV_INSTALL_DIR="$target_bin_dir"
export INSTALLER_NO_MODIFY_PATH=1
if (curl -LsSf https://astral.sh/uv/install.sh | sh >&2); then
echo "INFO: uv successfully installed to \"$target_bin_dir\"." >&2
else
echo "ERROR: Failed to install uv." >&2
exit 1
fi
fi
}
JLMCPDIR="$HOME/.julia-mcp-server_`uname -m`"
mkdir -p "$JLMCPDIR" && cd "$JLMCPDIR" || exit 1
git_clone_if_missing "https://github.com/aplavin/julia-mcp.git" "julia-mcp"
install_uv_if_missing "`pwd`/bin"
exec bin/uv run --directory "julia-mcp" python server.py "$@"
If you put this julia-mcp script into ~/.local/bin or so, the VS-Code mcp.json configuration file can then just be
I installed and have Julia-mcp working in both VS Code and in Raycast. I’m able to call basic function such as x = rand(10). If I try to ask for a package installed, the LLM understands and says it will execute using Pkg; Pkg.add(my_package_name) but it just spins after that. I first tried with Plots, but then an easier package. This happens both with VS Code and Raycast.
Reproducible examples are welcome – something one can just run through command line with julia-mcp, without any LLMs! I might’ve seen something similar (hanging on Pkg operations), but it’s been quite rare, far from every time – so I didn’t spend time understanding if it’s just a transient issue or not.
I first asked using Julia to create 10 random numbers. That worked fine. You could see the thinking that it used julia_mcp.
Then I asked: create a lognormal distribution with mu=12 and sigma=0.5. It started thinking, said it needed to use Julia_mcp, and it needed to add the Distributions package. It just hangs at Running…