Searchplex connects a model in OpenCode (or any other MCP client with the stdio transport) to the internet. The model decides when to search, Searchplex finds and reads the pages, and the model answers with numbered sources, as in Perplexity. It works with a local model (LM Studio, Ollama, llama.cpp, vLLM) or a cloud OpenAI-compatible API, and needs no subscriptions or API keys.
- One file,
srchplex.py, Python 3.9+ standard library only. - Search engines: your own SearXNG (installed with one command), then DuckDuckGo, Yandex and Bing; Bing News, arXiv and OpenAlex; Stack Overflow, GitHub and Hacker News APIs for code and discussions; optionally Tavily, after SearXNG by default or first if you prefer (see Search priority).
- Pages are read as clean Markdown with code blocks and tables; PDF, GitHub, Stack Overflow, Hacker News and Reddit are read through their APIs or feeds.
- Ranking with BM25 or embeddings, deduplication, iterative research rounds with reflection.
- Search inside local PDF, DOCX, ODT, PPTX and EPUB files; an exact calculator.
Tested with the local models qwen3.8-27b and qwen3.8-flash-next.
The research pipeline is ported from Vane (Perplexica).
In OpenCode the names get the server prefix: srchplex_deep_search and so on.
| Tool | What it does |
|---|---|
deep_search |
Research: evidence passages with numbered sources; mode = speed, balanced (default) or quality (also a cited report, 1–5 min) |
search |
Quick results without reading pages: title, URL, snippet |
fetch |
Up to 3 pages as Markdown; query keeps only the relevant parts, start continues reading, extract extracts facts with the LLM |
local_search |
Passages from PDF, DOCX, ODT, PPTX and EPUB files in paths |
calculate |
Exact calculator with variables and math functions |
focus: web, news, academic, discussions, code. time_range: day, week, month, year.
domains: only these sites, e.g. ["docs.python.org"].
You need OpenCode, Python 3.10+ (3.9+ for Searchplex itself; SearXNG needs 3.10) and a model in LM Studio,
Ollama or a cloud API. On Windows write python instead of python3.
-
Get the project:
git clone <repository URL> ~/searchplex, or download the release archive. Run the commands below from that folder. -
Optional, recommended: install SearXNG. The script downloads it, enables autostart and runs a test search:
python3 searxng_setup.py
-
Register the server in
~/.config/opencode/opencode.json(%USERPROFILE%\.config\opencode\opencode.jsonon Windows). OpenCode 2.x:OpenCode 1.x puts the servers directly under
"mcp", without"servers".LLM_BASE_URLis LM Studio (http://localhost:1234/v1), Ollama (http://localhost:11434/v1) or any OpenAI-compatible server. Drop theTAVILY_API_KEYline if you do not use Tavily. Keep thesrchplexname:AGENTS.mdrefers to the tools by it. -
Copy the rules for the model, or append them to your own
AGENTS.md:mkdir -p ~/.config/opencode && cp AGENTS.md ~/.config/opencode/AGENTS.md
-
Restart OpenCode and check everything:
python3 srchplex.py --doctor
Tavily is an optional cloud search API (1000 free searches a month). Without TAVILY_API_KEY it is never used.
With a key, SRCHPLEX_TAVILY in the server's environment sets its place in the order. Engines are asked in
turn; the next one only when the previous one fails or finds fewer than 3 results (then the results are merged).
SRCHPLEX_TAVILY |
Web | News |
|---|---|---|
fallback (default) |
SearXNG → Tavily → DuckDuckGo → Yandex → Bing | SearXNG → Bing News and Tavily together |
primary (Tavily first) |
Tavily → SearXNG → DuckDuckGo → Yandex → Bing | Tavily → SearXNG → Bing News |
last (save credits) |
SearXNG → DuckDuckGo → Yandex → Bing → Tavily | no Tavily |
off |
no Tavily, even with a key | no Tavily |
Papers, code and discussions never use Tavily: they have their own sources. Restart OpenCode after changing it.
A wrong key or used-up credits pause Tavily for an hour and the search goes on with the next engine.
Set them in the environment of the server entry in the OpenCode config; for the CLI, in the terminal.
| Variable | Default | Purpose |
|---|---|---|
LLM_BASE_URL |
http://localhost:1234/v1 |
OpenAI-compatible model API: LM Studio, Ollama, llama.cpp, a cloud API |
LLM_API_KEY |
lm-studio |
API key, if the server needs one (cloud) |
SRCHPLEX_LLM_MODEL (LMSTUDIO_MODEL, LLM_MODEL) |
the loaded model | The model to use; required for cloud APIs and servers with several models. LM Studio and Ollama load a model that is not loaded yet |
SRCHPLEX_LLM |
auto |
off: no LLM at all |
SRCHPLEX_REASONING_EFFORT |
none |
Sent as reasoning_effort; off: not sent |
SRCHPLEX_LLM_CONCURRENCY |
2 |
Parallel LLM requests |
EMBEDDING_MODEL |
the loaded embedding model | The embedding model; required for cloud APIs |
SRCHPLEX_EMBEDDINGS |
auto |
off: BM25 only |
SEARXNG_URL |
http://localhost:8080 |
SearXNG address; off: do not use it |
GITHUB_TOKEN |
— | Higher GitHub API limits |
TAVILY_API_KEY |
— | Tavily key; without it Tavily is not used |
SRCHPLEX_TAVILY |
fallback |
Tavily's place: fallback, primary (first), last, off; see Search priority |
TAVILY_TIMEOUT_MS |
10000 |
Tavily request timeout |
SEARCH_PROVIDER |
— | Compatibility with configs of other search MCP servers: ddg = no Tavily, tavily = Tavily first; SRCHPLEX_TAVILY wins |
SRCHPLEX_BROWSER |
auto |
off: do not render JavaScript pages with Playwright |
SRCHPLEX_REGION |
— | DuckDuckGo region (kl), e.g. us-en |
SRCHPLEX_CACHE_DIR |
<tmp>/srchplex_cache |
Cache folder |
SRCHPLEX_BLOCK_PRIVATE |
— | 1: fetch refuses localhost and LAN addresses |
python3 srchplex.py --doctor # certificates, cache, SearXNG, Tavily, every search source, LLM, embeddings, PDF
python3 searxng_setup.py status # SearXNG: installation, autostart, test searchOptional packages, picked up when installed into the Python that runs Searchplex: pypdf (PDF in
local_search and fetch), playwright with playwright install chromium (pages that are empty without
JavaScript), certifi (root certificates for python.org builds on macOS).
DuckDuckGo, Yandex, Bing and Bing News are read as ordinary web pages, without an official API: their pages change, they rate-limit frequent queries and their terms may not allow automated access. For steady use install SearXNG or add Tavily. Searchplex is meant for personal research, not bulk data collection.
Search improves facts, not reasoning: the model can still misread a source. Ask for the official docs when details matter.
MIT. Includes the MIT notice of Vane (Perplexica).
{ "mcp": { "servers": { "srchplex": { "type": "local", "command": ["<path to python>", "<project folder>/srchplex.py"], "environment": { "LLM_BASE_URL": "http://localhost:1234/v1", "TAVILY_API_KEY": "{file:~/.config/opencode/.tavily_key}" } } } } }