live_dangerously
Switch between safe and unsafe modes for Supabase database or API operations. Enable unsafe mode to perform write operations or schema changes, then revert to safe mode for security.
Instructions
Toggle unsafe mode for either Management API or Database operations.
WHAT THIS TOOL DOES: This tool switches between safe (default) and unsafe operation modes for either the Management API or Database operations.
SAFETY MODES EXPLAINED:
Database Safety Modes:
SAFE mode (default): Only low-risk operations like SELECT queries are allowed
UNSAFE mode: Higher-risk operations including INSERT, UPDATE, DELETE, and schema changes are permitted
API Safety Modes:
SAFE mode (default): Only low-risk operations that don't modify state are allowed
UNSAFE mode: Higher-risk state-changing operations are permitted (except those explicitly blocked for safety)
OPERATION RISK LEVELS: The system categorizes operations by risk level:
LOW: Safe read operations with minimal impact
MEDIUM: Write operations that modify data but don't change structure
HIGH: Operations that modify database structure or important system settings
EXTREME: Destructive operations that could cause data loss or service disruption
WHEN TO USE THIS TOOL:
Use this tool BEFORE attempting write operations or schema changes
Enable unsafe mode only when you need to perform data modifications
Always return to safe mode after completing write operations
USAGE GUIDELINES:
Start in safe mode by default for exploration and analysis
Switch to unsafe mode only when you need to make changes
Be specific about which service you're enabling unsafe mode for
Consider the risks before enabling unsafe mode, especially for database operations
For database operations requiring schema changes, you'll need to enable unsafe mode first
Parameters:
service: Which service to toggle ("api" or "database")
enable_unsafe_mode: True to enable unsafe mode, False for safe mode (default: False)
Examples:
Enable database unsafe mode: live_dangerously(service="database", enable_unsafe_mode=True)
Return to safe mode after operations: live_dangerously(service="database", enable_unsafe_mode=False)
Enable API unsafe mode: live_dangerously(service="api", enable_unsafe_mode=True)
Note: This tool affects ALL subsequent operations for the specified service until changed again.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| enable_unsafe_mode | No | ||
| service | Yes |
Implementation Reference
- supabase_mcp/tools/registry.py:136-152 (handler)MCP tool registration and handler function for 'live_dangerously'. This is the entrypoint decorated with @mcp.tool that delegates to the feature manager.@mcp.tool(description=tool_manager.get_description(ToolName.LIVE_DANGEROUSLY)) # type: ignore async def live_dangerously( service: Literal["api", "database"], enable_unsafe_mode: bool = False ) -> dict[str, Any]: """ Toggle between safe and unsafe operation modes for API or Database services. This function controls the safety level for operations, allowing you to: - Enable write operations for the database (INSERT, UPDATE, DELETE, schema changes) - Enable state-changing operations for the Management API """ return await feature_manager.execute_tool( ToolName.LIVE_DANGEROUSLY, services_container=services_container, service=service, enable_unsafe_mode=enable_unsafe_mode, )
- Core handler implementing the logic of 'live_dangerously': toggles safety mode (SAFE/UNSAFE) for 'api' or 'database' services using the safety_manager.async def live_dangerously( self, container: "ServicesContainer", service: Literal["api", "database"], enable_unsafe_mode: bool = False ) -> dict[str, Any]: """ Toggle between safe and unsafe operation modes for API or Database services. This function controls the safety level for operations, allowing you to: - Enable write operations for the database (INSERT, UPDATE, DELETE, schema changes) - Enable state-changing operations for the Management API """ safety_manager = container.safety_manager if service == "api": # Set the safety mode in the safety manager new_mode = SafetyMode.UNSAFE if enable_unsafe_mode else SafetyMode.SAFE safety_manager.set_safety_mode(ClientType.API, new_mode) # Return the actual mode that was set return {"service": "api", "mode": safety_manager.get_safety_mode(ClientType.API)} elif service == "database": # Set the safety mode in the safety manager new_mode = SafetyMode.UNSAFE if enable_unsafe_mode else SafetyMode.SAFE safety_manager.set_safety_mode(ClientType.DATABASE, new_mode) # Return the actual mode that was set return {"service": "database", "mode": safety_manager.get_safety_mode(ClientType.DATABASE)}
- supabase_mcp/tools/manager.py:22-22 (registration)Enum definition ToolName.LIVE_DANGEROUSLY registering the tool name used throughout the codebase.LIVE_DANGEROUSLY = "live_dangerously"
- Input schema defined by function parameters: service (api|database), enable_unsafe_mode (bool). Output: dict.async def live_dangerously( service: Literal["api", "database"], enable_unsafe_mode: bool = False ) -> dict[str, Any]: """ Toggle between safe and unsafe operation modes for API or Database services. This function controls the safety level for operations, allowing you to: - Enable write operations for the database (INSERT, UPDATE, DELETE, schema changes) - Enable state-changing operations for the Management API """ return await feature_manager.execute_tool( ToolName.LIVE_DANGEROUSLY, services_container=services_container, service=service, enable_unsafe_mode=enable_unsafe_mode, )