Skip to content

fix(fetch): add python-only readability fallback#4281

Open
he-yufeng wants to merge 1 commit into
modelcontextprotocol:mainfrom
he-yufeng:fix/fetch-readability-python-fallback
Open

fix(fetch): add python-only readability fallback#4281
he-yufeng wants to merge 1 commit into
modelcontextprotocol:mainfrom
he-yufeng:fix/fetch-readability-python-fallback

Conversation

@he-yufeng
Copy link
Copy Markdown

@he-yufeng he-yufeng commented Jun 4, 2026

Fixes #4199.

Summary

mcp-server-fetch always called readabilipy with use_readability=True. That path shells out through Node.js, but the server is installed and documented as a Python package. If Node is missing or the Node readability path is slow/misconfigured, HTML fetches can hang until the MCP client times out.

This patch keeps the stronger Node.js readability path when node is available, but avoids making it an undeclared hard runtime requirement:

  • auto-detect node before choosing the readability backend
  • fall back to readabilipy's Python-only path when Node is unavailable
  • add --no-readability-js for hosts that have Node installed but want the Python-only backend
  • document the behavior in the fetch README

Validation

  • python -m py_compile src/fetch/src/mcp_server_fetch/server.py src/fetch/tests/test_server.py
  • src/fetch/.venv/Scripts/python.exe -m pip install -e src/fetch
  • src/fetch/.venv/Scripts/python.exe -m pytest tests -q from src/fetch
  • src/fetch/.venv/Scripts/python.exe -m py_compile src/mcp_server_fetch/server.py tests/test_server.py from src/fetch
  • src/fetch/.venv/Scripts/python.exe -m ruff check src/mcp_server_fetch/server.py tests/test_server.py from src/fetch
  • git diff --check origin/main..HEAD

Signed-off-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com>
@he-yufeng he-yufeng force-pushed the fix/fetch-readability-python-fallback branch from 3c736c0 to 77e23fe Compare June 7, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcp-server-fetch hard-codes use_readability=True which requires Node.js (undeclared); fails silently when Node is unavailable or misconfigured

1 participant