[GH-ISSUE #62] MCP optional extra not installed in Docker image — MCP tool servers fail silently out of the box #25

Closed
opened 2026-10-18 14:02:08 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @root-hal9000 on GitHub (Jun 16, 2026).
Original GitHub issue: https://github.com/open-webui/computer/issues/62

DISCLAIMER: This potential bug was found using an LLM running inside a CPTR docker container. I was trying to troubleshoot why I could not connect to a github-mcp-server container to use as a tool, despite the networking being OK when I checked from within. I managed to get the agent to fix it for myself in the container. Since I was not fully clear on the details, I had the LLM write up the following bug report after some investigation

Description

When using the official Docker image, adding an MCP tool server via the UI and clicking Verify always fails silently with a generic error. The root cause is that the mcp package (declared as an optional extra in cptr's own metadata) is never installed in the Docker image.


Root Cause

The Dockerfile installs the wheel with:

RUN uv venv /home/cptr/.venv && \
    uv pip install --python /home/cptr/.venv/bin/python /tmp/*.whl && \
    rm /tmp/*.whl

But cptr's own METADATA declares mcp as an optional extra:

Provides-Extra: mcp
Requires-Dist: mcp>=1.8; extra == 'mcp'

So the plain .whl install never pulls in mcp. When the verify endpoint runs:

# cptr/routers/admin.py
if server_type == "mcp":
    from cptr.utils.mcp.client import MCPClient  # <-- this triggers...

...which in turn hits cptr/utils/mcp/client.py:

from mcp import ClientSession                     # ModuleNotFoundError
from mcp.client.streamable_http import streamablehttp_client

The exception is caught by the outer try/except in verify_tool_server and returned as a generic {"ok": false, "message": "..."} — giving the user no actionable information.


Steps to Reproduce

  1. Pull the latest Docker image: docker pull ghcr.io/open-webui/cptr:latest (confirmed on 0.5.2)
  2. Start the container
  3. Go to Settings → Tool Servers → Add an MCP server with a valid URL and Bearer token
  4. Click Verify
  5. Observe: fails with a generic error

Verified against: cptr 0.5.2, Docker image built ~June 16 2026


Fix

Two changes needed:

1. Dockerfile — install with the mcp extra:

# Before
uv pip install --python /home/cptr/.venv/bin/python /tmp/*.whl

# After
uv pip install --python /home/cptr/.venv/bin/python /tmp/*.whl "mcp>=1.8"

Or alternatively build/install as cptr[mcp] if the wheel supports it.

2. Better error message — if mcp is intentionally kept optional, the verify endpoint should catch ModuleNotFoundError specifically and return an actionable message:

except ModuleNotFoundError as e:
    return JSONResponse({"ok": False, "message": "mcp package not installed. Run: pip install 'mcp>=1.8'"}, 400)

Workaround (until fixed)

docker exec <container> uv pip install "mcp>=1.8" --python /home/cptr/.venv/bin/python

No restart required.


Additional context

The README.md also only documents pip install cptr with no mention of [mcp] being required for MCP tool server functionality, which compounds the discoverability problem.

Originally created by @root-hal9000 on GitHub (Jun 16, 2026). Original GitHub issue: https://github.com/open-webui/computer/issues/62 DISCLAIMER: This potential bug was found using an LLM running inside a CPTR docker container. I was trying to troubleshoot why I could not connect to a github-mcp-server container to use as a tool, despite the networking being OK when I checked from within. I managed to get the agent to fix it for myself in the container. Since I was not fully clear on the details, I had the LLM write up the following bug report after some investigation **Description** When using the official Docker image, adding an MCP tool server via the UI and clicking **Verify** always fails silently with a generic error. The root cause is that the `mcp` package (declared as an optional extra in `cptr`'s own metadata) is never installed in the Docker image. --- **Root Cause** The `Dockerfile` installs the wheel with: ```dockerfile RUN uv venv /home/cptr/.venv && \ uv pip install --python /home/cptr/.venv/bin/python /tmp/*.whl && \ rm /tmp/*.whl ``` But `cptr`'s own `METADATA` declares `mcp` as an **optional extra**: ``` Provides-Extra: mcp Requires-Dist: mcp>=1.8; extra == 'mcp' ``` So the plain `.whl` install never pulls in `mcp`. When the verify endpoint runs: ```python # cptr/routers/admin.py if server_type == "mcp": from cptr.utils.mcp.client import MCPClient # <-- this triggers... ``` ...which in turn hits `cptr/utils/mcp/client.py`: ```python from mcp import ClientSession # ModuleNotFoundError from mcp.client.streamable_http import streamablehttp_client ``` The exception is caught by the outer `try/except` in `verify_tool_server` and returned as a generic `{"ok": false, "message": "..."}` — giving the user no actionable information. --- **Steps to Reproduce** 1. Pull the latest Docker image: `docker pull ghcr.io/open-webui/cptr:latest` (confirmed on `0.5.2`) 2. Start the container 3. Go to Settings → Tool Servers → Add an MCP server with a valid URL and Bearer token 4. Click **Verify** 5. Observe: fails with a generic error **Verified against:** `cptr 0.5.2`, Docker image built ~June 16 2026 --- **Fix** Two changes needed: **1. Dockerfile** — install with the `mcp` extra: ```dockerfile # Before uv pip install --python /home/cptr/.venv/bin/python /tmp/*.whl # After uv pip install --python /home/cptr/.venv/bin/python /tmp/*.whl "mcp>=1.8" ``` Or alternatively build/install as `cptr[mcp]` if the wheel supports it. **2. Better error message** — if `mcp` is intentionally kept optional, the verify endpoint should catch `ModuleNotFoundError` specifically and return an actionable message: ```python except ModuleNotFoundError as e: return JSONResponse({"ok": False, "message": "mcp package not installed. Run: pip install 'mcp>=1.8'"}, 400) ``` --- **Workaround** (until fixed) ```bash docker exec <container> uv pip install "mcp>=1.8" --python /home/cptr/.venv/bin/python ``` No restart required. --- **Additional context** The `README.md` also only documents `pip install cptr` with no mention of `[mcp]` being required for MCP tool server functionality, which compounds the discoverability problem.
Author
Owner

@tjbck commented on GitHub (Jun 18, 2026):

Should be addressed!

<!-- gh-comment-id:4739768777 --> @tjbck commented on GitHub (Jun 18, 2026): Should be addressed!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/computer#25
No description provided.