Skip to content

CC-3677: account-create tool + owner-token stash#811

Draft
joaodaher wants to merge 1 commit into
joaodaher/ai-onboarding/CC-3674-3675from
cc3677-mcp-account-create
Draft

CC-3677: account-create tool + owner-token stash#811
joaodaher wants to merge 1 commit into
joaodaher/ai-onboarding/CC-3674-3675from
cc3677-mcp-account-create

Conversation

@joaodaher

Copy link
Copy Markdown

📚 Stacked on #800 (the onboarding package scaffold). Base auto-retargets to main once that lands.

What this does

Adds one low-level MCP tool, dbt_admin_account_create, so an AI assistant can bootstrap a brand-new dbt platform account for a user who doesn't have one yet.

The chicken-and-egg problem it solves: every other admin/onboarding tool needs an account id + token, but a brand-new user has neither. This tool calls the public dbt-cloud endpoint (POST /api/v3/accounts/, see dbt-labs/dbt-cloud#17982) with just the host — no token — and gets back { account_id, owner_token }.

The clever bit: token stash

After creating the account, it stashes the account_id + owner token into the shared credentials provider. So the moment the account exists, every following account-scoped tool (dbt_admin_onboarding_get/validate/apply, etc.) authenticates automatically — the user never has to paste a token.

Because account creation happens before any token exists, the client deliberately does not call get_credentials() (which would kick off the OAuth login flow); it reads the host straight off settings.

Notes

  • Gated under the admin_api toolset (so it only appears when admin tools are enabled).
  • Billable → marked non-read-only / non-idempotent; the prompt tells the agent to confirm and to skip it if the user already has an account.
  • Local e2e: point DBT_HOST at the dbt-cloud persistent-env PR environment, call this tool, then drive the onboarding tools against the freshly-created account.

🤖 Generated with Claude Code

Phase 0 (MCP side) of agent-driven onboarding. Adds the low-level
`dbt_admin_account_create(name, owner_email, created_via?)` tool that calls
the public dbt-cloud POST /api/v3/accounts/ endpoint via a token-less,
host-only client (account creation happens before any account or token
exists, so it must not trigger the OAuth login flow).

On success it stashes the returned account_id + owner token into the shared
CredentialsProvider, so the existing account-scoped admin/onboarding tools
authenticate automatically for the rest of the session.

Gated under the admin_api toolset; billable so destructive-confirm applies.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@joaodaher joaodaher force-pushed the cc3677-mcp-account-create branch from 1821966 to 0b8e8a8 Compare June 16, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant