Repository navigation
Home
MCPSearch (MCP Search Engine) is a Swift-native Model Context Protocol server that gives local AI clients reliable public-web search and page fetching over stdio.
| Repository | Pummelchen/MCPSearch |
| Language | Swift 6.4, strict concurrency (language mode 6) |
| Transport | MCP over stdio (default) and Streamable HTTP (opt-in) |
| SDK | modelcontextprotocol/swift-sdk 0.12.1 |
| Search adapters | 9 search adapters; Jina is used only for page extraction, never search |
| Answer synthesis | Optional, grounded in fetched results (deepseek-flash) |
| Tests | 627 (7 skipped by default: the 6 opt-in live tests, which need SEARCH_LIVE_TESTS and a usable key, and the nesting guard's real-page run, which needs MARKUP_DEPTH_CORPUS) |
| License | MIT |
| Page | What it covers |
|---|---|
| Installation | Requirements, building, wiring into an MCP client |
| Compatibility | OpenAI, Anthropic, Open Responses, and the schema rules they impose |
| Self-Hosting | The SearXNG cluster: deployment, measured behaviour, and its limits |
| Monitor | The live mcps-mon terminal dashboard |
| Tools Reference | Every tool, argument, response field and error |
| Architecture | Layering, request lifecycle, rank fusion |
| Providers | The adapters and the API quirks they depend on |
| Configuration | Every environment variable and its default |
| Reliability | Timeouts, retries, circuit breakers, caching, failover |
| Security | The SSRF boundary, secrets handling, outbound behaviour |
| Testing | Test suite layout, hermeticity, CI |
| Troubleshooting | Symptom → cause → fix |
| Project Tracker | Open work only, numbered, and what each entry needs |
-
API-first, but nothing is switched off. Supported JSON APIs and self-hosted SearXNG
come first in preference order. HTML scrapers are rate limited, because their markup is not
a contract, but they are enabled by default along with everything else: a provider that
cannot serve a query fails over, so having one on costs a request and never a result. They
are not down-weighted during fusion:
scraperWeightis 1.0 by deliberate design. - One vendor outage never fails a search. Failures fail over; only a total failure is returned as an error.
- Rank fusion, never score comparison. A Tavily score of 0.87 and an Exa score of 0.87 do not mean the same thing.
- Grounded, never generated. The optional answer layer may cite only documents the search actually fetched, and abstains when they do not answer the question.
- stdout is protocol-only. Every diagnostic goes to stderr, asserted by a test.
- No credential is logged or persisted.
| Tool | Purpose |
|---|---|
web_search |
Search the public web; ranked, deduplicated, source-attributed results |
web_open |
Fetch one public URL and return readable text |
web_answer |
Search, then answer only from those results, with citations |
web_search_status |
Per-provider configuration and health for operators |
web_answer is opt-in (DEEPSEEK_API_KEY) and is not a search provider: the answering
model has no web access, so it can only ever cite documents the search already fetched.
Without the key, and when results do not answer the question, it says so rather than
filling the gap.
| Mode | Providers consulted | Budget |
|---|---|---|
fast |
1, lowest latency | 12 s |
balanced (default) |
up to 2 independent, fused | 15 s |
thorough |
up to 3, fused, plus aggregator coverage if thin | 20 s |
Download a binary (Apple silicon, M1 and later) from the latest release, or build from source:
swift build -c releaseGive the server at least one provider — every credential is optional, and with none it still starts and says what is missing:
export TAVILY_API_KEY=tvly-... # or BRAVE_SEARCH_API_KEY, or SEARXNG_BASE_URLPoint your MCP client at the SwiftWebSearchMCP executable:
{
"mcpServers": {
"web-search": {
"command": "/absolute/path/to/SwiftWebSearchMCP",
"env": { "TAVILY_API_KEY": "tvly-..." }
}
}
}That is the whole setup — stdout carries protocol framing only, diagnostics go to stderr. See Installation for the prebuilt-binary route, more client examples and the HTTP transport, and CHANGELOG.md for what changed in this version.
You do not call these tools yourself — your client's model does, when a question needs the web. This is what that looks like, so the shapes are recognisable when you see them.
A search. Ask your client "what's new in Swift concurrency?" and it calls:
{"name":"web_search","arguments":{"query":"what's new in Swift concurrency","mode":"balanced"}}Back come ranked results — URL, title, snippet, and which engine produced each one, so a
single-source answer is visible as such rather than looking like a consensus. mode trades latency for
breadth: fast, balanced or thorough.
Opening a page when a snippet is not enough. The model can read the page instead:
{"name":"web_open","arguments":{"url":"https://www.swift.org/"}}You get the page's readable text: scripts, styles, navigation and footers removed, <main> and
<article> preferred. The body is capped during transfer rather than after it, and any URL that is not
public http/https is refused before a connection is made.
A grounded answer rather than a list, when the question wants an explanation:
{"name":"web_answer","arguments":{"query":"why did Unix lose the top 500 list","mode":"balanced"}}web_answer searches first, then answers only from what it found, citing the sources it used. It
abstains instead of inventing an explanation the results do not contain. It needs
DEEPSEEK_API_KEY — without one the tool reports that it is not configured rather than answering from
nowhere.
Checking what is working, when a search comes back thin:
{"name":"web_search_status","arguments":{}}Every provider is reported as ready, not_configured, disabled or circuit_open, which is how
"no results" is told apart from "no provider". Nothing has to be configured for the server to start;
it says what is missing.
Every argument, every response field and the error taxonomy are in Tools Reference.
v1.3.0 is the current release:
prebuilt arm64 binaries for Apple silicon (M1 and later, macOS 13 or newer) covering both
executables, with SHA256SUMS beside them. CHANGELOG.md
records what changed in each version.
What the source on main is checked against: 627 tests, a 0-warning build under
-warnings-as-errors on Swift 6.4 / Xcode 27, an 80 % coverage floor on Sources/, and a gate
set of swift-format, SwiftLint, ruff, pyright, shellcheck, semgrep, a full-history
gitleaks scan and osv-scanner. The suite grows between releases, so that count describes main
rather than the binary v1.3.0 shipped. v1.3.0 is a security release: it carries the address check
and the corrected nesting-guard model, neither of which v1.2.0 had.
The limitations that remain are deliberate and documented — each is explained on the page where you meet it, under Security, Testing or Compatibility, rather than collected into a list somewhere else. Open work is numbered on the Project Tracker. If something is broken, open an issue.