From 4dd71d0d28ab41ffe300c25305e302a317a3fb2a Mon Sep 17 00:00:00 2001 From: jennyyyyyy7528-cell Date: Wed, 1 Oct 2025 19:45:25 -0400 Subject: [PATCH 1/8] Create smithery.yaml --- src/fetch/smithery.yaml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/fetch/smithery.yaml diff --git a/src/fetch/smithery.yaml b/src/fetch/smithery.yaml new file mode 100644 index 0000000000..45ddb56b8e --- /dev/null +++ b/src/fetch/smithery.yaml @@ -0,0 +1,4 @@ +name: fetch +type: server +runtime: docker +entrypoint: Dockerfile From af7e59860879d4dbecd9a12e4f448a55dc3922be Mon Sep 17 00:00:00 2001 From: jennyyyyyy7528-cell Date: Wed, 1 Oct 2025 19:56:11 -0400 Subject: [PATCH 2/8] Update smithery.yaml --- src/fetch/smithery.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/fetch/smithery.yaml b/src/fetch/smithery.yaml index 45ddb56b8e..99654ecce9 100644 --- a/src/fetch/smithery.yaml +++ b/src/fetch/smithery.yaml @@ -1,4 +1,7 @@ name: fetch type: server -runtime: docker -entrypoint: Dockerfile +runtime: python +startCommand: + - uv + - run + - mcp_server_fetch From 24e7abe3a3047ff03f833cc302f6208ef34e7d12 Mon Sep 17 00:00:00 2001 From: jennyyyyyy7528-cell Date: Wed, 1 Oct 2025 20:04:20 -0400 Subject: [PATCH 3/8] Update smithery.yaml From b357f5dd134b83048577273e42a915b625941631 Mon Sep 17 00:00:00 2001 From: jennyyyyyy7528-cell Date: Wed, 1 Oct 2025 20:05:35 -0400 Subject: [PATCH 4/8] Delete src/fetch/Dockerfile --- src/fetch/Dockerfile | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 src/fetch/Dockerfile diff --git a/src/fetch/Dockerfile b/src/fetch/Dockerfile deleted file mode 100644 index 7e8824c471..0000000000 --- a/src/fetch/Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -# Use a Python image with uv pre-installed -FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS uv - -# Install the project into `/app` -WORKDIR /app - -# Enable bytecode compilation -ENV UV_COMPILE_BYTECODE=1 - -# Copy from the cache instead of linking since it's a mounted volume -ENV UV_LINK_MODE=copy - -# Install the project's dependencies using the lockfile and settings -RUN --mount=type=cache,target=/root/.cache/uv \ - --mount=type=bind,source=uv.lock,target=uv.lock \ - --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ - uv sync --frozen --no-install-project --no-dev --no-editable - -# Then, add the rest of the project source code and install it -# Installing separately from its dependencies allows optimal layer caching -ADD . /app -RUN --mount=type=cache,target=/root/.cache/uv \ - uv sync --frozen --no-dev --no-editable - -FROM python:3.12-slim-bookworm - -WORKDIR /app - -COPY --from=uv /root/.local /root/.local -COPY --from=uv --chown=app:app /app/.venv /app/.venv - -# Place executables in the environment at the front of the path -ENV PATH="/app/.venv/bin:$PATH" - -# when running the container, add --db-path and a bind mount to the host's db file -ENTRYPOINT ["mcp-server-fetch"] From 5c5f6c713f853cb3ee11a51dab6183b2ed308c9d Mon Sep 17 00:00:00 2001 From: jennyyyyyy7528-cell Date: Wed, 1 Oct 2025 22:01:31 -0400 Subject: [PATCH 5/8] Update __main__.py --- src/fetch/src/mcp_server_fetch/__main__.py | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/fetch/src/mcp_server_fetch/__main__.py b/src/fetch/src/mcp_server_fetch/__main__.py index 318a21e789..973fd11b47 100644 --- a/src/fetch/src/mcp_server_fetch/__main__.py +++ b/src/fetch/src/mcp_server_fetch/__main__.py @@ -1,5 +1,34 @@ # __main__.py -from mcp_server_fetch import main +import os +import uvicorn +from fastapi.middleware.cors import CORSMiddleware +import mcp +from mcp_server_fetch import serve -main() +def main(): + # Default: stdio transport so Claude Desktop works out of the box + transport = os.getenv("MCP_TRANSPORT", "stdio") + + if transport in {"http", "streamable-http"}: + # Build the Streamable HTTP ASGI app that serves /mcp + app = mcp.streamable_http_app() + + # Add CORS so browser clients (like Smithery Playground) can call it + app.add_middleware( + CORSMiddleware, + allow_origins=["*"], # Allow all origins + allow_credentials=False, + allow_methods=["GET", "POST", "OPTIONS"], + allow_headers=["*"], + ) + + # Smithery injects PORT env var; fallback to 8000 + port = int(os.getenv("PORT", "8000")) + + # Run as HTTP service + uvicorn.run(app, host="0.0.0.0", port=port) + else: + # Local stdio (Claude Desktop, ChatGPT desktop, etc.) + import asyncio + asyncio.run(serve()) From 12206a2adc2e230cbd03a6f4b5d9d4e10a07f47f Mon Sep 17 00:00:00 2001 From: jennyyyyyy7528-cell Date: Wed, 1 Oct 2025 22:04:00 -0400 Subject: [PATCH 6/8] Update pyproject.toml --- src/fetch/pyproject.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/fetch/pyproject.toml b/src/fetch/pyproject.toml index bbee516a6b..8c3f255c83 100644 --- a/src/fetch/pyproject.toml +++ b/src/fetch/pyproject.toml @@ -15,6 +15,7 @@ classifiers = [ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.10", ] + dependencies = [ "httpx<0.28", "markdownify>=0.13.1", @@ -23,6 +24,10 @@ dependencies = [ "pydantic>=2.0.0", "readabilipy>=0.2.0", "requests>=2.32.3", + # 👇 Added for Smithery HTTP hosting + "uvicorn>=0.30.0", + "starlette>=0.48.0", + "fastapi>=0.111.0", ] [project.scripts] From 8605dce4ee3f069246b652ca6d8e638c7e59f076 Mon Sep 17 00:00:00 2001 From: jennyyyyyy7528-cell Date: Wed, 1 Oct 2025 22:14:42 -0400 Subject: [PATCH 7/8] Update smithery.yaml --- src/fetch/smithery.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/fetch/smithery.yaml b/src/fetch/smithery.yaml index 99654ecce9..61c3d8aa11 100644 --- a/src/fetch/smithery.yaml +++ b/src/fetch/smithery.yaml @@ -4,4 +4,6 @@ runtime: python startCommand: - uv - run + - python + - -m - mcp_server_fetch From 94cf2ab1f010cfd2726c0ab037895a76eb9b3e6b Mon Sep 17 00:00:00 2001 From: jennyyyyyy7528-cell Date: Wed, 1 Oct 2025 22:19:35 -0400 Subject: [PATCH 8/8] Update __main__.py --- src/fetch/src/mcp_server_fetch/__main__.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/fetch/src/mcp_server_fetch/__main__.py b/src/fetch/src/mcp_server_fetch/__main__.py index 973fd11b47..3852dc40cf 100644 --- a/src/fetch/src/mcp_server_fetch/__main__.py +++ b/src/fetch/src/mcp_server_fetch/__main__.py @@ -1,34 +1,23 @@ -# __main__.py - import os import uvicorn from fastapi.middleware.cors import CORSMiddleware import mcp -from mcp_server_fetch import serve +from mcp_server_fetch.server import serve +import asyncio def main(): - # Default: stdio transport so Claude Desktop works out of the box transport = os.getenv("MCP_TRANSPORT", "stdio") if transport in {"http", "streamable-http"}: - # Build the Streamable HTTP ASGI app that serves /mcp app = mcp.streamable_http_app() - - # Add CORS so browser clients (like Smithery Playground) can call it app.add_middleware( CORSMiddleware, - allow_origins=["*"], # Allow all origins + allow_origins=["*"], allow_credentials=False, - allow_methods=["GET", "POST", "OPTIONS"], + allow_methods=["*"], allow_headers=["*"], ) - - # Smithery injects PORT env var; fallback to 8000 port = int(os.getenv("PORT", "8000")) - - # Run as HTTP service uvicorn.run(app, host="0.0.0.0", port=port) else: - # Local stdio (Claude Desktop, ChatGPT desktop, etc.) - import asyncio asyncio.run(serve())