Skip to content

HarnessRouter Community Edition: the self-hosted, Apache-2.0 edition of the unified interface for agent harnesses. Run Codex, Claude Code, Hermes, PI, DSH, and more through one API, with sessions, streaming, files, cancellation, and failure handling. Implements the Unified Harness Protocol (UHP), an open standard. Your keys, your infrastructure.

fix(kits): a kit's tools come from the kit, not from whether you typed a password

richard-epsillacef6c99c161e
diff --git a/README.md b/README.md
index ac826422..2b3f332b 100644
--- a/README.md
+++ b/README.md
@@ -230,9 +230,12 @@ the instance is gone; copy it and you have moved the instance, harnesses, transc
## Starter kits
-A kit is a working product in one click. It provisions the harness it needs, installs the skill
-that teaches that agent the product's format, and opens its own app. More arrive over time; your
-instance lists the ones it has.
+Starter kits are worked examples, and they are here to show you what this can be pointed at.
+
+Each one is a whole agent product rather than a snippet: an app, an agent configured to drive it,
+and the skill that teaches that agent the format it writes. Use one, then read it: every kit is
+open source, and the distance between "I see how Slides works" and "I can build the one my
+customers need" is meant to be short. More arrive over time; your instance lists the ones it has.
![The Starter Kits page, before any kit has been launched](docs/images/dashboard-1-starter-kits.png)
diff --git a/gateway/app.py b/gateway/app.py
index 7b0acca0..104acd5b 100644
--- a/gateway/app.py
+++ b/gateway/app.py
@@ -7198,6 +7198,37 @@ async def _db_validate(engine: str, conn: str) -> tuple[str, str, str, str]:
return eng, c, host, db
+async def _hosted_db_entry(hid: str, v: dict | None, decl: dict) -> None:
+ """The database ENTRY, with no credential in it.
+
+ A kit that declares `launch.database` gets its database tool the moment it is launched, the
+ same way a kit that declares media gets its media tool — because the tool belongs to the KIT
+ DEFINITION, not to the credential. Tying the entry's existence to a connection string meant
+ a dashboard harness could sit there with the five built-in tools and no way to reach a
+ database, and nothing on the page explaining that the tool was missing rather than broken.
+
+ An entry with no record is honestly unconnected: the tool is listed, and asking it anything
+ says so. That is a better thing to hand someone than a tool that is not there at all, which
+ reads as "this kit cannot do that" rather than "this kit is not finished being set up".
+
+ Never overwrites a connected entry — reconnecting is _hosted_db_attach's job, and this runs
+ on every launch including the idempotent second press.
+ """
+ origins = _own_origins()
+ if not origins:
+ raise uhp_error(501, "gateway_address_not_configured",
+ "This server has no address an agent could reach it on — set "
+ "HARNESS_PUBLIC_BASE_URL.", "database")
+ cur = _mcp_list(v)
+ if any(str(e.get("id") or "") == decl["id"] for e in cur):
+ return # already there, connected or not
+ entry = {"id": decl["id"], "name": decl["name"],
+ "url": origins[0] + _HOSTED_MCP_PREFIX + "database", "transport": "http",
+ "enabled": True}
+ await _mcp_write(hid, cur + [entry])
+ print(f"[sql] {hid}: database tool provisioned (no connection yet)", flush=True)
+
+
async def _hosted_db_attach(org: str, hid: str, v: dict | None, decl: dict,
checked: tuple[str, str, str, str], sample_rows: bool) -> None:
"""Provision a database connection: one encrypted record, one ordinary entry.
@@ -10721,8 +10752,13 @@ async def launch_kit(kit_id: str, request: Request, body_in: KitLaunchBody | Non
# Someone who typed a connection string and pressed Launch means "connect this", whether
# or not the Harness already existed — which is also how you reconnect after a password
# change. Without one the existing connection is left alone.
- if db_in:
+ if decl:
+ # The tool comes from the kit definition, so a harness launched before this existed —
+ # or one whose connection never landed — gets it on the next press of Launch.
existing = await _mcp_migrate(org, hid0, existing) or existing
+ await _hosted_db_entry(hid0, existing, decl)
+ existing = await _vertex_get(hid0) or existing
+ if db_in:
await _hosted_db_attach(org, hid0, existing, decl, checked, db_in.sample_rows)
existing = await _vertex_get(hid0) or existing
if media_decl:
@@ -10769,6 +10805,9 @@ async def launch_kit(kit_id: str, request: Request, body_in: KitLaunchBody | Non
"custom": "1", "created_at": now, "updated_at": now, "deleted": "0"}
await _vg_upsert("Harness", hid, props)
v = {"id": hid, **props}
+ if decl:
+ await _hosted_db_entry(hid, v, decl)
+ v = await _vertex_get(hid) or v
if db_in:
await _hosted_db_attach(org, hid, v, decl, checked, db_in.sample_rows)
v = await _vertex_get(hid) or v
diff --git a/gateway/tests/test_database_mcp.py b/gateway/tests/test_database_mcp.py
index 49fa9645..81a45765 100644
--- a/gateway/tests/test_database_mcp.py
+++ b/gateway/tests/test_database_mcp.py
@@ -940,6 +940,36 @@ def test_a_kit_that_declares_a_database_will_not_launch_without_one(api, kit):
assert next(k for k in api.get("/v1/kits").json()["kits"] if k["id"] == kit)["launched"] is False
+def test_the_database_tool_exists_because_the_kit_declares_it(api, kit):
+ """The tool belongs to the KIT DEFINITION, not to the credential.
+
+ A dashboard harness whose connection never landed used to carry only the base harness's
+ built-in tools and no database tool at all, which reads as "this kit cannot query a database"
+ rather than "this kit is not finished being set up". The entry is now provisioned at launch
+ the way the media kit's is.
+ """
+ hid = _launch(api, kit, "postgres", PG_DSN).json()["harnessId"]
+ ids = [e["id"] for e in api.get(f"/v1/harnesses/{hid}").json()["mcpServers"]]
+ assert ENTRY_ID in ids, "the kit declares a database, so the tool must be listed"
+
+
+def test_relaunching_restores_a_harness_that_lost_its_database_tool(api, kit):
+ """Pressing Launch again is the documented way to reconnect, so it is also the repair.
+
+ A harness created before the entry was provisioned at launch has no database tool and no way
+ to get one: the kit card offers Open rather than Launch, and the tool list has no database to
+ add. Relaunching has to be able to put it back.
+ """
+ hid = _launch(api, kit, "postgres", PG_DSN).json()["harnessId"]
+ asyncio.run(app._mcp_write(hid, [])) # the shape of an older harness
+ assert api.get(f"/v1/harnesses/{hid}").json()["mcpServers"] == []
+
+ again = api.post(f"/v1/kits/{kit}/launch", json={})
+ assert again.status_code == 200 and again.json()["created"] is False
+ ids = [e["id"] for e in api.get(f"/v1/harnesses/{hid}").json()["mcpServers"]]
+ assert ENTRY_ID in ids, "a second Launch must restore the tool"
+
+
def test_a_kit_that_reads_no_database_declares_none(api, monkeypatch):
monkeypatch.setattr(app, "_kits", lambda: {"slides": {"id": "slides", "title": "Slides",
"app": {"route": "/kits/slides"},