MCP Setup
Configure Prime as an MCP server for Claude Desktop with auto-inject, per-project memory, and advanced options.
Basic Configuration
Add to ~/.claude/claude_desktop_config.json:
{
"mcpServers": {
"prime": {
"command": "allsource-prime",
"args": ["--data-dir", "~/.prime/memory"]
}
}
}Restart Claude Desktop after saving. Prime will persist all knowledge to ~/.prime/memory.
Auto-Inject Configuration
Auto-inject feeds the compressed index into every conversation automatically, so the agent always knows what it knows. Add the --auto-inject flag:
{
"mcpServers": {
"prime": {
"command": "allsource-prime",
"args": [
"--data-dir", "~/.prime/memory",
"--auto-inject"
]
}
}
}When enabled, Prime exposes a prime://auto-context resource that Claude reads at conversation start. This resource contains the compressed index — a token-efficient markdown summary of all stored knowledge (~500-1000 tokens).
Control the maximum token budget with --auto-inject-max-tokens:
"args": [ "--data-dir", "~/.prime/memory", "--auto-inject", "--auto-inject-max-tokens", "2000" ]
Per-Project Memory
Use separate --data-dir paths for isolated project contexts:
{
"mcpServers": {
"prime-work": {
"command": "allsource-prime",
"args": ["--data-dir", "~/projects/acme/.prime", "--auto-inject"]
},
"prime-personal": {
"command": "allsource-prime",
"args": ["--data-dir", "~/.prime/personal", "--auto-inject"]
}
}
}Each instance maintains its own graph, index, and vector store. No data leaks between projects.
Tool Reference
Prime exposes 13 MCP tools. Claude selects and calls them automatically based on conversation context.
| Tool | Description |
|---|---|
prime_add_node | Create a knowledge node (person, concept, project, etc.) |
prime_get_node | Retrieve a node by ID with all properties |
prime_delete_node | Soft-delete a node (preserved in event history) |
prime_add_edge | Create a directed relationship between two nodes |
prime_neighbors | Find all nodes connected to a given node |
prime_index | Get the compressed knowledge index (markdown TOC) |
prime_recall | Hybrid recall: vector + graph + temporal |
prime_context | Combined retrieval with index scaffolding |
prime_embed | Store a vector embedding with metadata |
prime_similar | Find semantically similar vectors via HNSW |
prime_stats | Graph statistics (node/edge counts, domains) |
prime_history | Full event audit trail for a node |
prime_search | Full-text search across node properties |
Agent Prompt Template
For best results, include a system prompt that teaches Claude how to use Prime. Add to your CLAUDE.md or system prompt:
You have access to Prime, a persistent knowledge graph for long-term memory. ## When to store - Facts about people, projects, decisions, or relationships - User preferences and corrections - Important context that should persist across conversations ## When to recall - Before answering questions about people, projects, or history - When the user asks "what do you know about X" - When you need context from previous conversations ## Workflow 1. Check prime_index at conversation start (or use auto-inject) 2. Use prime_recall for specific queries 3. Use prime_context for cross-domain questions 4. Store new facts with prime_add_node + prime_add_edge 5. Always set a domain (engineering, product, revenue, etc.)
Cookbook Resource
Prime exposes a prime://cookbook MCP resource containing worked examples and best practices for common memory patterns (team directories, decision logs, project tracking). Claude can read this resource on demand to learn advanced usage patterns.
Troubleshooting
- Binary not found: Ensure
allsource-primeis in your$PATH. Runwhich allsource-primeto verify. If installed viacargo install, check that~/.cargo/binis in your PATH. - Data directory permissions: Prime needs read/write access to the
--data-dirpath. Runmkdir -p ~/.prime/memory && ls -la ~/.prime/memoryto verify. On macOS, Claude Desktop may need Full Disk Access for paths outside~. - Tools not appearing: After editing the config, fully quit and relaunch Claude Desktop (not just close the window). Check Claude Desktop's MCP logs for connection errors.
- Auto-inject not working: Verify the
--auto-injectflag is present in your args array. Theprime://auto-contextresource only appears when the graph has at least one node.
