Add comprehensive MCP integration using langchain-mcp-adapters to enable
pluggable external tools from MCP servers.
Features:
- MCP server configuration via mcp_config.json
- Automatic lazy initialization for seamless use in both FastAPI and LangGraph Studio
- Support for multiple MCP servers (filesystem, postgres, github, brave-search, etc.)
- Environment variable resolution in configuration
- Tool caching mechanism for optimal performance
- Complete documentation and setup guide
Implementation:
- Add src/mcp module with client, tools, and cache components
- Integrate MCP config loading in AppConfig
- Update tool system to include MCP tools automatically
- Add eager initialization in FastAPI lifespan handler
- Add lazy initialization fallback for LangGraph Studio
Dependencies:
- Add langchain-mcp-adapters>=0.1.0
Documentation:
- Add MCP_SETUP.md with comprehensive setup guide
- Update CLAUDE.md with MCP system architecture
- Update config.example.yaml with MCP configuration notes
- Update README.md with MCP setup instructions
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The proxy was creating a temporary httpx.AsyncClient within an async context manager.
When returning StreamingResponse for SSE endpoints, the client was being closed before
the streaming generator could use it, causing "client has been closed" errors.
This change introduces a shared httpx.AsyncClient that persists for the application
lifecycle, properly cleaned up during shutdown. This also improves performance by
reusing TCP connections across requests.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Remove .claude/settings.local.json from git tracking and add it to .gitignore to prevent future accidental commits of local settings.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Defer sandbox acquisition and thread directory creation until first use to improve performance and reduce resource usage.
Changes:
- Add lazy_init parameter to SandboxMiddleware (default: true)
- Add ensure_sandbox_initialized() helper for lazy sandbox acquisition
- Update all sandbox tools to use lazy initialization
- Add lazy_init parameter to ThreadDataMiddleware (default: true)
- Create thread directories on-demand in AioSandboxProvider
- LocalSandbox already creates directories on write (no changes needed)
Benefits:
- Saves 1-2s Docker container startup for conversations without tools
- Reduces unnecessary directory creation and file system operations
- Backward compatible with lazy_init=false option
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>