Skip to content

Start onboarding through your AI assistant#800

Draft
joaodaher wants to merge 9 commits into
mainfrom
joaodaher/ai-onboarding/CC-3674-3675
Draft

Start onboarding through your AI assistant#800
joaodaher wants to merge 9 commits into
mainfrom
joaodaher/ai-onboarding/CC-3674-3675

Conversation

@joaodaher

@joaodaher joaodaher commented Jun 8, 2026

Copy link
Copy Markdown

What's this?

This is the foundation phase of AI-driven dbt platform onboarding. Instead of navigating a UI, users can now start a dbt platform onboarding session directly from their AI assistant (Claude Code, Cursor, etc.) by just saying something like "I need to set up my dbt project."

What's included

New package: `dbt_admin/onboarding/`

  • `client.py` — thin HTTP client for the onboarding API
  • `models.py` — Pydantic response models for all three tools
  • `tools.py` — tool definitions + context injection + registration

Three new MCP tools (part of the `admin_api` toolset):

  • `dbt_admin_onboarding_get` — fetches the current onboarding record; returns null if none has been started yet
  • `dbt_admin_onboarding_validate` — validates collected onboarding data without applying it; returns what is missing or invalid (calls `POST /onboarding/?dry_run=1`)
  • `dbt_admin_onboarding_apply` — submits onboarding data to the platform; idempotent, safe to call incrementally as each piece of data is gathered (calls `POST /onboarding/`)

What's not here yet

This is the first of several incremental phases. The backend resource creation (project, connection, repository, environments, job) is handled by the platform API in companion tickets.

How it works

An agent can:

  1. Call `get` to check if onboarding is already in progress
  2. Collect information from the user conversationally
  3. Call `validate` at any point to confirm what's still missing
  4. Call `apply` incrementally as each piece of data is gathered

Testing

For now, an agent tries to fully onboard the user, which is not yet supported. But it can definitely get the current onboarding state.

image

Adds the foundation for AI-driven dbt platform onboarding. An LLM agent
can now start or resume an onboarding session and check its progress —
all without touching any UI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 8, 2026 15:27
@joaodaher joaodaher requested review from a team, b-per, jairus-m and jasnonaz as code owners June 8, 2026 15:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces the foundation for AI-driven dbt platform onboarding by adding a new dbt_admin/onboarding/ package and exposing two new Admin API MCP tools to initialize and inspect an onboarding session from an AI assistant.

Changes:

  • Add onboarding session scaffolding (in-memory session store + phases), response models, and an HTTP client for GET /onboarding/state/.
  • Register two new MCP tools (dbt_admin_onboarding_init, dbt_admin_onboarding_state) under the admin_api toolset and wire them into server tool registration.
  • Add unit tests covering the session store and the new onboarding tools; update README/tool description mappings and changelog entry.

