Skip to content

fix(mcp): gate update_cloud_connection_unsafe behind insiders mode - #1418

Open
Aaron ("AJ") Steers (aaronsteers) wants to merge 1 commit into
devin/1792179543-rc-stream-sync-modefrom
devin/1792616792-unsafe-tool-insiders
Open

Aaron ("AJ") Steers (aaronsteers) wants to merge 1 commit into
devin/1792179543-rc-stream-sync-modefrom
devin/1792616792-unsafe-tool-insiders

Conversation

@aaronsteers

Copy link
Copy Markdown
Member

Overview

👉 TL;DR: update_cloud_connection_unsafe is now insiders-only, and nothing sends callers to it unless it's actually advertised to them.

Stacked on #1397 (targets its branch) to address this review comment.

Changes

  • update_cloud_connection_unsafe: @mcp_tool(destructive=True, insiders_only=True).
  • New private _is_unsafe_connection_update_tool_enabled(ctx) in mcp/cloud.py. It mirrors the filters that can hide the tool:
    _insiders_mode(ctx) is True
    and destructive_tools_allowed(ctx) is not False
    and pipeline_changes_allowed(ctx) is not False
    and not airbyte_readonly_mode_enabled()
  • Unsafe-change error guidance: "Retry with update_cloud_connection_unsafe" only when the helper returns True. Otherwise it says to make the change in the Airbyte UI and gives the connection URL. Before this, it only checked destructive_tools_allowed.
  • override_stream_configs description on update_cloud_connection no longer names the unsafe tool. Schema text is built at registration and can't vary per request. It now says: "Changes that would invalidate a stream's saved state are rejected, and the error says how to proceed."
  • _insiders_mode accepts FastMCP | Context.

Review Spotlight

Risks

  • The helper doesn't see a per-tool exclusion list that names only update_cloud_connection_unsafe. In that case the guidance still suggests the tool.

Test plan

  • tests/unit_tests/test_mcp_tool_filters.py::test_unsafe_connection_update_tool_enabled: insiders unset, on, and on with destructive tools off, pipeline changes off, or read-only on.
  • tests/unit_tests/test_mcp_cloud.py::test_unsafe_connection_update_visibility: server.app.list_tools() hides the unsafe tool with insiders off and shows it with insiders on.
  • tests/unit_tests/test_mcp_connection_schedules.py::test_unsafe_change_guidance_uses_unsafe_tool_enabled
  • Focused suites: 347 passed. Ruff and pyrefly are clean.

Link to Devin session: https://app.devin.ai/sessions/4d1ece6885c44c52a07034e025db11e6
Open in Devin Desktop: https://app.devin.ai/desktop/session/4d1ece6885c44c52a07034e025db11e6?variant=devin
Requested by: Aaron ("AJ") Steers (@aaronsteers)

@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@github-actions

Copy link
Copy Markdown

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

💡 Show Tips and Tricks

Testing This PyAirbyte Version

You can test this version of PyAirbyte using the following:

# Run PyAirbyte CLI from this branch:
uvx --from 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1792616792-unsafe-tool-insiders' pyairbyte --help

# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@devin/1792616792-unsafe-tool-insiders'

PR Slash Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /fix-pr - Fixes most formatting and linting issues
  • /uv-lock - Updates uv.lock file
  • /test-pr - Runs tests with the updated PyAirbyte
  • /prerelease - Builds and publishes a prerelease version to PyPI
  • /evals - Runs the Cloud MCP evals that use the MCP tools this PR changed (/evals full=true runs the full suite)
📚 Show Repo Guidance

Helpful Resources

Community Support

Questions? Join the #pyairbyte channel in our Slack workspace.

📝 Edit this welcome message.

@github-code-quality

github-code-quality Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Code coverage overview

Languages: Python

Python / code-coverage/pytest-no-creds

