chore: carry toolset MCP hosting state in its own struct

Merged
DA
4d ago
+431-706

AIM-731 (1 of 3). Stacked on #8021.

Summary

  • Adds hostingstate.Hosting (enabled, public, session issuer) and hostingstate.Address (preferred slug and custom domain). Hosting state now travels in these values instead of being written into the generated toolsetsrepo.Toolset fields.
    • hostedmcp.WithServerState is now ServerHosting and returns Hosting. LoadServerState returns Hosting too.
    • hostingstate.Apply* is now Derive, and the unused WithServerStates is gone.
  • Every reader now takes the hosting value next to the toolset instead of reading the toolset row's hosting fields: MCP serving (legacy slug path, wrapper path, gateway members), install pages and export, toolset views, plugin attach, user-session mint, attach-impact preview, toolset update/delete/external OAuth, external MCP migration, and telemetry.
  • Every read of the legacy /mcp/<slug> alias (toolsets.mcp_slug / custom_domain_id, owned by AIM-670) goes through hostingstate.LegacyAlias.
  • Behavior is unchanged. Toolsets without a canonical server still read their own columns through hostingstate.ToolsetColumns.

Motivation

AIM-671 drops the five toolset MCP hosting columns, and code must stop naming them first. The generated Toolset struct carried derived wrapper state under the column names, so every hosting read looked like a column read. Now each column read is in one of two places:

  • ToolsetColumns, the wrapperless fallback. The next PR removes it.
  • LegacyAlias, which AIM-670 retires. The last PR moves it into its own sqlc package and proves nothing else reads the columns.

šŸ¤– Generated with Claude Code