Description
Please read this first
- Have you read the docs? Agents SDK docs Yes
- Have you searched for related issues? Others may have had similar requests Yes
Describe the feature
What is the feature you're requesting?
I would like to request support for using HTTP as a transport for MCP servers in the Agents SDK, in addition to the current stdio-based approach. This would allow agents to communicate with MCP servers that expose an HTTP endpoint, making it easier to integrate with remote or cloud-hosted MCP services.
How would it work?
The feature would introduce a new class (e.g., MCPServerHttp
) that implements the same interface as the current stdio-based server, but sends each MCP request as an HTTP POST to a configurable endpoint. This class would handle serialization of JSON-RPC messages, manage request/response cycles, and allow for optional headers (e.g., for authentication).
Why is this useful?
- Enables integration with MCP servers running remotely or in serverless/cloud environments.
- Makes it easier to deploy and scale MCP servers independently of the Python process.
- Allows for more flexible networking and security configurations (e.g., HTTPS, authentication headers).
Additional context:
I have already implemented this feature in my own project and would like to contribute it upstream via a pull request. The implementation uses httpx
for async HTTP requests, is compatible with the existing agent/runner workflow, and handles errors gracefully. I am happy to adapt the code to fit the maintainers' preferences and add tests/documentation as needed.
Let me know if you'd like to see the implementation or have any questions!