Using with Claude Desktop
ModelContextProtocol.jl can be integrated with Anthropic's Claude Desktop application to allow Claude to access your custom tools, resources, and prompts.
Setup Instructions
- Launch Claude Desktop application
- Go to
File→Settings→Developer - Click the
Edit Configbutton - A configuration file will open in your default editor
Configuration
To register your MCP servers with Claude, modify the configuration file with entries for each server.
Important: Full Paths Required
⚠️ You must use the full absolute path to your Julia project and scripts. The path should include:
- The
--projectflag pointing to your ModelContextProtocol.jl directory - The full path to the script file
Example Configuration
{
"mcpServers": {
"time": {
"command": "julia",
"args": [
"--project=/home/username/ModelContextProtocol",
"/home/username/ModelContextProtocol/examples/time_server.jl"
],
"env": {}
},
"mcp_tools_example": {
"command": "julia",
"args": [
"--project=/home/username/ModelContextProtocol",
"/home/username/ModelContextProtocol/examples/reg_dir.jl"
],
"env": {}
},
"http_server": {
"command": "npx",
"args": ["mcp-remote", "http://127.0.0.1:3000", "--allow-http"],
"env": {}
}
}
}Platform-Specific Path Examples
macOS/Linux:
"args": [
"--project=/home/username/julia_projects/ModelContextProtocol",
"/home/username/julia_projects/ModelContextProtocol/examples/time_server.jl"
]Windows:
"args": [
"--project=C:\\Users\\username\\Documents\\ModelContextProtocol",
"C:\\Users\\username\\Documents\\ModelContextProtocol\\examples\\time_server.jl"
]Note: Julia packages are typically cloned without the .jl extension. If you cloned via Pkg.dev("ModelContextProtocol"), check your .julia/dev/ directory for the exact path.
Note: On Windows, use double backslashes (\\) in JSON strings.
For each server entry:
"time","mcp_tools_example": Unique identifiers for your servers (you choose these names)"command": The command to run (should be"julia"for STDIO servers,"npx"for HTTP servers via mcp-remote)"args": Array of arguments:- First argument:
"--project=/full/path/to/ModelContextProtocol"(the package directory) - Second argument: Full path to your server script
- First argument:
"env": Optional environment variables (can be empty{})
Using HTTP Servers
For HTTP-based MCP servers, you need to:
Start your HTTP server separately:
cd /path/to/ModelContextProtocol julia --project=. examples/simple_http_server.jlOr with full paths:
julia --project=/home/username/ModelContextProtocol /home/username/ModelContextProtocol/examples/simple_http_server.jlNote: The directory is typically
ModelContextProtocolwithout.jlextension.Configure Claude to connect via mcp-remote:
"http_server": { "command": "npx", "args": ["mcp-remote", "http://127.0.0.1:3000", "--allow-http"] }
Note: The --allow-http flag is required since ModelContextProtocol.jl currently supports HTTP only, not HTTPS.
Applying Changes
For configuration changes to take effect:
- Save the configuration file
- Close all running Claude processes:
- On Windows: Use Task Manager to end all Claude processes
- On macOS: Quit the application
- Restart the Claude Desktop application
Using Your MCP Server
Once configured, you can tell Claude to use your MCP server:
Please connect to the MCP server named "time" and tell me the current time.Claude will connect to your server, discover available tools and resources, and use them to fulfill your requests.
Troubleshooting
If Claude cannot connect to your server:
- Verify full paths: Ensure you're using absolute paths for both
--projectand the script file - Check directory name: Julia packages are cloned without
.jlextension (e.g.,ModelContextProtocolnotModelContextProtocol.jl) - Check the server name: Must match exactly what's in your configuration
- Verify the paths:
- Test your command in a terminal first:
julia --project=/your/full/path/ModelContextProtocol /your/full/path/ModelContextProtocol/examples/time_server.jl - If this works in terminal, it should work in Claude
- Test your command in a terminal first:
- Precompile dependencies: Run this first to avoid timeout issues:
cd /path/to/ModelContextProtocol julia --project=. -e "using Pkg; Pkg.instantiate(); using ModelContextProtocol" - Check Claude's Developer Console:
- Open Claude Desktop
- Press Cmd+Opt+I (Mac) or Ctrl+Shift+I (Windows/Linux)
- Look for error messages in the Console tab
Common Issues
- "Package ModelContextProtocol not found": The
--projectpath is incorrect - "No such file or directory": The script path is incorrect (check if directory has
.jlextension or not) - Server timeout: Julia compilation is slow on first run - precompile first
- Windows path issues: Remember to use double backslashes in JSON
- Wrong directory name: Package directories typically don't include
.jl(useModelContextProtocolnotModelContextProtocol.jl)