all.sourceall.source

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.

ToolDescription
prime_add_nodeCreate a knowledge node (person, concept, project, etc.)
prime_get_nodeRetrieve a node by ID with all properties
prime_delete_nodeSoft-delete a node (preserved in event history)
prime_add_edgeCreate a directed relationship between two nodes
prime_neighborsFind all nodes connected to a given node
prime_indexGet the compressed knowledge index (markdown TOC)
prime_recallHybrid recall: vector + graph + temporal
prime_contextCombined retrieval with index scaffolding
prime_embedStore a vector embedding with metadata
prime_similarFind semantically similar vectors via HNSW
prime_statsGraph statistics (node/edge counts, domains)
prime_historyFull event audit trail for a node
prime_searchFull-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-prime is in your $PATH. Run which allsource-prime to verify. If installed via cargo install, check that ~/.cargo/bin is in your PATH.
  • Data directory permissions: Prime needs read/write access to the --data-dir path. Run mkdir -p ~/.prime/memory && ls -la ~/.prime/memory to 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-inject flag is present in your args array. The prime://auto-context resource only appears when the graph has at least one node.