Repository navigation
Commit 08a8134
feat(fetch): build on MCPServer; an unknown tool is a -32602 error (modelcontextprotocol#5174)
The fetch server moves from the SDK's low-level Server, with its SDK v1
compatibility wrappers, to the high-level MCPServer, so this reference
server shows the API new servers should use:
- The `fetch` tool and prompt are decorated functions. Their type hints and
Field descriptions are the input schema and the prompt's arguments, and
MCPServer validates calls against them. The non-URL parameters are strict,
so a string is not coerced to the integer or boolean the schema declares.
- Anticipated failures (robots.txt refusal, connection failure, HTTP error
status, refused private address, unusable proxy) raise ToolError, which
MCPServer returns as an isError result prefixed "Error executing tool
fetch: ".
- An unknown tool is now a JSON-RPC -32602 protocol error, as both spec
revisions require. MCPServer still answers it with isError
(python-sdk#3659), so a middleware rejects the name first; it also keeps
-32602 for an unknown prompt and a prompt call without `url`, which
MCPServer would answer with -32603.
- subscriptions=False: the lists never change, so the 2026-07-28 era
advertises listChanged: false.
- The hand-rolled jsonschema validation and isError folding are gone, and so
is the direct jsonschema dependency.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: cliffhall <[email protected]>1 parent 5db044e commit 08a8134
7 files changed
Lines changed: 288 additions & 278 deletions
File tree
- src/mcp_server_fetch
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
34 | 42 | | |
35 | 43 | | |
36 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
0 commit comments