Skip to content

Implement FastMCP 2.0 upgrade and httpx monkey patch #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2025

Conversation

aarora79
Copy link
Contributor

Overview

This PR implements the changes required to upgrade to FastMCP 2.0 and resolve compatibility issues with the agent's httpx request handling.

Changes Made

🔧 Agent-side httpx Monkey Patch

  • New file: - Implements monkey patching for httpx compatibility
  • Updated: - Integrates the httpx patch for FastMCP 2.0 support

🚀 Server Updates

  • Updated: - Upgraded to use Pydantic FastMCP 2.0
  • Updated: - Updated dependencies for FastMCP 2.0
  • Updated: - FastMCP 2.0 compatibility updates
  • Updated: - Updated dependencies

🛠️ Build Script Improvements

  • Updated: - Added registry file copying and faiss index cleanup

Key Features

FastMCP 2.0 Integration: Leverages the new Context object for enhanced HTTP request access
Auth Header Support: Enables access to authentication headers and custom client information
Mount Point Compatibility: Maintains proper routing despite endpoint format differences
Registry File Management: Automated copying of registry files to deployment location
Faiss Index Cleanup: Automatic cleanup on startup for multi-tenancy preparation

Testing

This implementation has been tested with:

  • ✅ currenttime server compatibility
  • ✅ fininfo server with FastMCP 2.0
  • ✅ Agent communication with both servers
  • ✅ Mount point routing functionality

Related Issues

Fixes #59

Context

This change addresses the compatibility issue where FastMCP 2.0 returns while the Anthropic SDK returns . The httpx monkey patch ensures the agent can properly handle both formats while taking advantage of FastMCP 2.0's enhanced capabilities.

For additional context, see the related discussions in the MCP ecosystem:

- Add httpx_patch.py for agent compatibility with FastMCP 2.0
- Upgrade fininfo server to use FastMCP 2.0 with Context support
- Update build_and_run.sh to copy registry files and cleanup faiss index
- Maintain backward compatibility while enabling new Context features

Fixes #59
@aarora79 aarora79 self-assigned this Jun 19, 2025
@aarora79 aarora79 merged commit 7b22e3b into main Jun 19, 2025
0 of 8 checks passed
@aarora79 aarora79 deleted the feature/fastmcp-2.0-upgrade-issue-59 branch June 19, 2025 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to FastMCP 2.0 and implement httpx monkey patch for agent compatibility
1 participant