Skip to content

fix(cli): support duckdb_external_access opt-in in recce mcp-server#1464

Merged
kentwelcome merged 3 commits into
mainfrom
feature/drc-3890-recce-mcp-server-ignores-duckdb_external_access-opt-in
Jul 15, 2026
Merged

fix(cli): support duckdb_external_access opt-in in recce mcp-server#1464
kentwelcome merged 3 commits into
mainfrom
feature/drc-3890-recce-mcp-server-ignores-duckdb_external_access-opt-in

Conversation

@wcchang1115

@wcchang1115 wcchang1115 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

PR checklist

  • Ensure you have added or ran the appropriate tests for your PR.
  • DCO signed

What type of PR is this?

fix

What this PR does / why we need it:

recce mcp-server always ran DuckDB with enable_external_access=false and offered no way to turn it on, unlike recce server. On a local dbt/duckdb project whose sources use external_location: read_csv(...) and whose staging models are views, any row_count_diff / profile_diff touching a VIEW model failed with Permission Error: Scanning CSV files is disabled through configuration. recce/exceptions.py tells users to set duckdb_external_access: true in recce.yml, but mcp-server ignored that key, so the hint was misleading.

This makes mcp-server resolve the setting identically to server: the --duckdb-external-access flag, OR the duckdb_external_access key in recce.yml. Default stays blocked (opt-in only).

Which issue(s) this PR fixes:

Fixes DRC-3890

Special notes for your reviewer:

  • Default stays False (blocked) by design: recce mcp-server --sse is HTTP-exposed, so this is a security boundary. Production (recce-cloud-infra's recce_instance_launcher) runs it with no opt-in, so prod behavior is unchanged; enabling it there is a separate infra decision.
  • The --duckdb-external-access option block and merge line are duplicated verbatim from server for exact parity; factoring into a shared list would also touch server, out of scope here.

Does this PR introduce a user-facing change?:

Yes. recce mcp-server now accepts --duckdb-external-access and honors duckdb_external_access: true in recce.yml, matching recce server. Default is unchanged (external access blocked).

wcchang1115 and others added 2 commits July 14, 2026 16:48
recce mcp-server always ran DuckDB with enable_external_access=false and
offered no way to opt in, unlike recce server. On a local dbt/duckdb
project whose sources use external_location read_csv(...) and whose
staging models are views, any row_count_diff/profile_diff touching a
VIEW failed with "Scanning CSV files is disabled through configuration".
exceptions.py points users at duckdb_external_access: true in recce.yml,
but mcp-server ignored that key.

Resolve the setting in mcp_server identically to server: add the
--duckdb-external-access flag and merge it with the recce.yml key
(flag OR config). Default stays False, so safe-by-default behavior and
security parity with recce server are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Wei-Chun, Chang <wcchang@infuseai.io>
…C-3890)

The three mcp-server resolution tests patch recce.mcp_server.run_mcp_server,
which requires the optional mcp extra. The Test Python Versions CI job
installs recce without that extra, so recce.mcp_server is not importable and
patch() fails at setup with "module 'recce' has no attribute 'mcp_server'".

Guard those three with skipif(find_spec("mcp") is None). The three --help
tests need no mcp and keep running in that job. Verified both ways: mcp
present -> 6 pass; mcp absent (simulated) -> 3 pass, 3 skip.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Wei-Chun, Chang <wcchang@infuseai.io>
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
recce/cli.py 68.93% <100.00%> (+0.04%) ⬆️
tests/cli/test_duckdb_external_access_flag.py 100.00% <100.00%> (ø)

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wcchang1115 wcchang1115 marked this pull request as ready for review July 14, 2026 09:16
@wcchang1115 wcchang1115 self-assigned this Jul 14, 2026
@wcchang1115 wcchang1115 requested a review from kentwelcome July 14, 2026 09:16
@wcchang1115 wcchang1115 changed the title fix(cli): honor duckdb_external_access opt-in in recce mcp-server fix(cli): support duckdb_external_access opt-in in recce mcp-server Jul 14, 2026

@kentwelcome kentwelcome left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@kentwelcome kentwelcome merged commit 225d9fd into main Jul 15, 2026
22 checks passed
@kentwelcome kentwelcome deleted the feature/drc-3890-recce-mcp-server-ignores-duckdb_external_access-opt-in branch July 15, 2026 00:25
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