diff --git a/Containerfile.c10s b/Containerfile.c10s index 534ffa19..81bbebde 100644 --- a/Containerfile.c10s +++ b/Containerfile.c10s @@ -69,12 +69,10 @@ RUN dnf -y install --allowerasing \ COPY openinference-reasoning.patch /tmp COPY openinference-streaming.patch /tmp -COPY beeai-framework-error-context.patch /tmp RUN pip3 install --no-cache-dir \ "litellm!=1.82.7,!=1.82.8,!=1.92.0" \ - beeai-framework[vertexai,mcp,duckduckgo]==0.1.82 \ - "mcp<1.29.0" \ + beeai-framework[vertexai,mcp,duckduckgo]==0.1.83 \ google-cloud-aiplatform \ openinference-instrumentation-beeai==0.1.21 \ arize-phoenix-otel \ @@ -86,7 +84,6 @@ RUN pip3 install --no-cache-dir \ unidiff \ sentry-sdk>=2.13.0 \ && cd /usr/local/lib/python3.12/site-packages \ - && patch -p2 -i /tmp/beeai-framework-error-context.patch \ && patch -p5 -i /tmp/openinference-reasoning.patch \ && patch -p5 -i /tmp/openinference-streaming.patch diff --git a/Containerfile.c9s b/Containerfile.c9s index 8d41b41a..78a7a372 100644 --- a/Containerfile.c9s +++ b/Containerfile.c9s @@ -69,15 +69,13 @@ RUN dnf -y install --allowerasing \ COPY openinference-reasoning.patch /tmp COPY openinference-streaming.patch /tmp -COPY beeai-framework-error-context.patch /tmp # Create Python 3.11 virtual environment and install Python packages RUN python3.11 -m venv --system-site-packages /opt/beeai-venv \ && /opt/beeai-venv/bin/pip install --upgrade pip \ && /opt/beeai-venv/bin/pip install --no-cache-dir \ "litellm!=1.82.7,!=1.82.8,!=1.92.0" \ - beeai-framework[vertexai,mcp,duckduckgo]==0.1.82 \ - "mcp<1.29.0" \ + beeai-framework[vertexai,mcp,duckduckgo]==0.1.83 \ google-cloud-aiplatform \ openinference-instrumentation-beeai==0.1.21 \ arize-phoenix-otel \ @@ -88,7 +86,6 @@ RUN python3.11 -m venv --system-site-packages /opt/beeai-venv \ unidiff \ sentry-sdk>=2.13.0 \ && cd /opt/beeai-venv/lib/python3.11/site-packages \ - && patch -p2 -i /tmp/beeai-framework-error-context.patch \ && patch -p5 -i /tmp/openinference-reasoning.patch \ && patch -p5 -i /tmp/openinference-streaming.patch diff --git a/Containerfile.c9s-tests b/Containerfile.c9s-tests index 93dc1fc7..0e688ff7 100644 --- a/Containerfile.c9s-tests +++ b/Containerfile.c9s-tests @@ -26,8 +26,7 @@ RUN python3.11 -m venv --system-site-packages /opt/beeai-venv \ && /opt/beeai-venv/bin/pip install --upgrade pip \ && /opt/beeai-venv/bin/pip install --no-cache-dir \ "litellm!=1.82.7,!=1.82.8" \ - beeai-framework[vertexai,mcp,duckduckgo]==0.1.82 \ - "mcp<1.29.0" \ + beeai-framework[vertexai,mcp,duckduckgo]==0.1.83 \ openinference-instrumentation-beeai==0.1.21 \ arize-phoenix-otel \ aiohttp>=3.12.15 \ diff --git a/Containerfile.mcp b/Containerfile.mcp index 5735122d..9ffd7f62 100644 --- a/Containerfile.mcp +++ b/Containerfile.mcp @@ -54,13 +54,10 @@ RUN pip install --no-cache-dir hatchling hatch-requirements-txt # need to build from source with their own build tools) RUN pip wheel --no-build-isolation --no-deps --wheel-dir /tmp/wheels /home/mcp/ymir/common/ /home/mcp/ymir/tools/ -COPY beeai-framework-error-context.patch /tmp - # Install the built wheels and all dependencies with standard pip (build isolation # enabled for third-party packages); litellm pinned separately to exclude compromised versions RUN pip install --no-cache-dir "litellm!=1.82.7,!=1.82.8" /tmp/wheels/*.whl && rm -rf /tmp/wheels \ - && cd /opt/beeai-venv/lib/python3.13/site-packages \ - && patch -p2 -i /tmp/beeai-framework-error-context.patch + && cd /opt/beeai-venv/lib/python3.13/site-packages # Verify no malicious litellm_init.pth was introduced by compromised litellm packages (e.g. 1.82.7, 1.82.8) RUN MALICIOUS=$(find /usr /opt -name "litellm_init.pth" 2>/dev/null); \ diff --git a/Containerfile.supervisor b/Containerfile.supervisor index a410bdf5..0f9e19b0 100644 --- a/Containerfile.supervisor +++ b/Containerfile.supervisor @@ -27,8 +27,7 @@ RUN dnf -y install --allowerasing \ python3-devel \ && pip3 install -v --no-cache-dir \ "litellm!=1.82.7,!=1.82.8" \ - beeai-framework[vertexai,mcp,duckduckgo]==0.1.82 \ - "mcp<1.29.0" \ + beeai-framework[vertexai,mcp,duckduckgo]==0.1.83 \ google-cloud-aiplatform \ openinference-instrumentation-beeai==0.1.21 \ arize-phoenix-otel \ diff --git a/Containerfile.tests b/Containerfile.tests index 06158025..003ac280 100644 --- a/Containerfile.tests +++ b/Containerfile.tests @@ -27,8 +27,7 @@ ENV PYTHONPATH=/src:$PYTHONPATH # Install BeeAI Framework and FastMCP RUN pip install --no-cache-dir \ "litellm!=1.82.7,!=1.82.8" \ - beeai-framework[vertexai,mcp,duckduckgo]==0.1.82 \ - "mcp<1.29.0" \ + beeai-framework[vertexai,mcp,duckduckgo]==0.1.83 \ fastmcp \ redis \ backoff \ diff --git a/beeai-framework-error-context.patch b/beeai-framework-error-context.patch deleted file mode 100644 index 4c9eb150..00000000 --- a/beeai-framework-error-context.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff --git a/python/beeai_framework/adapters/mcp/serve/server.py b/python/beeai_framework/adapters/mcp/serve/server.py -index b4a458be..93dc2025 100644 ---- a/python/beeai_framework/adapters/mcp/serve/server.py -+++ b/python/beeai_framework/adapters/mcp/serve/server.py -@@ -169,7 +169,16 @@ def _tool_factory( - ) -> MCPNativeTool: - async def run(**kwargs: Any) -> MCPCallToolResult: - cloned_tool = await tool.clone() -- output: ToolOutput = await cloned_tool.run(kwargs) -+ try: -+ output: ToolOutput = await cloned_tool.run(kwargs) -+ except Exception as e: -+ error_context = getattr(e, "context", None) or {} -+ meta = {"error_context": error_context} if error_context else None -+ return MCPCallToolResult( -+ content=[MCPTextContent(type="text", text=f"Error executing tool {tool.name}: {e}")], -+ isError=True, -+ _meta=meta, -+ ) - - return MCPCallToolResult( - content=[MCPTextContent(type="text", text=output.get_text_content())], -@@ -195,7 +204,9 @@ def _tool_factory( - # The FastMCP server allows either returning a structured output or a message. We want to support both. - # Based on https://github.com/modelcontextprotocol/python-sdk - # ... return a tuple of (content, structured_data) -- lambda result: (result.content, result.structuredContent), -+ # Error results are passed through as CallToolResult so the lowlevel server -+ # preserves isError and _meta (the tuple path reconstructs with isError=False). -+ lambda result: result if result.isError else (result.content, result.structuredContent), - ) - - return mcp_tool -diff --git a/python/beeai_framework/tools/mcp/mcp.py b/python/beeai_framework/tools/mcp/mcp.py -index 3fbd5c25..47e39d05 100644 ---- a/python/beeai_framework/tools/mcp/mcp.py -+++ b/python/beeai_framework/tools/mcp/mcp.py -@@ -98,7 +98,11 @@ class MCPTool(Tool[BaseModel, ToolRunOptions, JSONToolOutput]): - data_result = result.content - - if result.isError: -- raise ToolError(to_json(data_result, indent=4, sort_keys=False)) -+ error_context = (result.meta or {}).get("error_context") -+ raise ToolError( -+ to_json(data_result, indent=4, sort_keys=False), -+ context=error_context if isinstance(error_context, dict) else None, -+ ) - - return JSONToolOutput(data_result) - diff --git a/requirements-global.txt b/requirements-global.txt index 268c744a..51569b66 100644 --- a/requirements-global.txt +++ b/requirements-global.txt @@ -1,6 +1,5 @@ # Shared dependencies for ymir subpackages (common + tools) -beeai-framework[mcp]==0.1.82 -mcp<1.29.0 +beeai-framework[mcp]==0.1.83 jinja2>=3.1.0 pydantic>=2.0 aiofiles>=24.1.0 diff --git a/requirements.txt b/requirements.txt index 335dd593..26383efb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ litellm!=1.82.7,!=1.82.8,!=1.92.0 aiohttp>=3.12.15 arize-phoenix-otel>=0.13.0 beautifulsoup4>=4.13.4 -beeai-framework[duckduckgo]==0.1.82 +beeai-framework[duckduckgo]==0.1.83 copr>=1.129 fastmcp>=2.11.3 logdetective-mcp>=0.5.0