Skip to main content
The best canvas is an empty one.
In this tutorial, we create an empty HeavenBase workspace and expose it as an MCP server. This allows any agent using HeavenBase MCP as a data surface and structured memory service. The agents decide how to store their observation, what to store, and how to query it. The MCP server handles the rest. At the end of the tutorial, we’ll run a toy e-commerce scenario. The agent defines Product, Customer, and Order entities on the fly, then maintain the database with daily operations like adding products, registering customers, and recording orders. Finally, the agent answers analytical questions about the business, such as “What percentage of products cost less than $100?” and “What should I recommend to Alice based on her order history?“

1. Create an Empty Workspace

Create a single Python file:
No entities, no fields, no schemas. HeavenBase’s generic MCP tools handle everything dynamically.
hb.HeavenBase("my-space", preset="debug").drop() clears the demo workspace before the server starts. Use this reset line for repeatable tutorials, and remove it when you want the workspace data to persist across server restarts.
The preset argument controls the backend configuration. The debug preset uses SQLite and in-memory stores for a lightweight, no-Docker setup. The local-lts preset uses local Postgres, LanceDB, and Elasticsearch for a more robust setup that still runs on your machine. Both presets support the full MCP toolset, with the debug preset focusing on ease of use and the local stack being more performant for larger data. The profile argument selects which set of workspace MCP tools the server exposes. HeavenBase built-in currently ships full for trusted administrative flows, agent for day-one schema and data work, memory for note-style memory, and memstate for project-scoped memory state. This page uses profile="agent" because it gives the agent enough tools to define entities, inspect schemas, upsert rows, patch rows, count, query, and explain routing while leaving out bulk operations, existence checks, and deletes.

2. Run It

The server prints the client config and starts listening:
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: 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 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 my-space-mcp is connected before asking the agent to use the arithmetic tools.

4. Agent Profile and Workspace MCP Tools

This tutorial uses profile="agent", HeavenBase’s default day-one workspace MCP surface. It exposes a curated schema-and-data toolkit backed by Catalog and MetaSchema: agents inspect workspace structure through schema tools and discover concrete rows through Catalog-aware listing and description. The agent profile intentionally leaves out bulk mutation, batch reads, existence checks, and deletes. Use profile="full" only for trusted administrative flows. Keep the model-facing profile narrow and route destructive actions through application code. One workspace can expose multiple MCP toolkits, each with a different profile:
The agent profile is enough for first-run agents to define schemas, write and patch rows, read context, count rows, query, and inspect route plans. The memory profile is a five-tool note surface (remember, recall, search_memory, list_memory, set_memory). The memstate profile is for versioned project memory (memstate_* verbs). The full profile adds bulk operations, existence checks, and deletes for trusted code paths. HeavenBase also ships a database profile for read/query flows plus run_snippet and suggest_sql when the optional database extension is enabled.

5. Try It Out: A Toy E-Commerce Scenario

Copy each prompt below into your agent chat, in order. Each block is one message you can paste and send.
1

Set workspace context

Tell the agent which MCP server to use:
When starting a new session, it is recommended to paste this prompt first to set the minimal workspace context.
2

Define your business model

Ask the agent to create the core entities, one prompt at a time:
3

Daily operations

Seed the workspace with catalog items, customers, and orders:
4

Analytical questions

Ask analytical questions. Expected answers are shown below each prompt.
66.67% (4 out of 6 products)
Wireless Mouse ($49.99), Ergonomic Keyboard ($89.99), 27-inch 4K Monitor ($349.00)
Ergonomic Keyboard (2)
1 (Alice)
  • Hi Alice — complete your desk setup
  • You already run a keyboard-and-monitor setup. Add a Wireless Mouse ($49.99) for a matched input stack, and a Bamboo Desk Organizer ($24.50) to tidy cables and accessories.
  • Suggested add-ons: Wireless Mouse · Bamboo Desk Organizer

  • Hi Bob — we found chairs for you
  • You searched for a chair earlier. The Wooden Chair isn’t available right now, but the Mesh Office Chair ($199.99) is — ergonomic mesh for long sessions.
  • Suggested for you: Mesh Office Chair
Now you have a persistent, queryable, structured memory surface for your agent. This e-commerce toy example completes without you writing a single CRUD function or defining business logic. The agent inspects the available tools, defines entities on the fly, writes data, and runs queries through the same MCP interface.

Further Exploration

Related resources: