Skip to content

Installation

Pummelchen edited this page Sep 16, 2026 · 14 revisions

Installation & Setup

Home · Installation · Tools Reference · Architecture · Providers · Configuration · Reliability · Security · Self-Hosting · Monitor · Testing · Troubleshooting · Project Tracker


Recommended: the installer

git clone https://github.com/Pummelchen/MCPSearch && cd MCPSearch
deploy/install.sh                 # builds from source
deploy/install.sh --from-release  # or installs the published arm64 binary

The installer treats a working local SearXNG as mandatory, and that is deliberate. Every vendor provider is optional and metered; a local SearXNG is the only search that can be guaranteed present on the machine that runs the server, with no account and no key. An install with no provider is a server that starts and then answers every query with "no search provider is configured".

So the installer:

  1. probes for a working instance on 127.0.0.1:8888, and adopts it if it finds one;
  2. installs one if it does not — the digest-pinned container when a Docker daemon answers, otherwise natively under launchd (no container runtime needed, and nothing that requires a GUI session or an unlocked keychain);
  3. proves it answers a real query through the JSON API — not /healthz, because an instance without search.formats: [json] answers health checks with 200 and returns 403 to the API the server actually uses;
  4. installs the binary, writes config.env, and finally starts the server and requires a real web_search result.

Any failed gate exits non-zero, so a zero exit means the install searches.

Task Command
Install, no container runtime deploy/install.sh --method native
Install the published binary deploy/install.sh --from-release
Use an instance you already run deploy/install.sh --searxng-url http://host:8888
Re-check without changing anything deploy/install.sh --verify-only
See what it would do deploy/install.sh --dry-run

If a Docker install fails mentioning credentials or the keychain, that is Docker Desktop's credential store needing an unlocked login keychain, which a non-interactive session (ssh, CI) cannot provide — the image is public, so nothing needs credentials. Re-run with --method native.

--dry-run changes nothing: it writes no files, pulls no images and runs no checksum command.

Manual path: a prebuilt binary

Every release ships a macOS binary for Apple silicon (arm64, M1 and later) covering both executables, with checksums:

# Resolve the newest release rather than pinning a version here, so this snippet cannot go stale.
V=$(curl -sSL -o /dev/null -w '%{url_effective}' \
     https://github.com/Pummelchen/MCPSearch/releases/latest | sed 's#.*/tag/v##')
BASE=https://github.com/Pummelchen/MCPSearch/releases/latest/download
curl -LO "$BASE/mcps-$V-macos-arm64.tar.gz"
curl -LO "$BASE/SHA256SUMS"
shasum -a 256 -c SHA256SUMS --ignore-missing
tar -xzf "mcps-$V-macos-arm64.tar.gz"
cd "mcps-$V-macos-arm64"

The archive holds SwiftWebSearchMCP (the server), mcps-mon (the dashboard), LICENSE, THIRD-PARTY-NOTICES.md — the Apache-2.0 attribution the distributed binary is required to carry — and README-binaries.txt, which repeats the platform floor, the architecture and the notarisation position for anyone who unpacks it without reading this page. Nothing is installed system-wide: unpack it wherever you like and give your client the absolute path.

Apple silicon only. There is no Intel slice, and none is planned: the project is built and verified on the xcode-27 runner image, which is arm64-only. On an Intel Mac, build from source.

These binaries are not code-signed or notarised. A file fetched with curl carries no quarantine flag and runs directly. One downloaded through a browser does carry it, so macOS will either offer to allow it under System Settings → Privacy & Security, or strip the flag yourself: xattr -d com.apple.quarantine SwiftWebSearchMCP (and the same for mcps-mon).

Check the archive before trusting it:

lipo -archs SwiftWebSearchMCP        # arm64 — and nothing else
./SwiftWebSearchMCP --help

The archive extracts into its own directory rather than into your working directory, so the two binaries keep their LICENSE and THIRD-PARTY-NOTICES.md beside them.

Then continue at Client configuration. Everything below is for building from source instead.

Requirements

Requirement Version Notes
Swift 6.4 The manifest declares swift-tools-version: 6.4; older toolchains cannot parse it. CI runs on the xcode-27 image and fails if the compiler is below 6.4
macOS 13 or newer The MCP Swift SDK declares macOS 13 as its minimum
Xcode 27.x Provides the Swift 6.4 toolchain
Python 3 any Only for the optional end-to-end smoke test

There is no runtime dependency on Node or Python. The build fetches three direct dependencies, all pinned exactly so a fresh resolve cannot move the graph:

Build

git clone https://github.com/Pummelchen/MCPSearch.git
cd MCPSearch
swift build -c release

The executable is at:

swift build -c release --show-bin-path    # directory containing SwiftWebSearchMCP
Product Kind Purpose
SwiftWebSearchMCP executable The MCP stdio/HTTP server
mcps-mon executable The live provider and node dashboard — see Monitor
WebSearchCore library Search, fetch and reliability logic, with no MCP coupling

Credentials

All credentials are optional. The server starts with none and reports exactly what is missing, so there is no configuration step that can prevent it from booting.

Situation Provider path
Fastest useful start TAVILY_API_KEY
Broad independent index BRAVE_SEARCH_API_KEY
Index diversity MOJEEK_API_KEY
Semantic retrieval EXA_API_KEY
No vendor account at all SEARXNG_BASE_URL (self-hosted)

Secrets are read from the environment or a KEY=VALUE config file. They are never written to disk and never logged. See Configuration.

Client configuration

MCP clients launch the server as a subprocess and speak JSON-RPC over stdio. The shape is broadly the same everywhere:

{
  "mcpServers": {
    "web-search": {
      "command": "/absolute/path/to/SwiftWebSearchMCP",
      "env": {
        "TAVILY_API_KEY": "tvly-...",
        "BRAVE_SEARCH_API_KEY": "..."
      }
    }
  }
}

Notes that apply to every client:

  • Use an absolute path to the executable.
  • Environment variables are the preferred credential source for stdio deployments.
  • Leave stdout alone. Diagnostics go to stderr, and stdout carries protocol framing only; anything that intercepts or rewrites stdout will corrupt the session.
Client Where configuration goes
Claude Desktop claude_desktop_config.json under mcpServers
Claude Code claude mcp add or the project MCP config
Cursor / VS Code the client's MCP server settings
Codex its MCP server configuration

Transport: stdio or HTTP

stdio is the default and is what local clients use, because they launch the server as a subprocess and speak JSON-RPC over the pipes.

SwiftWebSearchMCP                      # stdio (default)
SwiftWebSearchMCP --transport http --port 8080

The HTTP transport exists for the remote MCP connectors used by OpenAI's Responses API and Anthropic's Messages API, neither of which can reach a stdio server. It serves the MCP endpoint at /mcp plus a plain GET /health liveness probe.

Flag Default Purpose
--transport <stdio|http> stdio Which transport to serve
--port <n> 8080 HTTP port
--host <addr> 127.0.0.1 HTTP bind address
--http-path <path> /mcp MCP endpoint path
--http-allowed-host <host> — Extra Host name this server answers to; repeatable
--help — Print usage

--port, --host, --http-path and --http-allowed-host imply the HTTP transport, so --transport http is not required alongside them. Combining any of them with an explicit --transport stdio is rejected as a conflict: stdio has no host, port or path, so one of the two requests is a mistake. The order of arguments therefore cannot decide which transport is served. Invalid arguments exit with status 2 and print usage rather than silently starting the wrong transport.

The HTTP transport binds loopback only unless you pass --host, logs a warning when the bind address is not loopback, and has no authentication. Put a TLS-terminating reverse proxy in front before exposing it; both vendors require an https:// connector URL. See Security.

The server answers only the Host names it knows, which is what stops a browser page on another site from reaching it: the bind address, the loopback names, and — for a wildcard bind — the machine's own interface addresses. When a proxy forwards a public name that is none of those, declare it with --http-allowed-host search.example.com (repeatable, host, host:port, [v6]:port or a full https:// origin). An undeclared name is refused with 421 Misdirected Request before MCP handling.

See Compatibility for client-specific configuration.

Self-hosting search (no vendor keys)

A local SearXNG instance aggregates Google and Brave without any account, so it removes the dependency on vendor API keys for the bulk of traffic. Our adapter supports it directly through SEARXNG_BASE_URL.

cp deploy/.env.example deploy/.env
printf 'SEARXNG_SECRET=%s\n' "$(openssl rand -hex 32)" >> deploy/.env
docker compose -f deploy/docker-compose.yml up -d
export SEARXNG_BASE_URL=http://127.0.0.1:8888

The compose file pins the SearXNG image by digest (not latest) and publishes it on 127.0.0.1:8888 only, so the local instance is loopback-only by default.

SEARXNG_SECRET is the session-signing key and it is required: compose refuses to start without it, and SearXNG itself refuses to run with its shipped placeholder. deploy/.env is git-ignored; deploy/.env.example shows the one-liner. The key lives in the environment rather than in the mounted settings.yml because SearXNG reads server.secret_key from SEARXNG_SECRET and lets the environment override the file — a placeholder committed to git would be the key actually in force. See Self-Hosting for the cluster and what the pin costs.

Then verify it, rather than assuming it works:

python3 scripts/searxng_health.py http://127.0.0.1:8888

The two things that break, and why the check covers them:

Symptom Cause Fix
HTTP 403 on every search The stock image serves only html; format=json is refused Add json under search.formats in settings.yml (already done in deploy/)
Results are thin, or an index silently disappears An upstream engine is CAPTCHA-blocked or rate limited; SearXNG still returns results from the others Check unresponsive_engines in the health output

What self-hosting does and does not give you. It removes the vendor key, gives you configuration control, and keeps traffic on your own machine. It does not grant unlimited upstream access: engines rate limit your IP independently of the instance, and some networks block an engine at the DNS level before a connection is ever attempted. Measured here, Brave reported "too many requests" and SearXNG's DuckDuckGo engine reported "CAPTCHA" under rapid querying, leaving Google CSE carrying most results. Treat it as a better no-key fallback, not as an unlimited index. Which engines answer also depends on the network the instance runs on — see Self-Hosting.

Measured over 25 queries in balanced mode alongside Tavily: SearXNG participated in 25/25 with 0 failures at 4.1 s/query, whereas the free Parallel tier exhausted its quota at exactly 20 calls.

Verifying the install

Run the server directly and complete a handshake:

BIN="$(swift build -c release --show-bin-path)/SwiftWebSearchMCP"
python3 scripts/mcp_smoke.py "$BIN"

The smoke test performs a real initialize, lists the tools and verifies their schemas, confirms that an unconfigured search fails cleanly, and asserts that every stdout line is valid JSON.

To check the server by hand:

SEARXNG_BASE_URL=https://searx.example.com "$BIN"

Startup diagnostics appear on stderr, including which providers were configured.

Keeping the toolchain current

A swift-tools-version mismatch fails loudly rather than mysteriously:

error: 'mcpsearch': package 'mcpsearch' is using Swift tools version 6.4.0
but the installed version is 6.3.3

That means the selected toolchain is too old — Xcode 26.x ships Swift 6.3.3, and this package needs Xcode 27. List what is installed and select it:

ls -d /Applications/Xcode*.app
sudo xcode-select -s /Applications/Xcode_27.app     # or your Xcode 27 bundle
swift --version                                     # expect "Swift version 6.4"

Next steps

Clone this wiki locally