This guide walks through setting up ContextFit as a local memory tool for Claude Desktop on a new MacBook.
Claude Desktop is the chat UI. ContextFit is the local search/memory engine. MCP is the bridge between them.
Claude Desktop will get these ContextFit tools:
contextfit_search— search a local ContextFit knowledge base and return source-backed chunkscontextfit_get_chunk— fetch the full text for a returnedchunk_idcontextfit_stats— show local KB statscontextfit_list_vaults— list named local vaults, if configuredcontextfit_search_vault— search one named vaultcontextfit_search_all_vaults— search all registered vaults
Your source files stay on your Mac. Claude only sees the snippets ContextFit returns into the active chat.
Assume:
- Claude Desktop is installed.
- Your documents are in
~/Documents/contextfit-demo. - Your ContextFit knowledge base will live at
~/contextfit_kb.
Open Terminal and install Apple command-line tools if needed:
xcode-select --installIf you do not already have Python 3 available, install it with Homebrew or from python.org.
Check:
python3 --version
git --versionCreate a virtual environment and install ContextFit from PyPI:
mkdir -p ~/contextfit
cd ~/contextfit
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install contextfitContributor install from source:
cd ~/Documents
git clone https://github.com/ContextFit/cf.git
cd cf
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e .Confirm the CLI works:
contextfit --helpIf contextfit is not found, use the full path to the venv executable later:
pwd
# Example output for PyPI install: /Users/YOU/contextfit
# ContextFit executable: /Users/YOU/contextfit/.venv/bin/contextfitCreate a demo folder if you do not already have one:
mkdir -p ~/Documents/contextfit-demo
cat > ~/Documents/contextfit-demo/project-orion.md <<'EOF'
# Project Orion
The launch checklist has three open items: pricing review, docs polish, and support handoff.
The preferred launch voice is concise, technical, and practical.
EOFIngest it into ContextFit:
contextfit --kb ~/contextfit_kb ingest ~/Documents/contextfit-demo \
--defer-index-build \
--rebuild-index-after-ingestTest search before opening Claude:
contextfit --kb ~/contextfit_kb query "What are the open launch items?" --jsonYou should see JSON with retrieved chunks from project-orion.md.
Claude Desktop often runs with a smaller PATH than your Terminal. The safest setup is to use the absolute path:
which contextfitIf you installed with the venv above, this will usually be:
/Users/YOU/contextfit/.venv/bin/contextfit
Use that path in the Claude config below.
Run this in Terminal:
mkdir -p "$HOME/Library/Application Support/Claude"
open -e "$HOME/Library/Application Support/Claude/claude_desktop_config.json"If the file is blank or does not exist yet, paste this JSON.
Replace:
/Users/YOU/contextfit/.venv/bin/contextfitwith yourwhich contextfitresult/Users/YOU/contextfit_kbwith your actual KB path
{
"mcpServers": {
"contextfit": {
"command": "/Users/YOU/contextfit/.venv/bin/contextfit",
"args": [
"--kb",
"/Users/YOU/contextfit_kb",
"mcp",
"--top-k",
"8",
"--method",
"hybrid"
]
}
}
}Save the file.
If you already have other MCP servers configured, add only the "contextfit" block inside the existing "mcpServers" object.
Quit Claude Desktop fully and reopen it.
On macOS, use Claude → Quit Claude or press Cmd+Q. Closing the window is not always enough.
Ask Claude:
Use ContextFit to search my local memory for Project Orion. What are the open launch items? Cite the source chunks.
Or:
List the ContextFit tools you can use.
If Claude does not show the tools, test the MCP server directly in Terminal:
printf '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}\n{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}\n' \
| /Users/YOU/contextfit/.venv/bin/contextfit --kb /Users/YOU/contextfit_kb mcpYou should see JSON-RPC responses that include tools such as contextfit_search.
If this fails, fix the command path or KB path before trying Claude again.
For multiple local collections, use a vault registry instead of one MCP server per folder.
Create ~/.contextfit/vaults.json:
{
"vaults": {
"work": {
"kb_path": "/Users/YOU/contextfit_work_kb",
"description": "Work docs, notes, and project memory"
},
"research": {
"kb_path": "/Users/YOU/contextfit_research_kb",
"description": "Papers, references, and experiments"
},
"personal": "/Users/YOU/contextfit_personal_kb"
}
}Then add --vault-registry to Claude's ContextFit args:
{
"mcpServers": {
"contextfit": {
"command": "/Users/YOU/contextfit/.venv/bin/contextfit",
"args": [
"--kb",
"/Users/YOU/contextfit_kb",
"mcp",
"--vault-registry",
"/Users/YOU/.contextfit/vaults.json"
]
}
}
}Then in Claude:
List my ContextFit vaults.
Search the work vault for the Acme renewal audit.
Search all vaults for website tokenization.
If the registry file does not exist, ContextFit still exposes a single default vault from --kb.
MCP is best for interactive desktop clients like Claude Desktop. Local agent runtimes, shell scripts, cron jobs, OpenClaw, and Hermes can use JSON CLI output directly:
contextfit vaults list --json
contextfit search "Acme renewal audit" --vault work --json --extractive auto --compact
contextfit search-all "website tokenization" --json --extractive auto --compact
contextfit chunk 42 --vault work --jsonThe CLI and MCP server use the same local vault registry and retrieval engine. Use --extractive auto --compact when an agent needs prompt-ready source-backed evidence instead of full chunk previews or JSON-heavy metadata; ContextFit will project matching .tmd rows, bullets, or spans without an LLM.
- Quit and reopen Claude Desktop with
Cmd+Q. - Confirm
claude_desktop_config.jsonis valid JSON. - Use the absolute path from
which contextfitforcommand. - Use absolute paths in
args; avoid~in Claude config. - Run the raw MCP smoke test above.
Use the full venv executable path:
"command": "/Users/YOU/contextfit/.venv/bin/contextfit"Claude may not load your shell profile, so relying on PATH can fail.
Run:
contextfit --kb ~/contextfit_kb stats --json
contextfit --kb ~/contextfit_kb query "test" --jsonIf the KB has zero chunks, ingest your source folder again.
- ContextFit reads only the KB path or vaults you configure.
- Your original files stay local.
- Retrieved snippets are sent into the active Claude chat as tool results.
- Only index sensitive folders if you are comfortable with relevant snippets appearing in Claude conversations.