Skip to main content

Tutorial: Claude Code CLI + Local LLM (claw-code-local)

One quarkus-chat-ui instance using Claude Code CLI, another using a local LLM (Ollama) via claw-code-local, talking to each other via MCP.

claw-code-local provides Claude Code CLI-compatible interface for local LLMs, including MCP support.

1. Install Claude Code CLI

npm install -g @anthropic-ai/claude-code

Verify:

claude --version

2. Install Ollama

Linux:

curl -fsSL https://ollama.com/install.sh | sh

macOS:

brew install ollama

Start Ollama:

ollama serve

3. Pull a Model

ollama pull qwen2.5-coder:7b

Verify:

curl http://localhost:11434/v1/models

4. Install claw-code-local

git clone https://github.com/codetwentyfive/claw-code-local
cd claw-code-local
npm install -g .

Verify:

claw --version

5. Configure claw-code-local

mkdir -p ~/.claw
cat > ~/.claw/config.json << 'EOF'
{
"provider": "ollama",
"baseUrl": "http://localhost:11434",
"model": "qwen2.5-coder:7b"
}
EOF

6. Set API Key (for Claude)

export ANTHROPIC_API_KEY=sk-ant-api03-...

7. Download quarkus-chat-ui

Download from Releases.

chmod +x quarkus-chat-ui-linux-amd64

8. Start Alice with Claude (port 28010)

Terminal 1:

./quarkus-chat-ui-linux-amd64 \
-Dchat-ui.provider=claude \
-Dquarkus.http.port=28010

Open http://localhost:28010

9. Start Bob with claw-code-local (port 28020)

Terminal 2:

./quarkus-chat-ui-linux-amd64 \
-Dchat-ui.provider=claw \
-Dquarkus.http.port=28020

Open http://localhost:28020

Note: If claw provider is not available in your version, check the quarkus-chat-ui README for alternative setup.

10. Register MCP Endpoints

For Claude Code CLI:

claude mcp add bob --transport http http://localhost:28020/mcp

For claw-code-local:

claw mcp add alice --transport http http://localhost:28010/mcp

11. Restart Both Instances

Terminal 1 (Ctrl+C, then):

./quarkus-chat-ui-linux-amd64 \
-Dchat-ui.provider=claude \
-Dquarkus.http.port=28010

Terminal 2 (Ctrl+C, then):

./quarkus-chat-ui-linux-amd64 \
-Dchat-ui.provider=claw \
-Dquarkus.http.port=28020

12. Test: Alice (Claude) Sends to Bob (Local LLM)

In Alice's browser (http://localhost:28010):

Use mcp__bob__submitPrompt to send "Hello Bob! What model are you running?" to Bob.
Set _caller to http://localhost:28010

13. Verify: Bob (Local LLM) Receives

In Bob's browser (http://localhost:28020):

[MCP from localhost:28010] Hello Bob! What model are you running?

Bob (Qwen via Ollama) can reply using mcp__alice__submitPrompt.

Cleanup

claude mcp remove bob
claw mcp remove alice

Troubleshooting

ProblemSolution
Ollama connection refusedStart Ollama: ollama serve
Model not foundPull model: ollama pull qwen2.5-coder:7b
claw command not foundnpm install -g . in claw-code-local directory
Local LLM doesn't use toolsUse a larger or more capable model
Slow responsesNormal for local inference; use smaller model or GPU