Reviewed changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/dbt_mcp/dbt_admin/onboarding/session.py Adds in-memory session state + phase enum for onboarding flow.
src/dbt_mcp/dbt_admin/onboarding/client.py Introduces a minimal HTTP client for onboarding state API calls.
src/dbt_mcp/dbt_admin/onboarding/decision_points.py Scaffolds decision-point representation and an (empty) registry function.
src/dbt_mcp/dbt_admin/onboarding/models.py Adds Pydantic models for init/state tool responses.
src/dbt_mcp/dbt_admin/onboarding/tools.py Implements and registers init/state tools with context binding.
src/dbt_mcp/mcp/server.py Registers onboarding tools in both single- and multi-project server setups.
src/dbt_mcp/tools/tool_names.py Adds tool name constants for onboarding tools.
src/dbt_mcp/tools/toolsets.py Maps onboarding tools into the ADMIN_API toolset.
src/dbt_mcp/tools/readme_mappings.py Adds README descriptions for onboarding tools.
src/dbt_mcp/prompts/admin_api/onboarding_init.md Adds prompt guidance for onboarding init tool behavior.
src/dbt_mcp/prompts/admin_api/onboarding_state.md Adds prompt guidance for onboarding state tool behavior.
tests/unit/dbt_admin/onboarding/test_session.py Adds unit tests for session store behavior and phase logic.
tests/unit/dbt_admin/onboarding/test_tools.py Adds unit tests for tool registration and tool behavior.
README.md Documents the new onboarding tools in the Admin API tool list.
.changes/unreleased/Enhancement or New Feature-20260608-120113.yaml Adds an unreleased changelog entry for onboarding scaffold/tools.
tests/unit/dbt_admin/onboarding/__init__.py Creates package init for onboarding unit tests.
src/dbt_mcp/dbt_admin/onboarding/__init__.py Creates package init for onboarding module.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/dbt_mcp/dbt_admin/onboarding/models.py Outdated
Comment thread src/dbt_mcp/dbt_admin/onboarding/tools.py Outdated
Comment thread src/dbt_mcp/dbt_admin/onboarding/session.py Outdated
- Use Field(default_factory=dict) for ServerOnboardingState.data to avoid shared mutable default
- Coalesce raw API data field with `or {}` to handle null payloads safely
- Make InMemorySessionStore.get_or_create async with asyncio.Lock to prevent race conditions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix API client: use /onboarding/ (GET + POST) instead of non-existent /state/ and /apply/ paths
- dbt_admin_onboarding_init now calls POST /onboarding/ to create-or-get the backend record
- dbt_admin_onboarding_state now always calls GET /onboarding/ (backend is source of truth)
- Remove DBT_PROJECT_IDS requirement for admin API tools — they operate at account level
- Simplify session.py: drop in-memory state machine now that backend owns state

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 8, 2026 15:59
Replace init/state with three purpose-built tools:
- dbt_admin_onboarding_get: GET /onboarding/ — check current status
- dbt_admin_onboarding_validate: POST /onboarding/validate/ — check data without applying
- dbt_admin_onboarding_apply: POST /onboarding/ — submit data incrementally (idempotent)

All three verified against the warm PR env. validate returns a clean error
until the backend implements the /validate/ endpoint.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 18 changed files in this pull request and generated 6 comments.

Comment thread src/dbt_mcp/dbt_admin/onboarding/client.py Outdated
Comment thread src/dbt_mcp/config/settings.py
Comment thread src/dbt_mcp/prompts/admin_api/onboarding_init.md Outdated
Comment thread src/dbt_mcp/prompts/admin_api/onboarding_state.md Outdated
Comment thread src/dbt_mcp/tools/readme_mappings.py Outdated
Comment thread README.md Outdated
The validate endpoint is not a separate path — it's the same POST
/onboarding/ with a dry_run=1 query param.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 8, 2026 16:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 18 changed files in this pull request and generated 8 comments.

Comment thread src/dbt_mcp/dbt_admin/onboarding/tools.py
Comment thread src/dbt_mcp/dbt_admin/onboarding/client.py Outdated
Comment thread src/dbt_mcp/dbt_admin/onboarding/client.py Outdated
Comment thread README.md Outdated
Comment thread .changes/unreleased/Enhancement or New Feature-20260608-120113.yaml Outdated
Comment thread src/dbt_mcp/prompts/admin_api/onboarding_init.md Outdated
Comment thread src/dbt_mcp/config/settings.py
Comment thread src/dbt_mcp/prompts/admin_api/onboarding_state.md Outdated
joaodaher and others added 2 commits June 8, 2026 13:12
- Move DBT_TOKEN and host prefix checks into the outer guard that covers
  admin API, so admin-API-only users still get token validation
- Delete stale onboarding_init.md and onboarding_state.md prompt files
- Add missing onboarding_get/validate/apply prompt files (were untracked)
- Fix apply client to coalesce null data response with `or {}`
- Regenerate README tool list

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Use e.response.json() instead of response.json() in validate error path
- Fix changelog body to reflect actual tool names (get/validate/apply)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 8, 2026 16:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 19 changed files in this pull request and generated 3 comments.

Comment thread src/dbt_mcp/dbt_admin/onboarding/client.py Outdated
Comment thread src/dbt_mcp/dbt_admin/onboarding/client.py Outdated
Comment thread src/dbt_mcp/tools/tool_names.py
- apply() raises AdminAPIError when API returns no data instead of
  silently returning {} (which would cause KeyError downstream)
- validate() docstring now accurately describes the raw API return shape

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

2 participants