This document summarizes the fixes applied to resolve timeout issues and improve compatibility with Codex CLI and other MCP clients.
- 60-Second Timeout Errors: Heavy QSAR operations were timing out before completion
- 404 Error Handling: Poor error messages when chemical/endpoint data was unavailable
- MCP Content Type Issues: Non-standard JSON content type causing validation errors
Changes:
- Server-side heavy timeout: 120s → 300s (5 minutes)
- Codex CLI timeout configuration: Added 300-second timeout
- Improved connection/write timeouts for heavy operations
Files Modified:
o-qt-mcp-server/src/qsar/client.py../.codex/config.toml
Impact: All heavy operations (workflows, metabolism, reports) can now complete successfully within the 5-minute window.
Changes:
- Enhanced
analyze_chemical_hazardwith better 404 error messages - Added data availability tracking
- Included actionable suggestions when data is missing
Files Modified:
o-qt-mcp-server/src/tools/implementations/o_qt_qsar_tools.py
Impact: Users now receive clear guidance when data is unavailable, including:
- Why the data might be missing
- Alternative identifiers to try (CAS, SMILES, name)
- Next steps for troubleshooting
Changes:
- Standardized tool responses to use
textcontent type - JSON data is now serialized as formatted text
- Maintained backward compatibility
Files Modified:
o-qt-mcp-server/src/mcp/router.py
Impact:
- Resolves Zod validation errors in Codex CLI
- Ensures MCP specification compliance
- Works with all MCP clients (Codex, Gemini, Claude Desktop)
cd o-qt-mcp-server
lsof -ti:8000 | xargs kill -9 2>/dev/null
poetry run uvicorn src.api.server:app --host 0.0.0.0 --port 8000 --reloadAfter updating .codex/config.toml, restart Codex to pick up the new timeout configuration:
# Close and reopen Codex CLITry these previously failing operations in Codex CLI:
# Test 1: Metabolism Simulation
"Can you use oqt-mcp to generate metabolites for acetaminophen (SMILES: CC(=O)Nc1ccc(O)cc1) using the Liver simulator?"
# Test 2: Workflow Execution
"Can you use oqt-mcp to execute a workflow for benzene?"
# Test 3: QSAR Report Generation
"Can you use oqt-mcp to download a QSAR report for acetaminophen?"
# Test 4: Chemical Profiling
"Can you use oqt-mcp to run profiling for acetaminophen?"# Test with a chemical that may not have data
"Can you use oqt-mcp to analyze chemical hazard for 'test-chemical-123' for the endpoint 'Skin Sensitization'?"Expected: Clear error message with suggestions, not a generic 404 error.
# Quick verification
"Can you use oqt-mcp to search for acetaminophen?"
"Can you use oqt-mcp to list available profilers?"- No more timeout errors for operations taking 1-5 minutes
- Clear error messages when data is unavailable (404s)
- No Zod validation errors in Codex CLI
- All discovery tools continue to work normally
- Backward compatibility maintained with other MCP clients
-
5-Minute Maximum: Operations taking longer than 5 minutes will still timeout
- If this occurs, consider breaking the operation into smaller steps
- Or contact the QSAR Toolbox API team about performance
-
Data Availability: Some chemicals may not have data for all endpoints
- This is a data limitation, not a technical issue
- The improved error messages will guide users to alternatives
If issues occur, you can rollback the changes:
cd o-qt-mcp-server
git checkout HEAD -- src/qsar/client.pyEdit ../.codex/config.toml and remove the timeout line:
[mcp_servers.oqt-mcp]
url = "http://localhost:8000/mcp"
# Remove this line: timeout = 300000lsof -ti:8000 | xargs kill -9 2>/dev/null
poetry run uvicorn src.api.server:app --host 0.0.0.0 --port 8000 --reloadIf you encounter issues after applying these fixes:
- Check the server logs for detailed error messages
- Verify the MCP server is running on port 8000
- Confirm Codex CLI has been restarted after config changes
- Review the detailed documentation in
docs/MCP_CLIENT_COMPATIBILITY_FIX.md
- Monitor Performance: Track operation completion times
- Gather Feedback: Collect user feedback on error messages
- Optimize Further: If 5 minutes is still insufficient for some operations, consider:
- Implementing async job patterns
- Adding progress indicators
- Caching frequently-used results
- 2025-01-04: Initial timeout and compatibility fixes implemented
- Extended server timeout to 300s
- Added Codex CLI timeout configuration
- Improved error handling for 404 responses
- Standardized MCP content types