DEV Community

Nerav Doshi
Nerav Doshi

Posted on

Wired the Local MCP Server into Claude Code

Context: Every prior entry in this arc — building the Chroma index, chunking, querying — was done by hand, typing Python commands one at a time. An MCP server is what turns that into a real tool: a small program that exposes specific capabilities (like "search my notes") to an AI client such as Claude Code, so the client can call it directly instead of a person running queries manually. The point of this entry was proving that connection actually works, not just that the server starts.

Ran: After the earlier Connection closed error (Claude Code launching a bare python3, which resolved to system Python outside the venv, missing every package the server needs), re-registered the server pointing directly at the venv's Python:

claude mcp remove today-i-ran-notes
claude mcp add today-i-ran-notes -- ~/mcp-env/bin/python3 mcp_search_server.py
claude mcp list
Enter fullscreen mode Exit fullscreen mode

That returned ✔ Connected. Then, in a real Claude Code session, asked it directly:

Use the today-i-ran-notes server to search for how to check pod status with oc

Result: The tool got called — twice. First a broad search, then a follow-up call pulling more detail from the closest match. Claude Code's own response is worth quoting closely, because it's more interesting than a clean success would have been:

The search returned results, but none of them directly cover checking pod status with oc. The closest match is a note about building an "oc CLI Mentor" system prompt... but doesn't appear to include specific pod-status commands.

That's the right answer. Entry 02 is about building a constrained system prompt, not a list of pod-status commands — the tool didn't hallucinate a match, it accurately reported the gap and said so plainly, then fell back to its own general knowledge to actually answer the question, clearly separating "your notes don't cover this" from "here's the answer anyway."

One more thing worth flagging clearly: when asked to save the new commands for future reference, Claude Code saved them to its own built-in memory system — not to the Chroma index built across Entries 05–07. Those are two separate mechanisms that are easy to conflate: one is the RAG pipeline this series has been building by hand, the other is Claude Code's own persistent memory feature. The note that got saved lives in the latter, not in chroma_db.

Takeaway: The full loop works — a local embeddings pipeline, exposed as a real MCP tool, correctly invoked by a real client, with honest reporting when the answer isn't in the index rather than a confident wrong guess. That honesty is the most important result here: a search tool that admits "not in here" is far more useful than one that always returns something and lets the caller assume it's relevant.

Top comments (0)