Skip to main content
A tool without an owner is just a function looking for trouble.
HeavenBase can turn ordinary Python functions into MCP tools, but the important boundary is ownership. A registered Toolkit and every Capsule it references belong to one explicit application workspace. That workspace keeps creation, inspection, serving, and deletion pointed at the same durable state. There is no process-global Toolkit database, and another process must open the same registered workspace before it can load the tools.

1. Motivation

A global registry makes short demos look convenient until two applications register math-tools, one application deletes another’s revision, or a server silently opens the wrong database. HeavenBase makes the workspace explicit instead:
The workspace owns the Toolkit row, the referenced Capsule rows, and their backend lifecycle. Your Python functions remain normal functions; HeavenBase adds durable identity and an MCP adapter around them.

2. Create a Workspace-Owned Toolkit

Create math_tools.py:
Run it once:
Registration captures callable source, signatures, annotations, imports, serializers, and Toolkit metadata into workspace-owned rows. The stable reference is quickstart/math-tools:1.
Capsule restoration executes captured Python. Register and load only code you trust, and treat access to the owning workspace as code-execution authority.

3. Load and Serve from Another Process

The serving process opens the same workspace explicitly:
You can run this code after deleting math_tools.py because the workspace retains the captured Capsules. The process still needs the same HeavenBase home, workspace registration, and artifact store; persistence is workspace-scoped, not ambient or magically cross-machine. The server listens at http://127.0.0.1:7001/mcp by default. Use one transport per process:

4. Inspect and Serve with the CLI

Every Toolkit command accepts the owning workspace:
The call prints 5. Start the HTTP server without a serving script:
The same ownership rule applies in Python:
Deleting a Toolkit tombstones its row by default. Dropping the workspace is the broader lifecycle action because it also owns the associated data and Capsule rows.

5. Connect a Client

Keep the server running, then configure one client for its Streamable HTTP URL.
Add and verify the server:
Start a new session and run /mcp to inspect the discovered tools.
For another client, start with the JSON emitted by hb mcp mcp-json quickstart.math-tools --workspace math-demo and adapt only the client-specific wrapper key.

6. Try It Out

Ask the connected agent:
The agent discovers multiply and add from their signatures and docstrings, calls them, and should return 3085.

Summary

  • Concrete Toolkits and their referenced Capsules belong to an explicit workspace.
  • Registration may outlive the source file, but loading still requires the same workspace authority.
  • Python and CLI operations use the same workspace-owned rows.
  • Workspace-bound tools are trusted executable code, not inert data.

Further Exploration

Related resources: