A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: skip mcp requirements if no tools are enabled (#5902)
Myles Scolnick9af27f98c9cb
diff --git a/marimo/_server/ai/tools.py b/marimo/_server/ai/tools.pyindex ad763808df..c18e074f6c 100644--- a/marimo/_server/ai/tools.py+++ b/marimo/_server/ai/tools.py@@ -6,6 +6,7 @@ from typing import TYPE_CHECKING, Any, Callable, Literal, Optionalfrom marimo import _loggersfrom marimo._config.config import CopilotMode+from marimo._config.manager import get_default_config_managerif TYPE_CHECKING:from mcp.types import ( # type: ignore[import-not-found]@@ -51,6 +52,14 @@ class ToolManager:self._backend_handlers: dict[str, Callable[[FunctionArgs], Any]] = {}self._validation_functions: dict[str, ValidationFunction] = {}+ # TODO: this may be stale if the config is updated after the tool manager is created+ self._config = get_default_config_manager(+ current_path=None+ ).get_config()+ self._enable_mcp_tools = self._config.get("experimental", {}).get(+ "mcp_tools", False+ )+# Don't register tools in __init__ to avoid circular imports# Tools will be registered when get_tool_manager() is first calledLOGGER.info(@@ -162,6 +171,9 @@ class ToolManager:def list_mcp_tools(self) -> list[Tool]:"""Get all MCP tools from the MCP client."""+ if not self._enable_mcp_tools:+ return []+try:from marimo._server.ai.mcp import get_mcp_client