The Agent gets a menu of approved queries, not the keys to the SQL pantry.
1. Motivation
Free-form SQL generation makes execution difficult to review. The Database extension lets applications persist approved snippets and searchable predicates as typed rows, then expose a narrow MCP surface. Complete Data Connection first sows, database_id, and warehouse.db exist in the same Python process.
2. Register a Read-Only Snippet
db-database row identifies the external source.
3. Run through the Attached API
suggest_sql searches approved snippets and predicates.
It does not ask an LLM to invent SQL inside the engine.
Write snippets remain refused unless heavenbase.database.allow_write is explicitly enabled.
The default is false.
4. Add a Searchable Predicate
suggest_sql.
5. Expose the Database Profile
database profile scopes ordinary read/query tools plus suggest_sql and run_snippet.
Use the MCP Toolkit reference when you are ready to register and serve the Toolkit to an external Agent.
6. Keep the Boundary Honest
- Schema ingestion does not copy source rows.
- Search proposes approved snippets; it does not execute them.
- Snippet execution reconnects to the external database.
- Read-only is the default, and write access is a deliberate configuration change.
- HeavenBase does not claim distributed transactions with the source database.
Summary
- Persist approved SQL as
db-snippetrows. - Use
ws.databasefor direct application calls. - Use the
databaseMCP profile for a small Agent-facing surface. - Keep connection credentials in the execution environment.

