-
Notifications
You must be signed in to change notification settings - Fork 15
Description
π― Overview
This PR adds support for Google Gemini as an additional AI provider alongside the existing Anthropic Claude integration, giving users more choice in AI models for their MCP applications.
β¨ Features Added
- Multi-AI Provider Support
- Google Gemini Integration: Full support for Gemini 1.5 Pro model
- Provider Selection: Easy switching between Anthropic Claude and Google Gemini
- Backward Compatibility: Existing Claude-only setups continue to work unchanged
- New Files
- python-example/client/client_multi_ai.py - Enhanced client with dual AI provider support
- python-example/client/run_client.py - Launcher script for easy provider selection
- python-example/client/SETUP_SUMMARY.md - Comprehensive setup documentation
- CHANGELOG.md - Project changelog
- Enhanced Configuration
- Updated .env file to support both API keys
- Added google-generativeai dependency to pyproject.toml
- Command-line arguments for provider selection
**π Usage Examples**Quick Start
## Run with Claude (default)
- python run_client.py --provider anthropic
## Run with Gemini - python run_client.py --provider gemini
## List available providers - python run_client.py --list-providers
- Environment Configuration
## Choose your AI provider by setting one of these API keys - ANTHROPIC_API_KEY=your_anthropic_api_key
- GEMINI_API_KEY=your_gemini_api_key
## Set the provider you want to use: 'anthropic' or 'gemini' - AI_PROVIDER=anthropic
π§ Technical _Implementation
_Gemini Tool Calling
- Uses prompt engineering approach for tool invocation (Gemini doesn't natively support MCP tools)_
- JSON-based tool calling interface
- Comprehensive error handling and fallbacks
- Architecture
- Maintains existing client architecture
- Polymorphic AI provider interface
- Clean separation of concerns between providers
- Compatibility
- Python 3.11+ (reduced from original 3.12+ requirement)
- All existing functionality preserved
- No breaking changes to existing APIs
π§ͺ Testing
Weather Queries Tested
β
"What's the weather like in New York City?"
β
"Are there any weather alerts in California?"
β
"Tell me the forecast for Boston tomorrow."
Provider Switching
β
Dynamic provider selection via command line
β
Environment variable configuration
β
Proper error handling for missing API keys
π Documentation Updates
Updated README.md with dual provider instructions
Added comprehensive setup documentation
Created changelog for tracking changes
Enhanced .gitignore for better project hygiene
π― Benefits
User Choice: Developers can choose their preferred AI provider
Cost Optimization: Switch between providers based on pricing/features
Redundancy: Fallback options if one provider has issues
Innovation: Easy to add more providers in the future
π Code Review Notes
All new code follows existing patterns and conventions
Comprehensive error handling and logging
Type hints and documentation maintained
No impact on existing functionality
_
***This enhancement makes the MCP Streamable HTTP example more versatile and demonstrates how MCP can work with multiple AI providers, not just Anthropic Claude.
_