Skip to main content
MCP servers ensure you never reinvent the wheel. We want you to never reinstall the wheels either.
Most MCP servers define functions and then start a process. HeavenBase adds registry persistence: the toolkit’s source code, signatures, docstrings, and revision history are captured in a Capsule registry. Register once, then serve the toolkit from a small script or the CLI after the original .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

At this point the toolkit is checksummed and stored in the registry. You can delete 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:
The server prints the MCP config and listens at http://127.0.0.1:7001/mcp:
HeavenBase supports the common MCP transports. Use one transport per server process and connect clients to the matching endpoint: 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:
List, inspect, and call tools without writing a line of server code:
The 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:
Add the HTTP server with the Claude Code CLI:
Claude Code stores local-scoped MCP servers in ~/.claude.json. For a repo-shared setup, run the same command with --scope project from the project root, or create .mcp.json:
Start a new Claude Code session, run /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:
The agent discovers each tool’s name, description, and parameter schema through MCP, then calls them as needed.
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.

Further Exploration

Next steps: