Skip to content

feat: add cortex_mcp_server materialization and mcp_servers agent config (closes #18) - #23

Merged
Matts52 merged 1 commit into
mainfrom
github-issue-18-feasibility
Aug 17, 2026
Merged

feat: add cortex_mcp_server materialization and mcp_servers agent config (closes #18)#23
Matts52 merged 1 commit into
mainfrom
github-issue-18-feasibility

Conversation

@Matts52

@Matts52 Matts52 commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Summary

Implements both pieces requested in #18:

  • New cortex_mcp_server materialization — registers a Snowflake External MCP Server object as a first-class dbt model, following the same pattern as cortex_skill. Config-only model body; required configs are display_name, url, and api_integration.
  • mcp_servers string-list config on cortex_agent — appends a mcp_servers: block to the agent spec, mirroring the existing web_search_tool injection pattern. Omitting the config (or passing an empty list) leaves the generated DDL unchanged.
  • cortex_mcp_server_name(ref(...)) helper macro — returns the fully-qualified dotted name for a cortex_mcp_server model and registers the DAG dependency, mirroring cortex_skill_path(). Use this in the agent spec body for proper lineage when the MCP server is managed by dbt.

Usage

-- models/atlassian_mcp_server.sql
{{ config(
    materialized    = 'cortex_mcp_server',
    display_name    = 'Atlassian (Jira & Confluence)',
    url             = 'https://mcp.atlassian.com/v1/mcp',
    api_integration = 'jira_mcp_api_integration'
) }}
-- models/my_agent.sql — MCP server wired via ref() for DAG lineage
{{ config(materialized = 'cortex_agent', ...) }}
...
mcp_servers:
  - server_spec:
      name: "{{ dbt_cortex_agent.cortex_mcp_server_name(ref('atlassian_mcp_server')) }}"

Or via config for servers not managed by dbt:

{{ config(
    materialized = 'cortex_agent',
    mcp_servers  = ['db.schema.external_server']
) }}

Caveats

  • CREATE EXTERNAL MCP SERVER and DROP EXTERNAL MCP SERVER IF EXISTS syntax is taken directly from the Snowflake docs linked in Support MCP servers as agent tools (CREATE EXTERNAL MCP SERVER + mcp_servers config) #18 but is marked with !! SYNTAX NEEDS VERIFICATION comments (same convention used in the existing versioning macros) — please verify against a live Snowflake account before merging.
  • The DROP macro may need to drop the IF EXISTS clause if Snowflake doesn't support it for this object type.

Test plan

  • dbt compile --target duckdb passes for all 14 models (including atlassian_mcp_server and agent_with_mcp_server)
  • Verify CREATE EXTERNAL MCP SERVER DDL syntax against a live Snowflake account
  • dbt run --select atlassian_mcp_server agent_with_mcp_server on a live Snowflake connection
  • Confirm dbt ls --select atlassian_mcp_server+ shows the agent as downstream (DAG wiring)

🤖 Generated with Claude Code

…fig (closes #18)

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.

1 participant