Skip to content

feat: Set AIRBYTE_CLOUD_MCP_SAFE_MODE default to 1#845

Merged
Aaron ("AJ") Steers (aaronsteers) merged 5 commits into
mainfrom
devin/safe-mode-default-1
Oct 24, 2025
Merged

feat: Set AIRBYTE_CLOUD_MCP_SAFE_MODE default to 1#845
Aaron ("AJ") Steers (aaronsteers) merged 5 commits into
mainfrom
devin/safe-mode-default-1

Conversation

@aaronsteers

@aaronsteers Aaron ("AJ") Steers (aaronsteers) commented Oct 24, 2025

Copy link
Copy Markdown
Member

Devin Session: https://app.devin.ai/sessions/11bea17b89694183953ebc1b341d2940

Summary by CodeRabbit

  • Chores

    • Enabled Safe Mode by default, making cloud operations more restricted unless explicitly disabled.
  • Documentation

    • Consolidated and clarified guidance for Safe Mode and Read‑Only Mode, including defaults, behaviors, and recommended configuration for testing and local workflows.

- Changed default from 0 to 1 in _tool_utils.py
- Updated MCP documentation examples to show SAFE_MODE=1
- Updated documentation to reflect new defaults
- Safe mode now enabled by default to prevent accidental destructive operations

Co-Authored-By: AJ Steers <aj@airbyte.io>
@devin-ai-integration

Copy link
Copy Markdown
Contributor
Original prompt from AJ Steers
Received message in Slack channel #dev-coral-mcp:

@Devin - Update our example docs in the Connector Builder MCP to include env var defaults for the pyairbyte-mcp exzamples:
• `AIRBYTE_CLOUD_MCP_READ_ONLY=0`  - toggle to `1` to restrict to read only operations while still allowing `sync` actions.
• `AIRBYTE_CLOUD_MCP_SAFE_MODE=0`  - toggle to `1` to disallow potentially harmful updates or deletions. (Creations still okay.)
Thread URL: https://airbytehq-team.slack.com/archives/C065V6XFWNQ/p1761285435510759?thread_ts=1761285435.510759

@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions

Copy link
Copy Markdown

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

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/safe-mode-default-1' pyairbyte --help

# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@devin/safe-mode-default-1'

Helpful Resources

PR Slash Commands

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

  • /fix-pr - Fixes most formatting and linting issues
  • /poetry-lock - Updates poetry.lock file
  • /test-pr - Runs tests with the updated PyAirbyte

Community Support

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

📝 Edit this welcome message.

@coderabbitai

coderabbitai Bot commented Oct 24, 2025

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Flip default MCP safe-mode to enabled and update inline documentation: SAFE_MODE now defaults to "1" (enabled) unless explicitly set to "0"; READONLY_MODE remains default "0". Corresponding docs in the MCP package were rewritten to describe Safe Mode and Read-Only Mode behavior and env var usage.

Changes

Cohort / File(s) Summary
MCP package docs/config
airbyte/mcp/__init__.py
Rewrote documentation describing Airbyte Cloud MCP Server Safety; changed the example/default presentation so AIRBYTE_CLOUD_MCP_SAFE_MODE is shown as "1" (enabled) and clarified defaults/behavior for SAFE_MODE and READONLY_MODE.
MCP utility logic
airbyte/mcp/_tool_utils.py
Changed evaluation of AIRBYTE_CLOUD_MCP_SAFE_MODE to default to "1" and treat any value other than "0" as enabled (os.environ.get(..., "1").strip() != "0"); safe-mode enforcement logic usage unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "feat: Set AIRBYTE_CLOUD_MCP_SAFE_MODE default to 1" is directly related to the primary change in the changeset. The modifications in both airbyte/mcp/__init__.py and airbyte/mcp/_tool_utils.py confirm that the AIRBYTE_CLOUD_MCP_SAFE_MODE default is being changed to 1, where the logic switches from an opt-in model (requiring explicit "1" value) to an opt-out model (defaulting to "1" unless explicitly set to "0"). The title is concise, clear, and specific enough that a teammate scanning the commit history would understand the primary change without ambiguity or vague terminology.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch devin/safe-mode-default-1

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a04242a and db59e82.

📒 Files selected for processing (2)
  • airbyte/mcp/__init__.py (2 hunks)
  • airbyte/mcp/_tool_utils.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • airbyte/mcp/_tool_utils.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.10, Windows)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.11, Windows)
  • GitHub Check: Pytest (Fast)
  • GitHub Check: Pytest (No Creds)
🔇 Additional comments (2)
airbyte/mcp/__init__.py (2)

89-90: Example configuration looks good!

The explicit values for both environment variables align with the documented defaults and make the configuration clear and easy to modify. Nice work!


114-146: Implementation matches documentation—verification complete.

The code correctly implements the documented defaults:

  • SAFE_MODE: Defaults to "1" (enabled) via os.environ.get("AIRBYTE_CLOUD_MCP_SAFE_MODE", "1")
  • READONLY_MODE: Defaults to "" (disabled) via os.environ.get("AIRBYTE_CLOUD_MCP_READONLY_MODE", "")

Both match what the documentation states. The optional suggestion about being more explicit in the docs (e.g., "defaults to '1'") still stands—would that improve clarity for users, or does the current wording work well for your audience?


Comment @coderabbitai help to get the list of available commands and usage tips.

- Created new 'Environment Variables for Cloud Operations' L4 section
- Moved SAFE_MODE and READ_ONLY documentation from bullets to dedicated section
- Improved formatting and discoverability of safety configuration options

Co-Authored-By: AJ Steers <aj@airbyte.io>
@github-actions

Copy link
Copy Markdown

PyTest Results (Fast Tests Only, No Creds)

304 tests  ±0   304 ✅ ±0   6m 18s ⏱️ +30s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit a04242a. ± Comparison against base commit fed8d94.

- Fixed 'allowd' -> 'allowed'
- Fixed 'configuratioins' -> 'configurations'
- Fixed 'conssidered' -> 'considered'
- Added missing 'to' in 'to enable'
- Fixed line length issues for linting

Co-Authored-By: AJ Steers <aj@airbyte.io>
Comment thread airbyte/mcp/_tool_utils.py Outdated
@aaronsteers Aaron ("AJ") Steers (aaronsteers) merged commit b3c538b into main Oct 24, 2025
19 checks passed
@aaronsteers Aaron ("AJ") Steers (aaronsteers) deleted the devin/safe-mode-default-1 branch October 24, 2025 18:45
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