fix: MCP OAuth timeout regression - pin fastmcp <3 and add configurable timeout#2185
fix: MCP OAuth timeout regression - pin fastmcp <3 and add configurable timeout#2185jpshackelford wants to merge 3 commits intomainfrom
Conversation
…le timeout - Pin fastmcp dependency to <3 to prevent automatic upgrade to 3.x which has breaking changes for OAuth MCP servers - Add mcp_timeout field to Agent class (default 60s, up from 30s) - Support per-server timeout configuration in mcp_config - Update error message with actionable timeout configuration hints - Add tests for timeout configuration behavior Fixes #2184
…ult and server timeouts
API breakage checks (Griffe)Result: Passed |
|
@OpenHands Are you trying to both revert a fastmcp version and make the code work with that version more effectively at the same time? I think our intent was to correct issues that resulted from the fastmcp upgrade. Please see the linked issue and think carefully about the correct path forward. |
|
I'm on it! jpshackelford can track my progress at all-hands.dev |
Remove timeout configuration changes to focus the PR on the core fix. The root cause of the regression is that fastmcp was auto-upgraded from v2.14.5 to v3.0.2, which has breaking changes affecting OAuth MCP servers. Pinning fastmcp to <3 reverts to the working v2.x behavior. Timeout configuration improvements can be addressed in a separate PR. Co-authored-by: openhands <openhands@all-hands.dev>
SummaryBased on @jpshackelford's feedback, I simplified PR #2185 to focus on the core fix for the regression. What was done:
Why:The original PR was conflating two separate concerns:
Since pinning fastmcp to Changes pushed:The simplified fix has already been pushed to |
Summary
Fixes #2184 - OAuth MCP servers (e.g., Notion) timing out after upgrading from v1.11 to v1.12.
Root Cause
The
fastmcpdependency was specified as>=2.11.3with no upper bound. When users upgraded to v1.12, fastmcp was automatically upgraded from v2.14.5 to v3.0.2, which has breaking changes affecting OAuth MCP server connections.Changes
1. Pin fastmcp dependency (
pyproject.toml)2. Add configurable MCP timeout (
agent/base.py)mcp_timeoutfield on Agent classmcp_timeoutand any per-server timeouts inmcp_config3. Respect per-server timeout configuration (
mcp/utils.py)_get_effective_timeout()to compute timeout from config4. Added tests
Testing
Migration
For users experiencing timeouts, either:
Disable the problematic server (workaround):
Set a higher timeout in your agent config:
Set per-server timeout in mcp_config:
{ "mcpServers": { "Notion": { "url": "https://mcp.notion.com/mcp", "auth": "oauth", "timeout": 120 } } }@jpshackelford can click here to continue refining the PR
Agent Server images for this PR
• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server
Variants & Base Images
eclipse-temurin:17-jdknikolaik/python-nodejs:python3.12-nodejs22golang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:04222e5-pythonRun
All tags pushed for this build
About Multi-Architecture Support
04222e5-python) is a multi-arch manifest supporting both amd64 and arm6404222e5-python-amd64) are also available if needed