{"record":{"id":"fa5d52d5e99aef43","repo":"crewAIInc/crewAI","slug":"mcp-package-not-found-please-run-uv-add-crewai","errorCode":null,"errorMessage":"`mcp` package not found, please run `uv add crewai-tools[mcp]`","messagePattern":"`mcp` package not found, please run `uv add crewai-tools\\[mcp\\]`","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/adapters/mcp_adapter.py","lineNumber":173,"sourceCode":"        self._tool_names = (\n            [sanitize_tool_name(name) for name in tool_names] if tool_names else None\n        )\n\n        if not MCP_AVAILABLE:\n            import click\n\n            if click.confirm(\n                \"You are missing the 'mcp' package. Would you like to install it?\"\n            ):\n                import subprocess\n\n                try:\n                    subprocess.run([\"uv\", \"add\", \"mcp crewai-tools'[mcp]'\"], check=True)  # noqa: S607\n\n                except subprocess.CalledProcessError as e:\n                    raise ImportError(\"Failed to install mcp package\") from e\n            else:\n                raise ImportError(\n                    \"`mcp` package not found, please run `uv add crewai-tools[mcp]`\"\n                )\n\n        try:\n            self._serverparams = serverparams\n            self._adapter = MCPAdapt(\n                self._serverparams, CrewAIToolAdapter(), connect_timeout\n            )\n            self.start()\n\n        except Exception as e:\n            if self._adapter is not None:\n                try:\n                    self.stop()\n                except Exception as stop_e:\n                    logger.error(f\"Error during stop cleanup: {stop_e}\")\n            raise RuntimeError(f\"Failed to initialize MCP Adapter: {e}\") from e\n","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/adapters/mcp_adapter.py#L155-L191","documentation":"ImportError raised when mcp is not installed and the user declined the interactive install prompt. It is the explicit, expected 'missing dependency' signal for the MCP server adapter and tells you the exact command to fix it (uv add crewai-tools[mcp]).","triggerScenarios":"Constructing MCPServerAdapter(serverparams) with MCP_AVAILABLE=False and answering 'no' (or running non-interactively where confirm defaults to no) to the click.confirm prompt.","commonSituations":"CI/non-interactive runs where click.confirm aborts or auto-declines; team members who skipped the mcp extra; Docker images built without the extra.","solutions":["Install the extra: uv add 'crewai-tools[mcp]' (or pip install 'crewai-tools[mcp]').","Add crewai-tools[mcp] to requirements/pyproject so environments are provisioned correctly from the start.","For non-interactive deployments, always pre-install — never rely on the runtime prompt."],"exampleFix":"# before\nMCPServerAdapter(serverparams)  # prompt declined -> ImportError\n\n# after\n# uv add 'crewai-tools[mcp]'\nMCPServerAdapter(serverparams=...)","handlingStrategy":"validation","validationCode":"import importlib.util\n\nif importlib.util.find_spec(\"mcp\") is None:\n    raise RuntimeError(\"dependency missing: uv add 'crewai-tools[mcp]' or pip install 'crewai-tools[mcp]'\")","typeGuard":null,"tryCatchPattern":"try:\n    MCPServerAdapter(serverparams=...)\nexcept ImportError as e:\n    if \"mcp` package not found\" in str(e):\n        subprocess.check_call([\"uv\", \"add\", \"crewai-tools[mcp]\"])\n    raise","preventionTips":["Add the [mcp] extra to the environment manifest so construction never prompts.","Run services non-interactively with all dependencies preinstalled.","Catch ImportError around MCPServerAdapter construction and surface the install hint to operators."],"tags":["mcp","missing-dependency","install","interactive-prompt","crewai-tools"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}