Purpose
mcp-retrieval is a Model Context Protocol (MCP) server written in Go that exposes three read-only web retrieval tools to any MCP-compatible client (Claude Desktop, IDE agents, custom LLM applications): web search, image search, and web scraping to Markdown. Its goal is to enable models to retrieve web content and hand it to the model in clean Markdown form without relying on API keys.
Main Capabilities
- Web Search: Performs searches via DuckDuckGo Lite.
- Image Search: Performs image searches via Bing Images.
- Web Scraping: Fetches the raw HTML of a page, processes it through a readability extractor, and converts it to Markdown (including tables).
- No API Keys Required: None of the above sources require a search API key.
- Browser Impersonation: The adapter enables browser rotation, randomly selecting from about 11 real browser profiles on each request; each profile pairs a real TLS/JA3 fingerprint (via uTLS) with a matching User-Agent and client hint headers, including Chrome 133/131/120 (Windows/macOS/Linux), Edge 131, Firefox 120 (Windows/macOS), Safari 18.4 (macOS), and iOS 18.4 Safari.
- Proxy Rotation: When PROXY_HOST is configured, the adapter appends a unique session-<id> after the proxy username on each request; combined with session-based residential/rotating proxy providers, this enables a new egress IP per request.
- Response Handling: Transparently decompresses gzip, br, zstd, and deflate, and disables keep-alive to prevent connection pooling from pinning a single fingerprint/IP across multiple requests.
- Two Transports: stdio (default, suitable for desktop clients) and http (a long-running streaming HTTP server, suitable for remote/shared deployments); both expose exactly the same tool set.
- Read-Only Annotations: All three tools are annotated as read-only.
- Structured Output: Each tool returns structured JSON payloads matching its output schema; the SDK mirrors the same JSON into text content blocks for clients that do not read structuredContent.
Usage
Installation
- Container (no Go toolchain required): Use the container image.
- Prebuilt Binaries: Download the archive for your platform from the latest release, extract it, and place mcp-retrieval in your PATH.
- MCP Bundle: For clients that support installing .mcpb files, download mcp-retrieval_<version><os><arch>.mcpb from the latest release and open it with the client. This bundle carries the compiled binary and requires neither Docker nor Go. You must choose the file matching your operating system and CPU architecture, because one bundle contains only one native binary.
- Local Build: The Go module is located in the app/ directory; you can use the makefile at the repository root, or pass -C app to the toolchain.
Connecting an MCP Client (stdio)
Point the client at the built binary. In the example Claude Desktop configuration, the env block is optional; just "command" is sufficient.
Connecting an MCP Client (Container)
Run the image on stdio. Configuration is still passed via the env block, but Docker requires each variable to be named with -e on the command line for it to reach the process. You must use -i, otherwise the container has no stdin and the client will see the server exit immediately. Clients installed from the MCP Registry will construct this invocation themselves and prompt for the variables declared in server.json.
Running over HTTP
Set MCP_TRANSPORT=http, and the server will listen on MCP_PATH at SERVER_PORT (default http://localhost:8080/mcp)。
Configuration
All configuration is done through environment variables, and every value is validated before startup: a non-numeric or non-positive value causes a startup error. Relationships between limits are not checked at startup. Variables already present in the environment take precedence over the .env file, so the MCP client's env block always takes effect. Every field has a sensible default, and the server can run without any configuration (stdio transport). See .env.example for the full list of defaults. The version advertised to clients is not configurable; it is written into the binary at build time from the git tag.
Limits
Each value is checked individually (must be greater than zero), but the DEFAULT_, MIN_, and MAX_* triples are not cross-checked at startup. An inconsistent configuration does not prevent the server from starting; instead, it is reconciled on every request: when the caller omits the value or passes zero/a negative value, it falls back to the corresponding DEFAULT_; the result is then clamped within [MIN_, MAX_], so a DEFAULT_ greater than its MAX_* only yields MAX_; if MIN_ exceeds MAX_*, the maximum wins. The effective limits therefore always stay within the configured maximums, and a misconfiguration degrades to a working server rather than a startup failure. The cost is silent degradation: for example, mistyping MAX_RESULTS=2 as 20 produces no warning and simply returns a smaller response. These values are worth rechecking when results appear truncated.
Use Cases
- Provide web search, image search, and page scraping capabilities for LLM applications or agents without requiring an API key.
- Desktop clients (such as Claude Desktop) run locally over stdio.
- Remote or shared deployments run over HTTP transport.
- Scenarios that need to convert web content into Markdown for a model to process.
Limitations
- web_scrape only handles HTML: pages are processed by a readability extractor and require article markup, so text/plain responses produce no content and return status: "failed". Raw file hosting is a common case: raw.githubusercontent.com, github.com/.../raw/..., cdn.jsdelivr.net. You should scrape the rendered page rather than the raw file.
- web_search_images relevance is not guaranteed: for some queries, Bing ImagThe page returned by es is not a result set, but it will be parsed as one; the tool then returns irrelevant images with status: "success". Image results should be treated as best-effort and verified before being shown to the user.
- No JavaScript: Pages are fetched as-is, and client-rendered content is invisible to the extractor.
- Query and URL limits: The queries/urls list in each call is capped at max_queries (10) items. Queries must be ≤ 512 characters; URLs ≤ 2048 characters and restricted to http/https.
- Results and counts: Each call fans out over the input list, returning one entry per query/URL, each with its own status (success, failed, or timeout), so partial failures still return successful entries. count is the number of entries actually returned and may be lower than the requested max_results/max_images: duplicates within a single query's results are removed before the limit is applied, and upstream may also have fewer entries. A smaller count is a normal result, not an error. Deduplication is per query, not across queries, so the same link found by two queries in the same call will appear in both entries.
- Error handling: Request-level failures are returned as tool results with isError: true and a plain-text message, rather than a JSON-RPC error, so the model can read the message and correct the call itself. Per-item failures do not work this way; they remain in the payload as status: "failed"/"timeout". A call fails completely only when the input is rejected before any work begins, or when every entry in it fails. A timeout is never a call-level error: timed-out entries get status: "timeout", and even if all entries time out, the call still returns all entries with that status. The all-failed message is triggered only when no entry succeeds or times out.
Architecture
The project follows a clear layered structure. Dependencies point toward the domain layer, and each layer communicates with the next through interfaces. In the request flow of a tool call, both search and fetch fan out concurrently over the input list and aggregate per-item results, each result carrying its own status (success, failed, timeout). The call fails completely only when every entry in it fails with a non-timeout error.
All network work is delegated to retrieval-go, configured in app/internal/adapter/web.
Contributing
All Go code is located in app/, and can be used from the repository root with the makefile, or by passing -C app to the toolchain. Pull request guidelines are in CONTRIBUTING.md.
License
Released under the MIT License.