We're excited to announce gpt4free v6.5.5 with our brand-new Model Context Protocol (MCP) server implementation! This release brings powerful tool integration capabilities to your AI workflows.
✨ Key Features
1. 🚀 MCP Server Implementation
- Integrated web search using DuckDuckGo
- Web scraping capabilities with content extraction
- Image generation via multiple AI providers
- Supports stdio and HTTP transports (with CORS support)
2. 🛠️ New Command Line Interface
# Start MCP server in stdio mode (default)
g4f mcp
# Start in HTTP mode (port 8765)
g4f mcp --http --port 87653. 🔌 Seamless AI Assistant Integration
// Sample Claude Desktop Configuration
{
"mcpServers": {
"gpt4free": {
"command": "python",
"args": ["-m", "g4f.mcp"]
}
}
}4. 🧰 Available Tools
| Tool | Description | Required Parameters |
|---|---|---|
web_search
| Web search with DuckDuckGo | query
|
web_scrape
| Web page content extraction | url
|
image_generation
| AI image creation | prompt
|
5. 📚 Comprehensive Documentation
- Added
/docs/mcp-usage-guide.md - Interactive demo scripts (
etc/examples/mcp_tools_demo.py) - Unit tests covering 100% of MCP functionality
🛠 Installation & Upgrade
# New installation
pip install g4f
# Upgrade existing installation
pip install g4f --upgrade🧩 Technical Enhancements
- Dependencies:
aiohttpfor async HTTP handlingbeautifulsoup4for web scrapingddgsfor search functionality
- GUI Integration:
- MCP server management interface
- Tool selection panel in chat UI
- HTTP Endpoints:
POST /mcp- JSON-RPC 2.0 endpointGET /health- Health check endpoint
🐛 Notable Fixes
- Improved JSON-RPC error handling (-32601 to -32603 codes)
- Fixed web scraping content truncation
- Enhanced image generation validation
- CLI argument parsing improvements
🌟 Sample Usage
Web Search Example:
from g4f.mcp import MCPServer, WebSearchTool
async def demo_search():
tool = WebSearchTool()
result = await tool.execute({"query": "Python tutorials", "max_results": 3})
print(json.dumps(result, indent=2))HTTP Mode Quickstart:
Start server:
g4f mcp --http --host 0.0.0.0 --port 3000
Test with curl:
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'📜 Full Changelog
- Added 15+ new MCP-related modules
- Implemented 98 file changes (+2,869 LOC)
- Created comprehensive test suite (87% coverage)
- Updated CLI with MCP commands
- Added CORS support for web integrations
- Enhanced documentation with usage examples
- Fixed various stability issues
🌈 Contributors
Special thanks to @hlohaus and the gpt4free team for their outstanding work on this release!
Upgrade now to unleash the full potential of AI tool integration with gpt4free's MCP server! 🚀
g4f v6.5.5
Download Options
Python Package:
- PyPI:
pip install g4f==v6.5.5
Executables:
- Windows x64:
g4f-windows-v6.5.5-x64.zip - Linux x64:
g4f-linux-v6.5.5-x64 - Linux ARM64:
g4f-linux-v6.5.5-arm64 - macOS x64:
g4f-macos-v6.5.5-x64 - macOS ARM64:
g4f-macos-v6.5.5-arm64
System Packages:
- WinGet:
winget install gpt4free
Docker:
docker pull hlohaus789/g4f:v6.5.5docker pull hlohaus789/g4f:v6.5.5-slim
💻 Having trouble with the .exe from this release?
👉 Check out the Windows launcher for GPT4Free instead:
🔗 https://github.com/gpt4free/g4f.exe 🚀