python-sdk
python-sdk copied to clipboard
The official Python SDK for Model Context Protocol servers and clients
We should use init.py only for exporting symbols, as folks generally won't look there for implementation code.
e.g., we could have mcp_python as just the base definitions, `mcp_python[stdio]`, `mcp_python[sse]`, etc.
## Motivation and Context Fix an issue where exception handling code fails with `AttributeError: 'McpError' object has no attribute 'error'`. ``` | File ".../Development/mcp-python-sdk/src/mcp/client/session.py", line 114, in list_resources | return...
Updates sampling to support embedded resources in requests and responses. ## Motivation and Context Brings sampling to parity with tool calls in terms of supported message types. This PR is...
Adds support for a distinct `AudioContent` type as defined in the specification. This happens to share a structure with `ImageContent`, but should probably be distinguished for parity with the specification...
**Describe the bug** Running the tests when you first clone the repo doesn't pass all the tests **To Reproduce** Steps to reproduce the behavior: 1. Fork the repo 2. Clone...
I'm using MCP 1.9.1 and FastMCP 2.5.1. Even with the most minimal server, FastMCP always returns "Missing session ID", even though the header is sent correctly. **Minimal server code:** ```python...
**Describe the bug** Testing [QuickStart](https://modelcontextprotocol.io/) client & server examples hang and doesn't proceed. **To Reproduce** 1. Ensure that the `client.py` from [For Client Developers](https://modelcontextprotocol.io/quickstart/client) & `server.py` from [For Server Developers](https://modelcontextprotocol.io/quickstart/server)...
## Motivation and Context This implements the mitigations described [here](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#security-warning). To avoid breaking existing applications this doesn't enable any changes by-default, but enabling this feature is heavily encouraged for any...
## Motivation and Context This fixes an uncaught exception in the MCP server ## How Has This Been Tested? Via unit tests and locally. ## Breaking Changes None. ## Types...