pub(crate) fn seed_starter_mcp_servers(
mstore: &Arc<Store>,
) -> Result<usize, StoreError>Expand description
Parse the embedded manifest and insert every entry as a global MCP server
via the validated mcp_server_upsert_unique_global path. Does NOT check
whether the catalog is already populated — the caller
(migrations::m0016_seed_starter_mcp_servers) owns run-once gating via
db_migrations tracking, not catalog contents. Exposed at pub(crate)
so the migration and tests can call it directly.
All-or-nothing: mcp_server_upsert_unique_global commits each insert in
its own transaction, so a mid-loop failure can’t be rolled back by the
database itself. If any insert fails, this compensates by deleting every
server already inserted in THIS call before returning the error —
otherwise a retry (the migration framework re-runs up() on the next
boot when a migration returns Err, since it’s never marked applied)
would hit the name-uniqueness rejection on the servers already stranded
from the failed attempt. Mirrors skill_seed::seed_starter_skills
exactly (reagent P2, PR #2141 round 1).