pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/modelcontextprotocol/servers/pull/4565

ts-5f61a10d0c5fd0c3.css" /> fix(fetch): port to mcp SDK v2 by jayzuccarelli · Pull Request #4565 · modelcontextprotocol/servers · GitHub
Skip to content

fix(fetch): port to mcp SDK v2 - #4565

Open
jayzuccarelli wants to merge 3 commits into
modelcontextprotocol:mainfrom
jayzuccarelli:fetch-mcp-v2
Open

fix(fetch): port to mcp SDK v2#4565
jayzuccarelli wants to merge 3 commits into
modelcontextprotocol:mainfrom
jayzuccarelli:fetch-mcp-v2

Conversation

@jayzuccarelli

Copy link
Copy Markdown

Fixes #4560

mcp 2.0.0 is more than the McpError -> MCPError rename: the low-level
Server decorator API is gone, replaced by constructor callbacks with new
handler signatures and result-object returns, and MCPError now takes
code/message directly instead of ErrorData. So the server can't be
fixed with an alias import - it needs a port.

This ports src/fetch to the v2 API:

  • handlers move to on_list_tools / on_call_tool / on_list_prompts /
    on_get_prompt, returning ListToolsResult / CallToolResult /
    ListPromptsResult / GetPromptResult
  • raise MCPError(code=..., message=...) at the existing raise sites,
    message text unchanged
  • mcp>=2,<3 in pyproject, uv.lock regenerated
  • tests updated for the exception rename

Tool/prompt descriptions, robots.txt handling and truncation behavior are
unchanged. #4563 caps mcp<2 as immediate triage; this is the follow-up
that moves fetch onto the new SDK, same shape as #4564 does for src/git.

Verified against mcp 2.0.0: uv run pytest (20 passed), uv run --frozen pyright (clean), and a live stdio session (initialize, tools/list,
tools/call, prompts/get, plus MCPError propagation on invalid params).

🤖 Generated with Claude Code

mcp 2.0.0 renamed McpError to MCPError and replaced the low-level
decorator API with constructor callbacks, so the server failed at import
with an unbounded mcp>=1.1.3 pin. Port the handlers to the v2 API
(on_list_tools/on_call_tool/on_list_prompts/on_get_prompt, result
objects, snake_case fields), raise MCPError directly instead of wrapping
ErrorData, pin mcp>=2,<3, and refresh uv.lock.

Fixes modelcontextprotocol#4560
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.

fetch: ImportError on startup with mcp SDK 2.0.0 (McpError renamed to MCPError)

1 participant

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy