Conversation
Makes create_mcp_api_integration a first-class, config-only dbt model materialization instead of a run-operation, per Matts52#33: - New cortex_mcp_api_integration materialization (macros/materializations/cortex_mcp_api_integration.sql) plus its relation shim (macros/relations/cortex_mcp_api_integration/), mirroring the existing cortex_mcp_server pattern for account-level objects with no database/schema (tracked as a `view` node purely for graph/lineage; dbt never issues view DDL for it). - Defaults to `if_not_exists=true` (CREATE API INTEGRATION IF NOT EXISTS) rather than CREATE OR REPLACE, so a routine `dbt build` sweep (broad selector, state:modified.body, --full-refresh) can't silently rotate a live OAuth-authenticated integration as a side effect. Pass if_not_exists=false to opt into replace-in-place. - New cortex_mcp_api_integration_name(ref(...)) helper so a cortex_mcp_server model's api_integration config can depend on the integration via ref() instead of a bare name string that has to match something created out-of-band. - Extracted the DDL-building/validation logic out of the create_mcp_api_integration run-operation into a shared _mcp_api_integration_ddl macro, called by both the operation (unchanged behavior/defaults, kept for one-off admin bootstrapping outside dbt build) and the new materialization, so they can't drift on DDL shape or validation rules. - Fixed a latent bug in create_mcp_api_integration's dry_run branch: it only logged the DDL and never returned it, so any caller capturing the macro's output (e.g. the existing assert_create_mcp_api_integration_ddl integration test) always got an empty string. Found while validating this change against duckdb; unrelated to the materialization feature itself but trivial to fix in the same file. - Updated atlassian_mcp_server integration test fixture to wire in a new jira_mcp_api_integration model via ref(), and extended CI to compile both and run the DDL-builder assertion. - README updates: new cortex_mcp_api_integration section, config reference table, "How it works" and "Limitations & notes" entries. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…pecific jira_mcp_api_integration -> example_mcp_api_integration, with generic mcp.example.com placeholder values. This model exists purely to exercise structural compilation (config resolution, DDL construction) in CI, not to represent a real MCP endpoint, so it shouldn't imply an Atlassian/Jira-specific integration. atlassian_mcp_server still refs it via cortex_mcp_api_integration_name(ref(...)) to demonstrate the wiring. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Same rationale as the prior jira_mcp_api_integration -> example_mcp_api_ integration rename: this fixture exists to exercise structural compilation and DAG wiring for the cortex_mcp_server materialization, not to represent a real MCP endpoint, so it shouldn't hardcode Atlassian/Jira branding. Cascades the rename through agent_with_mcp_server.sql, integration_tests/models/schema.yml, integration_tests/README.md, and the CI compile selector. Left the Atlassian/Jira example untouched in the main README and in macros/schema.yml's macro-argument docs — those are illustrative real-world usage examples, not the test fixture itself. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #33.
Summary
cortex_mcp_api_integrationmaterialization(
macros/materializations/cortex_mcp_api_integration.sql) plus its relationshim (
macros/relations/cortex_mcp_api_integration/), mirroring theexisting
cortex_mcp_serverpattern for account-level Snowflake objectswith no database/schema — the node is tracked internally as a
viewpurelyfor graph/lineage; dbt never issues view DDL for it, same caveat as
cortex_mcp_serveritself already has.cortex_mcp_server.if_not_exists=true(CREATE API INTEGRATION IF NOT EXISTS) rather thanCREATE OR REPLACE, so a broad selector,state:modified.bodysweep, or--full-refreshcan't silently rotate a live OAuth-authenticatedintegration as a side effect. Pass
if_not_exists=falseexplicitly toopt into replace-in-place semantics.
cortex_mcp_api_integration_name(ref(...))so acortex_mcp_servermodel's
api_integrationconfig can depend on the integration viaref()— a real DAG edge — instead of a bare string that has to match an object
created out-of-band.
create_mcp_api_integrationrun-operation into a shared_mcp_api_integration_ddlmacro. Both the operation (kept, unchangedbehavior/defaults, for one-off admin bootstrapping outside
dbt build) andthe new materialization call it, so they can't drift on DDL shape or
validation rules.
DuckDB:
create_mcp_api_integration'sdry_runbranch only logged the DDLand never returned it, so any caller capturing the macro's rendered output
(including the existing
assert_create_mcp_api_integration_ddlintegrationtest) always captured an empty string. One-line fix (
{{ return(ddl) }})in the same file; unrelated to the materialization feature itself but
trivial and adjacent.
atlassian_mcp_serverintegration-test fixture to wire in a newjira_mcp_api_integrationmodel viaref(), and extends CI to compile bothand run the DDL-builder assertion (previously untested in CI).
cortex_mcp_api_integrationsection + config reference table,updated
cortex_mcp_serverbootstrap docs to present the materialization asthe recommended path (operation kept as a documented fallback), and
"How it works" / "Limitations & notes" entries.
Test plan
dbt deps && dbt compile --target duckdbon the full integration-testproject — no errors.
dbt run --target duckdb --select jira_mcp_api_integration— configresolution and DDL construction verified correct (fails only at
DuckDB's SQL parser on
CREATE API INTEGRATION, which is expected —that DDL is Snowflake-only, same as the pre-existing
cortex_mcp_serverand
cortex_skillstub materializations on non-Snowflake adapters).dbt run-operation assert_create_mcp_api_integration_ddl --target duckdb— passes after the
dry_runreturn-value fix (previously failed withan empty-string capture, unrelated to this PR's feature).
dbt buildinintegration_tests/— not run here(no Snowflake credentials in this environment); the DDL text and
config-resolution logic are otherwise fully exercised above.
🤖 Generated with Claude Code