MCP servers ensure you never reinvent the wheel. We want you to never reinstall the wheels either.
.py file is gone.
1. Demo: Create a Math Toolkit
Define plain functions and pass them as a list. HeavenBase uses each function’s__name__ as the tool name:
Passing a list of functions is the simplest form: the function
__name__ becomes the tool name and the docstring becomes the tool description. For custom names, pass a dict such as {"add": add, "mul": mul} instead. HeavenBase captures source code, type annotations, and import references automatically. The namespace="quickstart" argument groups this demo Toolkit under the quickstart registry prefix so hb mcp list and serve commands can target quickstart.math-tools. The reason value is a human-readable registry revision note, useful when you inspect Toolkit history later.2. Run Once to Persist
math_tools.py; the functions now live in the registry.
That persistence is the important distinction. After registration, serving can happen from another script, after a reboot, or from another machine when the registry database is shared.
3. Load and Serve from Anywhere
With the toolkit persisted, loading and serving require no function definitions and no imports from the original module:http://127.0.0.1:7001/mcp:
In Python, pass the same transport to
loaded.to_mcp_json(transport="sse") and loaded.serve(transport="sse", wait=True) when an SSE-only client needs /sse.
Splitting registration and serving into two scripts is deliberate: it shows that the toolkit outlives the script that created it. HeavenBase’s registry decouples creation from serving, so the same registered Toolkit can be served from any process that can read the registry DB. You can combine both steps in one file when convenience matters more.
4. Serve Directly from the CLI
Skip the server script entirely. The CLI loads and serves any persisted toolkit:call command should print 5; mcp-json should print the same HTTP config shown above.
5. Connect Your Agent
Add the server to your preferred coding agent:- Claude Code
- Codex
- Cursor
- VS Code / Copilot
- OpenCode
- OpenClaw
- Hermes
- LM Studio
- HeavenBase
- OpenAI Agents SDK
Add the HTTP server with the Claude Code CLI:Claude Code stores local-scoped MCP servers in Start a new Claude Code session, run
~/.claude.json. For a repo-shared setup, run the same command with --scope project from the project root, or create .mcp.json:/mcp, and confirm math-tools is connected before asking the agent to use the arithmetic tools.6. Try It Out
Once connected, ask your agent to use the math tools:Because the toolkit is persisted, you can stop the server, reboot, and resume with
hb mcp serve quickstart.math-tools: no script, no redefinition, no loss.
