-
Notifications
You must be signed in to change notification settings - Fork 878
Description
Is your feature request related to a problem? Please describe.
When using FastAPI-MCP to create tools for API endpoints that take longer than 5 seconds to respond, the requests timeout. Currently, the library uses httpx for making HTTP requests, which has a default timeout of 5 seconds, but there is no way to customize this timeout setting at the library user level.
This becomes problematic in production environments where some endpoints might perform complex operations that legitimately take longer than 5 seconds to complete.
Describe the solution you'd like
Add a timeout parameter to the relevant functions in the FastAPI-MCP library:
create_mcp_tools_from_openapicreate_http_toolmount_mcp_serveradd_mcp_server
This parameter would then be passed to the httpx client when making requests:
async with httpx.AsyncClient(timeout=timeout) as client:
# existing codeThis would allow users to customize timeout settings according to their specific API requirements.