How MCP Gives AI Agents Real Context (Local-First)
MCP, semantic search, and why running locally beats cloud indexing for code.
April 6, 2026
How MCP Gives AI Agents Real Context (Local-First)
AI coding agents are limited not by intelligence but by information. They don't know your codebase, your Jira backlog, or your team wiki — only what's in the conversation window and their training data. For anything specific to your project, that's rarely enough.
MCP (Model Context Protocol) is how you fix this. It lets agents call external tools mid-conversation, which means they can search your actual work rather than guessing about it. Indexed is one of those tools: a local-first semantic search engine that gives your agent real context from your own environment.
What is MCP?
MCP is an open standard created by Anthropic. It lets AI assistants — Claude Desktop, Cursor, Cline, Codex, and others — call external tools and data sources during a conversation.
Without MCP, asking Claude about your deployment process gets you a generic answer inferred from its training data. With MCP, Claude calls a search tool, reads your actual runbook, and answers based on what your team actually documented. The protocol is straightforward: an AI client (your editor) connects to an MCP server (Indexed), discovers what tools are available, and calls them when it needs information.
MCP is not RAG
RAG systems retrieve context before the AI responds. MCP goes further — the AI decides when and what to search based on the conversation. It's tool use, not pre-fetching.
How Indexed uses MCP
Indexed runs as an MCP server and exposes two tools:
search(query)searches across all your collections — codebase, Jira tickets, Confluence pages, local docs — everything you've indexed.search_collection(collection, query)targets a specific collection, useful when the agent knows it needs Jira tickets rather than source code.
The agent decides when to call them based on the conversation. You don't configure triggers or write rules.
You: "What's our deployment process for the payments service?"
Agent thinks: I need internal documentation for this.
Agent calls: search("deployment process payments service")
Indexed returns: 3 chunks from your runbook, deploy scripts, and a Jira ticket
about the last hotfix.
Agent: "Based on your runbook, the payments service deploys via..."Transports
MCP supports multiple transport methods:
| Transport | When to use | Command |
|---|---|---|
| stdio (default) | Local editors — Claude Desktop, Cursor, Cline | indexed mcp run |
| HTTP | Docker containers, remote servers, shared access | indexed mcp run --transport http --port 8000 |
| SSE | Server-Sent Events for streaming responses | indexed mcp run --transport sse |
| Streamable HTTP | Newer HTTP-based streaming protocol | indexed mcp run --transport streamable-http |
For most setups, stdio is the right choice. It's local, fast, and what editors expect. Use HTTP only when Indexed runs in Docker or on a different machine.
How semantic search works
Keyword search is brittle. grep "auth timeout" won't find your SSOTokenExpirationHandler — the words don't match, even though the meaning does.
Semantic search works differently. It converts text into vectors — lists of numbers that represent meaning. Similar concepts end up as nearby vectors, even when the words are completely different. Indexed uses the all-MiniLM-L6-v2 embedding model, which maps text into 384-dimensional space and runs entirely on your machine. Those vectors are stored in a FAISS index for fast nearest-neighbor search.
The full pipeline:
Documents → Parse → Chunk (~500 tokens) → Embed (384-dim vectors) → FAISS index on diskWhy chunking matters: Embedding an entire file produces vague vectors. Chunking splits documents into focused sections (~500 tokens each), so search results point to the specific section that answers your question — not just the file it lives in.
How semantic search works — and when grep is still the right tool
Indexed retrieves with dense vector embeddings: your query is embedded and compared against chunk embeddings, so results are ranked by meaning rather than by term overlap. That handles the case keyword search fails at:
Semantic hits:
→ "API throttling with exponential backoff" (different words, same concept)
→ "Handling 429 Too Many Requests errors" (related behavior)It is not uniformly better than grep. For a literal string — a symbol name, an error code, a config key like NEXT_PUBLIC_API_URL — rg is exact, instant and free. Two things narrow that gap:
- AST-aware chunking keeps a function or class intact, so its identifier stays attached to its meaning instead of being split mid-symbol across chunks.
- Cross-encoder reranking on v2 collections re-scores the top candidates by reading query and chunk together. It is off by default; enable it with
--rerankorcore.v2.rerank.enabled.
Use both: grep for what you can name, Indexed for what you can only describe.
Why local-first matters
Most AI search tools send your data to the cloud for embedding and indexing. Indexed doesn't.
The embedding model runs on your machine. Your code, tickets, and docs never leave your environment. The FAISS index is a file on disk — not a managed database, not a SaaS vector store. MCP over stdio means there's no HTTP server, no open port, no network surface at all between your editor and Indexed.
This is privacy by architecture, not by policy. There's no "trust us" involved — there's simply no mechanism for your data to leave. That distinction matters when you're indexing proprietary code or internal documentation.
Air-gapped friendly
Indexed works in fully air-gapped environments. The embedding model is bundled locally, and all indexing and search happens on-device. No network calls after installation.
Limitations
Indexed is a retrieval tool, not a chatbot. It finds the most relevant content — your AI agent synthesizes the answers from there. A few things worth knowing:
- English-focused. The all-MiniLM-L6-v2 model is trained primarily on English text. Other languages work but retrieval accuracy is lower.
- Short queries are less precise. "auth" is too vague. "authentication timeout after SSO migration" produces much better results — more context in the query means better vectors.
- Domain jargon may be approximate. Highly specialized terms get approximate embeddings if they weren't in the model's training data. AST-aware chunking keeps identifiers attached to their code, and cross-encoder reranking (v2) improves precision on these queries.
Debug with MCP Inspector
Indexed ships with a built-in debugging tool:
indexed mcp devThis launches the MCP Inspector — a web UI where you can send test queries to your MCP tools, inspect responses, and verify that your collections return the results you expect before connecting your editor.