Provides access to the 4get Meta Search engine API, enabling web search, image search, and news search capabilities with features like pagination, featured answers, related searches, and comprehensive result formatting
4get MCP Server
A MCP server that provides seamless access to the 4get Meta Search engine API for LLM clients via FastMCP.
✨ Features
🔍 Multi Search Functions: Web, image, and news search with comprehensive result formatting
⚡ Smart Caching: TTL-based response caching with configurable size limits
🔄 Retry Logic: Exponential backoff for rate-limited and network errors
🏗️ Production Ready: Connection pooling, comprehensive error handling, and validation
📊 Rich Responses: Featured answers, related searches, pagination support, and more
🧪 Well Tested: Extensive test suite including integration tests with real API, unit tests, and more
⚙️ Highly Configurable: 11+ environment variables for fine-tuning
📋 Requirements
Python 3.13+
uv for dependency management
Quick Start
⚙️ Configuration
The server is highly configurable via environment variables. All settings have sensible defaults for the public https://4get.ca
instance.
Core Settings
Variable | Description | Default |
| Base URL for the 4get instance |
|
| Optional pass token for rate-limited instances | unset |
| Override User-Agent header |
|
| Request timeout in seconds |
|
Caching & Performance
Variable | Description | Default |
| Cache lifetime in seconds |
|
| Maximum cached responses |
|
| Max concurrent connections |
|
| Max persistent connections |
|
Retry & Resilience
Variable | Description | Default |
| Maximum retry attempts |
|
| Base retry delay in seconds |
|
| Maximum retry delay in seconds |
|
🚀 Running the Server
Local Development
Production Deployment
MCP Server Integration
You can integrate the 4get MCP server with popular IDEs and AI assistants. Here are configuration examples:
Cursor IDE
Add this to your Cursor MCP configuration (~/.cursor/mcp.json
):
OpenAI Codex
Add this to your Codex MCP configuration (~/.codex/config.toml
):
Note: Replace /path/to/your/mcp-4get
with the actual path to your project directory.
🔧 MCP Tools
The server exposes three powerful search tools with comprehensive response formatting:
fourget_web_search
Response includes: web[]
, answer[]
, spelling
, related[]
, npt
fourget_image_search
Response includes: image[]
, npt
fourget_news_search
Response includes: news[]
, npt
📄 Pagination
All tools support pagination via the npt
(next page token):
🐍 Using the Async Client Directly
You can reuse the bundled async client outside MCP for direct API access:
This allows you to integrate 4get search capabilities directly into your Python applications without going through the MCP protocol.
🛡️ Error Handling & Resilience
Automatic Retry Logic
Rate Limiting (429): Exponential backoff with jitter
Network Errors: Connection failures and timeouts
Non-retryable: HTTP 404/500 errors fail immediately
Error Types
FourGetAuthError
: Rate limited or invalid authenticationFourGetAPIError
: API returned non-success statusFourGetTransportError
: Network or HTTP protocol errorsFourGetError
: Generic client errors
Configuration Validation
All settings are validated on startup with clear error messages for misconfigurations.
📊 Response Format
Based on the real 4get API, responses include rich metadata:
Development
This project uses several tools to streamline the development process:
mise
mise is used for managing project-level dependencies and environment variables. mise helps ensure consistent development environments across different machines.
To get started with mise:
Install mise by following the instructions on the official website.
Run
mise install
in the project root to set up the development environment.
Environment Variable Overrides: You can override any environment variable by creating a .mise.local.toml
file in the project root:
This file is automatically loaded by mise and allows you to customize your local development environment without modifying the shared configuration files.
UV
UV is used for dependency management and packaging. It provides a clean, version-controlled way to manage project dependencies.
To set up the project with UV:
Install UV using mise, or by following the instructions on the official website.
Run
uv sync
to install project dependencies.
MCP Server Integration for local development
Cursor IDE
Add this to your Cursor MCP configuration (~/.cursor/mcp.json
):
OpenAI Codex
Add this to your Codex MCP configuration (~/.codex/config.toml
):
Note: Replace /path/to/your/mcp-4get
with the actual path to your project directory.
🧪 Testing
Comprehensive test suite with unit, integration, and performance tests:
Test Categories
Unit Tests: Fast, deterministic tests using mock transports
Integration Tests: Real API tests with rate limiting and resilience validation
Cache Tests: TTL expiration, eviction policies, concurrent access
Retry Tests: Exponential backoff, error handling, timeout scenarios
Configuration Tests: Validation logic and environment variable parsing
The tests follow FastMCP testing guidelines with comprehensive fixtures and proper isolation.
🤝 Contributing
Setup: See Development and Quick Start sections
Tests: See Testing section
Linting:
uv run ruff check
Format:
uv run ruff format
📄 License
GPLv3 License - see LICENSE file for details.
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Enables web, image, and news search through the 4get Meta Search engine API. Features smart caching, retry logic, and comprehensive result formatting including featured answers and related searches.