modelcontextprotocol / modelcontextprotocol/servers

Docker fetch not working

Open
#917 3 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
90.5k
Forks
11.7k
Avg merge
2d 2h
Merged PRs (30d)
5

Description

Describe the bug
I build and ran the Dockerfile in src/fetch and ran the container

docker run -it fetch-server

It's working fine but not able to initilize and response back!

To Reproduce
Steps to reproduce the behavior:

  1. docker run -it fetch-server
  2. Open the terminal/exec inside the container
  3. send the following to STDIN printf '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"1.0","capabilities":{},"clientInfo":{"name":"test","version":"1"}},"id":"1"}\n{"jsonrpc":"2.0","method":"tools/call","params":{"name":"fetch","arguments":{"url":"https://www.google.com","max_length":5000,"raw":true}},"id":"fetch_google"}\n' > /proc/1/fd/0
  4. View the logs
  5. It's not working and through the exception

Expected behavior
Should return the list of tools, and page fetch

Logs
If applicable, add logs to help explain your problem.
`{"jsonrpc":"2.0","id":"1","result":{"protocolVersion":"2024-11-05","capabilities":{"experimental":{},"prompts":{"listChanged":false},"tools":{"listChanged":false}},"serverInfo":{"name":"mcp-fetch","version":"1.2.0"}}}

  • Exception Group Traceback (most recent call last):
    | File "/app/.venv/lib/python3.11/site-packages/mcp/server/stdio.py", line 83, in stdio_server
    | yield read_stream, write_stream
    | File "/app/.venv/lib/python3.11/site-packages/mcp_server_fetch/server.py", line 285, in serve
    | await server.run(read_stream, write_stream, options, raise_exceptions=True)
    | File "/app/.venv/lib/python3.11/site-packages/mcp/server/lowlevel/server.py", line 424, in run
    | async with ServerSession(
    | File "/app/.venv/lib/python3.11/site-packages/mcp/shared/session.py", line 122, in aexit
    | return await self._task_group.aexit(exc_type, exc_val, exc_tb)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/app/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 763, in aexit
    | raise BaseExceptionGroup(
    | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    | File "/app/.venv/lib/python3.11/site-packages/mcp/shared/session.py", line 231, in _receive_loop
    | await self._received_request(responder)
    | File "/app/.venv/lib/python3.11/site-packages/mcp/server/session.py", line 143, in _received_request
    | raise RuntimeError(
    | RuntimeError: Received request before initialization was complete
    +------------------------------------`
    Additional context
    Add any other context about the problem here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Dockerfile in src/fetch and reproduce the reported docker run and STDIN commands. Inspect the initialization and request sequence around the logged exception; the issue is done when initialization completes and the fetch tool returns the requested page without an exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.