This guide covers common issues when setting up ClojureMCP, particularly with Claude Desktop.
If Claude Desktop can't run the clojure command:
- Test your command manually: Run the exact command from your config in a terminal
- Check your PATH: Ensure
which clojureworks in a fresh terminal - Enable logging: Check Claude Desktop logs for error messages
- Simplify first: Start with a basic configuration, then add complexity
If you continue to have issues, consider consulting with AI assistants (Claude, ChatGPT, Gemini) about the specific PATH configuration for your system setup.
If your claude_desktop_config.json doesn't work, it's most likely that the PATH environment variable is not set up correctly to find clojure and java.
You can fix this by explicitly setting the PATH environment variable:
{
"mcpServers": {
"clojure-mcp": {
"command": "/opt/homebrew/bin/bash",
"args": [
"-c",
"export PATH=/opt/homebrew/bin:$PATH; exec clojure -Tmcp start :not-cwd true :port 7888"
]
}
}
}- Homebrew (Apple Silicon):
/opt/homebrew/bin - Homebrew (Intel Mac):
/usr/local/bin - Nix:
/home/username/.nix-profile/binor/nix/var/nix/profiles/default/bin - System Default:
/usr/bin:/usr/local/bin
These are some examples to give you a way to debug a failed ClojureMCP startup.
{
"mcpServers": {
"clojure-mcp": {
"command": "/opt/homebrew/bin/bash",
"args": [
"-c",
"echo $PATH > /Users/yourname/claude-desktop-path.txt"
]
}
}
}{
"mcpServers": {
"clojure-mcp": {
"command": "/opt/homebrew/bin/bash",
"args": [
"-c",
"clojure -Tmcp start :not-cwd true :port 7888 | tee /Users/yourname/clojure-mcp-stdout.log"
]
}
}
}If you need to source environment variables (like API keys, see LLM API Keys):
{
"mcpServers": {
"clojure-mcp": {
"command": "/bin/sh",
"args": [
"-c",
"source ~/.my-llm-api-keys.sh && PATH=/Users/username/.nix-profile/bin:$PATH && clojure -Tmcp start :not-cwd true :port 7888"
]
}
}
}Execution error (ConnectException) at sun.nio.ch.Net/connect0 (Net.java:-2).
Connection refused
This means ClojureMCP couldn't connect to your nREPL server. Ensure:
- The nREPL server is running
- The port numbers match (default: 7888)
If you see output other than JSON-RPC messages, it's likely due to ClojureMCP being included in a larger environment. Ensure ClojureMCP runs with its own isolated dependencies.
Claude Desktop logs can be found at:
- macOS:
~/Library/Logs/Claude/ - Windows:
%APPDATA%\Claude\logs\
Check these logs for detailed error messages when ClojureMCP fails to start.