Skip to main content

Tutorial: Two Claude Code CLI Agents

Two quarkus-chat-ui instances, both using Claude Code CLI, talking to each other via MCP.

1. Install Claude Code CLI

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

Verify:

claude --version

2. Set API Key

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

3. Download quarkus-chat-ui

Download the native executable for your platform from Releases:

PlatformBinary
Linux x86_64quarkus-chat-ui-linux-amd64
Linux ARM64quarkus-chat-ui-linux-arm64
macOS Intelquarkus-chat-ui-macos-amd64
macOS Apple Siliconquarkus-chat-ui-macos-arm64
Windowsquarkus-chat-ui-windows-amd64.exe
chmod +x quarkus-chat-ui-linux-amd64

4. Start Alice (port 28010)

Terminal 1:

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

Open http://localhost:28010 in a browser.

5. Start Bob (port 28020)

Terminal 2:

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

Open http://localhost:28020 in another browser window.

6. Register MCP Endpoints

Terminal 3:

# So Alice can call Bob
claude mcp add bob --transport http http://localhost:28020/mcp

# So Bob can call Alice
claude mcp add alice --transport http http://localhost:28010/mcp

Verify:

claude mcp list

Output:

alice: http://localhost:28010/mcp (http)
bob: http://localhost:28020/mcp (http)

7. Restart Both Instances

Claude Code CLI reads MCP registrations at startup. Stop and 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=claude \
-Dquarkus.http.port=28020

8. Test: Alice Sends to Bob

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

Use mcp__bob__submitPrompt to send "Hello Bob!" to Bob.
Set _caller to http://localhost:28010

9. Verify: Bob Receives

In Bob's browser (http://localhost:28020), you should see:

[MCP from localhost:28010] Hello Bob!

Bob can reply using mcp__alice__submitPrompt. The _caller parameter tells Bob where to send the reply.

Cleanup

claude mcp remove alice
claude mcp remove bob

Troubleshooting

ProblemSolution
mcp__bob__submitPrompt not foundRun claude mcp add bob ... and restart the instance
Connection refusedCheck the target instance is running on the correct port
Bob can't replyRun claude mcp add alice ... and restart Bob