Skip to main content

Documentation Index

Fetch the complete documentation index at: https://ahvn.top/llms.txt

Use this file to discover all available pages before exploring further.

The HeavenBase philosophy: expose an empty workspace and let the agent figure out the schema, entities, and queries through MCP tools. You write zero entity code.

1. Create and serve an empty workspace

Create a single Python file:
# serve_space.py
import heavenbase as hb

ws = hb.HeavenBase("my-space", preset="debug")

print(ws.to_mcp_json(name="my-space-mcp", profile="agent", transport="http", host="127.0.0.1", port=7001))
ws.serve(name="my-space-mcp", profile="agent", transport="http", host="127.0.0.1", port=7001)
No entities, no fields, no schemas. HeavenBase’s generic MCP tools handle everything dynamically.

2. Run it

python serve_space.py
The server prints the client config and starts listening:
{
  "mcpServers": {
    "my-space-mcp": {
      "transport": "http",
      "url": "http://127.0.0.1:7001/mcp"
    }
  }
}
The example uses Streamable HTTP at /mcp. HeavenBase supports the common MCP transports. Use one transport per server process and connect clients to the matching endpoint:
TransportPython serve callClient endpoint
Streamable HTTPtransport="http"http://127.0.0.1:7001/mcp
SSEtransport="sse"http://127.0.0.1:7001/sse
stdiotransport="stdio"command transport, no URL
In Python, pass the same transport to ws.to_mcp_json(...) and ws.serve(...). For example, use transport="sse" in both calls when an SSE-only client needs /sse.
Workspace MCP servers close over the live workspace object. Keep serve_space.py running while external agents use it. Unlike a persisted Toolkit registry ref, an empty workspace MCP server is a live process that exposes the workspace you created in that script.

3. Connect your agent

Add the server to your preferred coding agent:
Add the HTTP server with the Claude Code CLI:
claude mcp add --transport http my-space-mcp http://127.0.0.1:7001/mcp
claude mcp list
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:
{
  "mcpServers": {
    "my-space-mcp": {
      "type": "http",
      "url": "http://127.0.0.1:7001/mcp"
    }
  }
}
Start a new Claude Code session, run /mcp, and confirm my-space-mcp is connected before asking the agent to inspect the workspace.

4. Let the agent work

Your agent discovers the HeavenBase agent MCP profile: define_entity, list_entities, describe_entity, upsert, get, set, count, query, and explain. For a note-only memory surface, expose the smaller memory profile instead:
memory = ws.to_mcp(name="my-memory-mcp", profile="memory")
memory.run("remember", key="repo-context", text="Use conda run -n hvnb for HeavenBase tests.", tags=["setup"])
memory.run("search_memory", text="conda")
The memory profile exposes only remember, recall, search_memory, list_memory, and set_memory. It is the right first tool surface when an agent needs persistent notes but should not create schemas or run generic queries yet. Here’s a real interaction with an empty workspace:
> Create a Product entity with name (ShortText), price (Float), and category (ShortText) fields.

> Add a product: "Ergonomic Keyboard" priced at $89.99 in category "electronics".

> Add a product: "27-inch 4K Monitor" priced at $349.00 in category "electronics".

> Add a product: "Bamboo Desk Organizer" priced at $24.50 in category "office".

> What percentage of products in my store cost less than $100?
> List all products in the electronics category sorted by price ascending.
The agent inspects the available tools, defines entities on the fly, writes data, and runs queries — everything through the same MCP interface.
You never write entity code. The agent defines entities via define_entity, writes rows via upsert, and queries via query. Your only job is keeping the server running.

5. Real-world workflow

From a single empty workspace, an agent can build an entire application:
$ python serve_space.py

# Now in your agent:
> Create a Customer entity with name (ShortText), email (ShortText), signup_date (Timestamp) fields.

> Add a customer: Alice Chen, alice@example.com, signed up on 2026-03-15.
> Add a customer: Bob Martinez, bob@example.com, signed up on 2026-01-10.
> Add a customer: Carol Nguyen, carol@example.com, signed up on 2026-04-01.

> Create an Order entity with customer_id (Identifier), total (Float), status (ShortText) fields.

> Add an order for Alice: order A1, total $129.99, status "shipped".
> Add an order for Bob: order B1, total $45.00, status "delivered".
> Add an order for Carol: order C1, total $299.00, status "pending".

> What is the average order value across all orders?
> Which customers have no orders in the last 30 days?
All data, schema, and queries live in the workspace. Start with preset="debug" for a no-Docker first run, then move to preset="local-lts" when you want the local Postgres, LanceDB, and Elasticsearch stack.

Further Exploration

Related resources: