Connect and Test from WhatsApp
James had a working MCP server. Claude Code had built it, tested it, started it, and made a real tool call to prove it worked. But the server was sitting in his project directory, disconnected from everything.
"So I have a server that works," James said. "How do I get it into my agent?"
Emma did not look up. "You already know how. You did it in Chapter 56."
James thought about it. "The time server. I ran openclaw mcp set, restarted the gateway, and the tools appeared in the dashboard." He looked at his terminal. "Same thing?"
"Same thing. Different URL."
You are doing exactly what James is doing. Your server works. Now you connect it to your agent and test it for real.
Step 1: Start Your Server
Your server needs to be running before OpenClaw can talk to it. Open a terminal in your tutorclaw-mcp project directory and run:
uv run python server.py
You should see output ending with something like:
Uvicorn running on http://127.0.0.1:8000
That means your server is listening. Keep this terminal open. If you close it, the server stops and the connection breaks.
Use two terminal windows for this lesson. One runs the server. The other runs the OpenClaw commands.
Step 2: Connect to OpenClaw
Open your second terminal. Two commands:
openclaw mcp set tutorclaw '{"url":"http://localhost:8000/mcp","transport":"streamable-http"}'
openclaw gateway restart
That is the same pattern you used in Chapter 56, Lesson 7 when you connected the time server. The only difference is the URL: instead of pointing to a pre-built package, you are pointing to the server you just built.
Step 3: Check It Registered
openclaw mcp list
You should see tutorclaw in the list. If you want to double-check the details:
openclaw mcp show tutorclaw
Make sure the URL matches exactly what your server printed on startup. A single character off (missing /mcp, wrong port) breaks the connection silently — no error in chat, just silence.
Step 4: Test from WhatsApp
Pick up your phone. Send a message to your agent:
Register a new learner named James Chen
Wait for the response. Your agent should:
- Recognize that this matches the tool description you wrote in Lesson 4
- Call the tool with the learner name
- Return a welcome message with a learner ID
You get something like: "Welcome, James Chen! Your learner ID is 5262ec54-8d3d-49fe-8ccd-5ede5b9d173f."
A message you typed on your phone triggered a tool that you described, Claude Code built, and your agent discovered through MCP.
Step 5: Verify the Tool Actually Ran
Go back to the dashboard. Find the conversation log for the message you just sent. You should see a tool badge next to the response, showing the agent used register_learner.
This matters because a text response alone does not prove the tool ran. The agent is smart enough to make up a plausible answer. The tool badge is your proof that the full chain worked:
- Message received from WhatsApp
- Agent picked the right tool based on its description
- Tool ran on your MCP server
- Result came back through the gateway to WhatsApp
Without the badge, you cannot tell a real tool call from a made-up response. The dashboard is the source of truth.
Try With AI
Exercise 1: Diagnostic Checklist
My MCP server is running but the tool does not appear in the
OpenClaw dashboard. Walk me through a diagnostic checklist.
What should I check first, second, third?
What you are learning: Debugging connection issues follows a repeatable sequence: server running, URL correct, gateway restarted, gateway log. Building this into habit saves you from guessing.
Exercise 2: Expand the Server
I want to add two more tools to my TutorClaw server:
get_learner_progress and update_progress. Walk me through the
cycle for each: spec, build, connect.
What you are learning: The cycle from Lessons 2 through 5 repeats for every tool. Each new tool follows the same pattern: describe, steer, build, connect, verify.
Exercise 3: Compare Time Server and TutorClaw
In Chapter 56, I connected the time server. Now I connected my
own TutorClaw server. What was the same? What was different?
Why does the same openclaw mcp command work for both?
What you are learning: MCP does not care who built the server or how it runs. The config pattern is the same. The gateway treats both identically. This is what lets you scale from one tool to dozens.
James sent the WhatsApp message. Ten seconds later, his phone buzzed. "Welcome, James Chen! Your learner ID is 5262ec54-8d3d-49fe-8ccd-5ede5b9d173f."
He stared at the screen. "I described this tool an hour ago. Told Claude Code what I wanted. It built the server, tested it, proved it worked. I connected with two commands. And it just worked from my phone." He shook his head. "When we connected our inventory system to the supplier's order platform at the warehouse, that took three weeks and two consultants. Same idea, different century."
He opened the dashboard. Tool badge confirmed: register_learner, called once, result returned.
Emma leaned over. "That feeling? I still get it. My first MCP server was a document lookup tool for a legal team. Three tools, nothing fancy. When the partner sent a WhatsApp message asking about a contract clause and the agent pulled the actual document section, not a summary, the actual text, I just sat there."
"How long ago was that?"
"Eight months. And I still remember the exact message." She paused. "I also remember my second server. Worked perfectly in tests. Connected to OpenClaw. The dashboard showed the tools. I sent a WhatsApp message and got... nothing. No error in chat. No tool badge. Thirty minutes of debugging."
"What was it?"
"I forgot to restart the gateway after changing the URL. Thirty minutes because the fix was one command."
James laughed. "I almost did the same thing."
"The pattern sticks after you almost lose time to it." Emma straightened up. "You proved the cycle works: describe, build, connect, verify. One tool, start to finish." She nodded toward his screen. "Chapter 58 takes this server and turns it into a product. More tools, persistent storage, payment gates. But the pattern is the same. Every new tool follows this cycle."
James took a screenshot of the WhatsApp conversation. "First thing I am showing the team on Monday."