Skip to content

Commit 70f55a3

Browse files
fix(mcp): MCP safe mode should use runtime checks instead of tool filtering (#846)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent b3c538b commit 70f55a3

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

airbyte/mcp/_tool_utils.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def check_guid_created_in_session(guid: str) -> None:
6363

6464

6565
def should_register_tool(annotations: dict[str, Any]) -> bool:
66-
"""Check if a tool should be registered based on safe mode settings.
66+
"""Check if a tool should be registered based on mode settings.
6767
6868
Args:
6969
annotations: Tool annotations dict containing domain, readOnlyHint, and destructiveHint
@@ -74,19 +74,11 @@ def should_register_tool(annotations: dict[str, Any]) -> bool:
7474
if annotations.get("domain") != "cloud":
7575
return True
7676

77-
if not AIRBYTE_CLOUD_MCP_READONLY_MODE and not AIRBYTE_CLOUD_MCP_SAFE_MODE:
78-
return True
79-
8077
if AIRBYTE_CLOUD_MCP_READONLY_MODE:
8178
is_readonly = annotations.get(READ_ONLY_HINT, False)
8279
if not is_readonly:
8380
return False
8481

85-
if AIRBYTE_CLOUD_MCP_SAFE_MODE:
86-
is_destructive = annotations.get(DESTRUCTIVE_HINT, True) # Default is True per FastMCP
87-
if is_destructive:
88-
return False
89-
9082
return True
9183

9284

airbyte/mcp/cloud_ops.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,8 +1015,9 @@ def register_cloud_ops_tools(app: FastMCP) -> None:
10151015
10161016
This is an internal function and should not be called directly.
10171017
1018-
Tools are filtered based on safe mode settings:
1018+
Tools are filtered based on mode settings:
10191019
- AIRBYTE_CLOUD_MCP_READONLY_MODE=1: Only read-only tools are registered
1020-
- AIRBYTE_CLOUD_MCP_SAFE_MODE=1: Destructive tools are not registered
1020+
- AIRBYTE_CLOUD_MCP_SAFE_MODE=1: All tools are registered, but destructive
1021+
operations are protected by runtime session checks
10211022
"""
10221023
register_tools(app, domain="cloud")

0 commit comments

Comments
 (0)