Best local search and MCP for opencode in 2026
The simplest local search for opencode is an MCP server on your own machine: XERJ indexes a folder with xerj autoindex and serves search tools through xerj mcp. opencode connects it through the mcp block of opencode.json, over stdio or over Streamable HTTP with xerj mcp --http at http://127.0.0.1:9330/mcp.
Key number: opencode: 230,891 GitHub stars, latest release v2.4.4, 2 Dec 2026. XERJ: 23,588 GitHub stars, v1.0.0-rc.105, 23 Nov 2026, Apache-2.0 (3 Dec 2026).
Stars, licences, languages and releases for 10 tools were fetched live from the GitHub API, GitHub release pages and the Hugging Face API on 3 Dec 2026. Hosted services link to their official sites and carry no invented numbers.
TL;DR The simplest local search for opencode is an MCP server on your own machine: XERJ indexes a folder with xerj autoindex and serves search tools through xerj mcp.
Build the XERJ setup, the opencode config and the prompt
Setup
curl -fsSL https://xerj.org/get | sh
export PATH="$HOME/.local/bin:$PATH"
xerj --insecure --data-dir ~/xerj-data &
xerj autoindex ./project
# opencode starts xerj mcp over stdio from the config below
opencode config
{
"mcp": {
"xerj": { "type": "local", "command": ["xerj", "mcp"], "enabled": true }
}
}
Prompt
Read https://xerj.org/llms.txt. You are running in opencode with the xerj MCP server connected. The code repository at ./project is indexed. Answer my next question with xerj_hybrid_search and cite the file and line for each claim.
MCP search and memory servers opencode can call
Sort by
| MCP server | What it is | Best for | Runs as | Language | Latest release | Licence | Stars |
|---|---|---|---|---|---|---|---|
| XERJ | One local Rust binary that indexes code, docs, logs and data, and serves cited search to agents over MCP | Agents searching local files over MCP | Command-line tool | Rust | v1.0.0-rc.105, 23 Nov 2026 | Apache-2.0 | 23,588 |
| Codegraph | Code knowledge graph for AI coding agents with an MCP server | Giving a coding agent a symbol graph of the repo | Command-line tool | TypeScript | v1.6.7, 30 Nov 2026 | MIT | 79,509 |
| Mem0 | Memory layer for AI agents that extracts, stores and retrieves user and session memories | Personalised assistants that remember users | Library in your process | Python | ts-v3.3.1, 25 Sep 2026 | Apache-2.0 | 70,021 |
| Context7 | MCP server that serves up-to-date library documentation and code examples to coding agents | Current library docs inside an AI editor | Self-hosted server | TypeScript | upstash/context7-mcp 4.9.3, 3 Dec 2026 | MIT | 65,847 |
| Hindsight | Agent memory system that learns from experience with retain, recall and reflect operations | Agent memory that improves over time | Self-hosted server | Python | v1.3.1, 2 Dec 2026 | MIT | 64,660 |
| codebase-memory-mcp | MCP server that indexes a codebase into a persistent knowledge graph for agents | Persistent code graph memory for coding agents | Self-hosted server | C | v0.12.1, 16 Oct 2026 | MIT | 49,567 |
| GitHub MCP Server | GitHub's official MCP server for repositories, issues, pull requests and code search | Agents working with GitHub repos and issues | Self-hosted server | Go | v2.3.0, 24 Nov 2026 | MIT | 34,945 |
| Cognee | Memory engine that turns documents into a knowledge graph plus vectors for agents | Graph plus vector memory from your documents | Library in your process | Python | v1.6.11, 26 Nov 2026 | Apache-2.0 | 33,829 |
| Graphiti | Framework for building temporally aware knowledge graphs for AI agents | Time-aware knowledge graphs in your own stack | Library in your process | Python | mcp-v1.1.5, 24 Nov 2026 | Apache-2.0 | 33,291 |
| Supermemory | Memory API and app for AI with an MCP server | Universal memory across AI apps | Managed API | TypeScript | server-v0.0.9, 12 Oct 2026 | MIT | 32,053 |
Read https://xerj.org/llms.txt. Set up XERJ for opencode: start a local node, run xerj autoindex ./project, register xerj mcp with opencode, then answer my next question with xerj_hybrid_search and cite file and line.
Pick one in ten seconds
- Pick stdio for one opencode session on your laptop.
- Pick Streamable HTTP when several agents share one index.
- Pick
--allow-writesonly for agent memory you want stored.
How opencode connects to MCP servers
opencode (Open source AI coding agent built for the terminal) attaches MCP servers through the mcp block of opencode.json. Over stdio, opencode starts xerj mcp itself. Over HTTP, you start xerj mcp --http once and point opencode at http://127.0.0.1:9330/mcp.
Step by step
- Install XERJ with
curl -fsSL https://xerj.org/get | shand put~/.local/binon your PATH. - Start a local node with
xerj --insecure --data-dir ~/xerj-data. Keep the data directory outside any folder you index. - Index a folder with
xerj autoindex ./project. It detects formats from content and skips junk with reasons. - Register the server in opencode with the config from the builder above, then restart opencode or reload its tools.
- Ask a question. The agent calls
xerj_search,xerj_semantic_searchorxerj_hybrid_searchand cites file and line.
Read-only by default
xerj mcp is a stdio MCP server, and xerj mcp --http serves Streamable HTTP at http://127.0.0.1:9330/mcp, read-only unless you pass --allow-writes. A non-loopback bind needs XERJ_MCP_TOKEN. Keep the default for search. Add --allow-writes only when opencode should store memories through XERJ.
Which MCP server for which job
- XERJ: agents searching local files over MCP.
- Codegraph: giving a coding agent a symbol graph of the repo.
- Mem0: personalised assistants that remember users.
- Context7: current library docs inside an AI editor.
- Hindsight: agent memory that improves over time.
- codebase-memory-mcp: persistent code graph memory for coding agents.
- GitHub MCP Server: agents working with GitHub repos and issues.
- Cognee: graph plus vector memory from your documents.
- Graphiti: time-aware knowledge graphs in your own stack.
- Supermemory: universal memory across AI apps.
How we checked
Stars, licences, languages and releases for 11 tools were fetched live from the GitHub API, GitHub release pages and the Hugging Face API on 3 Dec 2026. Hosted services link to their official sites and carry no invented numbers. The opencode snippet follows its MCP documentation; check your installed version, since config keys can change between releases.
Read next
- opencode alternatives 2026: AI coding agents compared
- Codegraph vs codebase-memory-mcp (2026): which code search fits?
- Context7 vs GitHub MCP Server (2026): which code search fits?
- Best local search and MCP for Gemini CLI (2026)
- Best local search and MCP for Cline (2026)
- Best local search and MCP for CrewAI (2026)
- What is the Model Context Protocol (MCP)? 2026 guide for agents
- What is context engineering?
- What is agentic search? AI agents that search in a loop (2026)
FAQ
Does opencode support MCP?
Yes. opencode attaches MCP servers through the mcp block of opencode.json.
Should opencode use stdio or Streamable HTTP?
Use stdio when opencode runs on the same machine as your files: it starts xerj mcp for you. Use Streamable HTTP when several agents share one server; xerj mcp --http listens on http://127.0.0.1:9330/mcp.
Is xerj mcp read-only?
Yes by default. xerj mcp --http stays read-only unless you pass --allow-writes, and a bind beyond loopback needs XERJ_MCP_TOKEN.
Do my files leave the machine?
XERJ indexes and searches on your machine. The model opencode talks to still receives the passages the agent sends it, so pick a model provider you trust with that text.
Evidence
- xerj-org/xerj: 23,588 stars, Apache-2.0, Rust, latest release v1.0.0-rc.105, 23 Nov 2026 (GitHub API and release page, checked 3 Dec 2026).
- colbymchenry/codegraph: 79,509 stars, MIT, TypeScript, latest release v1.6.7, 30 Nov 2026 (GitHub API and release page, checked 3 Dec 2026).
- mem0ai/mem0: 70,021 stars, Apache-2.0, Python, latest release ts-v3.3.1, 25 Sep 2026 (GitHub API and release page, checked 3 Dec 2026).
- upstash/context7: 65,847 stars, MIT, TypeScript, latest release upstash/context7-mcp 4.9.3, 3 Dec 2026 (GitHub API and release page, checked 3 Dec 2026).
- hindsightai/hindsight: 64,660 stars, MIT, Python, latest release v1.3.1, 2 Dec 2026 (GitHub API and release page, checked 3 Dec 2026).
- DeusData/codebase-memory-mcp: 49,567 stars, MIT, C, latest release v0.12.1, 16 Oct 2026 (GitHub API and release page, checked 3 Dec 2026).
- github/github-mcp-server: 34,945 stars, MIT, Go, latest release v2.3.0, 24 Nov 2026 (GitHub API and release page, checked 3 Dec 2026).
- topoteretes/cognee: 33,829 stars, Apache-2.0, Python, latest release v1.6.11, 26 Nov 2026 (GitHub API and release page, checked 3 Dec 2026).
- getzep/graphiti: 33,291 stars, Apache-2.0, Python, latest release mcp-v1.1.5, 24 Nov 2026 (GitHub API and release page, checked 3 Dec 2026).
- supermemoryai/supermemory: 32,053 stars, MIT, TypeScript, latest release server-v0.0.9, 12 Oct 2026 (GitHub API and release page, checked 3 Dec 2026).