python-sdk
python-sdk copied to clipboard
The official Python SDK for Model Context Protocol servers and clients
The `Prompt()` decorator in `server.py` is instantiating a Prompt object before adding it to the list of prompts. This is inconsistent with how the `Tool()` decorator works; it delegates tool...
Added a try block around the handling of `JSONRPCRequest` messages in the `_receive_loop` method, mirroring the error handling already present for `JSONRPCNotification`. This ensures that validation or processing errors for...
This contains fix for the issue: #686 As per the new authorization spec for MCP Servers as outlined here: https://modelcontextprotocol.io/specification/draft/basic/authorization, implementing the remote oauth support for the FastMCP Servers. -...
## Problem The `OAuthMetadata` validation in `src/mcp/shared/auth.py` was overly restrictive, rejecting valid OAuth 2.0 server configurations that advertise additional authentication methods beyond the minimum required set. This caused connection failures...
## Summary - fix the issue mentioned in #577 - add CompatTaskGroup helper that uses `asyncio.TaskGroup` when available - use CompatTaskGroup across client and server transports - update BaseSession to...
_rebase of https://github.com/modelcontextprotocol/python-sdk/pull/248 (copied below)_ --- closes https://github.com/modelcontextprotocol/python-sdk/issues/244 ## Motivation and Context According to the readme it should be possible to pass a `Context` to a resource (like it is...
Added a new pytest function, `test_remove_request_params`, in `tests/shared/test_sse.py` to cover the previously untested `remove_request_params` utility in the SSE client module. ## Motivation and Context The `remove_request_params` function in `src/mcp/client/sse.py` was...
This PR fixes #447 #642 **Mismatch URL** **Connection Error** ## Motivation and Context This PR solves the indefinite blocking issue of the client by handling the exception thrown by url...
Fixed the instructions, previous ones did not work. Tested on Mac :D.
This is a small PR to expose the additional_headers param on ws_connect through a new 'headers' argument in the websocket transport ## Motivation and Context This enables users to pass...