devin/1792179543-rc-... d9f652f devin/1792616792-uns... 939d8cb +/-
65% 80% +15%
View coverage of the 10 most impacted files.
File devin/1792179543-rc-... d9f652f devin/1792616792-uns... 939d8cb +/-
airbyte/_util/api_util.py 36% 67% +31%
airbyte/mcp/cloud.py 52% 85% +33%
airbyte/cloud/connectors.py 34% 79% +45%
airbyte/mcp/_datadog.py 0% 50% +50%
airbyte/mcp/_telemetry.py 0% 94% +94%
airbyte/cloud/c...lder/project.py 0% 94% +94%
airbyte/_direct...ctors/models.py 0% 95% +95%
airbyte/mcp/_sso_auth.py 0% 96% +96%
airbyte/cloud/models.py 0% 97% +97%
airbyte/mcp/int...nc_status_ui.py 0% 97% +97%

Python / code-coverage/pytest

devin/1792179543-rc-... d9f652f devin/1792616792-uns... 939d8cb +/-
71% 82% +11%
View coverage of the 10 most impacted files.
File devin/1792179543-rc-... d9f652f devin/1792616792-uns... 939d8cb +/-
airbyte/cloud/connectors.py 51% 82% +31%
airbyte/mcp/cloud.py 52% 85% +33%
airbyte/mcp/_datadog.py 0% 50% +50%
airbyte/mcp/_user_identity.py 0% 93% +93%
airbyte/mcp/_telemetry.py 0% 94% +94%
airbyte/cloud/c...lder/project.py 0% 94% +94%
airbyte/_direct...ctors/models.py 0% 95% +95%
airbyte/mcp/_sso_auth.py 0% 96% +96%
airbyte/cloud/models.py 0% 97% +97%
airbyte/mcp/int...nc_status_ui.py 0% 97% +97%

Python / code-coverage/pytest-unit

devin/1792179543-rc-... devin/1792616792-uns... 939d8cb +/-
— 77% —

Line coverage data for the devin/1792179543-rc-... branch is not yet available.

View coverage of the 10 most covered files.
File devin/1792179543-rc-... devin/1792616792-uns... 939d8cb +/-
airbyte/cloud/models.py — 97% —
airbyte/mcp/_sso_auth.py — 96% —
airbyte/_direct...ctors/models.py — 95% —
airbyte/cloud/client.py — 90% —
airbyte/exceptions.py — 90% —
airbyte/mcp/cloud.py — 85% —
airbyte/progress.py — 80% —
airbyte/cloud/connectors.py — 79% —
airbyte/shared/...ql_processor.py — 68% —
airbyte/_util/api_util.py — 67% —

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated October 21, 2026 21:25 UTC

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.

🟢 Approval recommended

The focused gating and guidance changes have targeted regression coverage and no identified blocking defects.

No open issues 🎉

What changed in this PR

Restricts the unsafe Cloud connection update tool introduced in #1397 to insiders mode and adjusts guidance to respect the relevant visibility policies.

Changes:

  • Marks update_cloud_connection_unsafe as insiders-only.
  • Checks insiders, destructive-tool, pipeline-change, and read-only policies before recommending the unsafe tool; otherwise directs callers to the Airbyte UI.
  • Adds regression coverage for tool registration, visibility, and error guidance.
File Description
tests/​unit_tests/​test_mcp_tool_utils.py Adds the unsafe tool to expected insiders-only registrations.
tests/​unit_tests/​test_mcp_tool_filters.py Tests the combined visibility-policy helper.
tests/​unit_tests/​test_mcp_connection_schedules.py Verifies policy-aware guidance and the UI fallback.
tests/​unit_tests/​test_mcp_cloud.py Tests advertised tool visibility with insiders mode on and off.
airbyte/​mcp/​cloud.py Gates the unsafe tool and updates guidance and parameter documentation.
airbyte/​mcp/​_tool_utils.py Allows insiders-policy checks to accept a server or request context.

Review effort: Balanced

@aaronsteers
Aaron ("AJ") Steers (aaronsteers) marked this pull request as ready for review October 21, 2026 22:21

@devin-ai-integration devin-ai-integration Bot 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

This branch has not been deployed

No deployments
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