Skip to content

MCP Memory Tools and CLI Use Separate Backends - Data Not Synced #967

@eswann

Description

@eswann

MCP Memory Tools and CLI Use Separate Backends - Data Not Synced

Description

In v3.0.0-alpha.125, the MCP memory tools and CLI memory commands use completely separate storage backends that don't synchronize:

  • CLI uses SQLite database at .swarm/memory.db
  • MCP tools use JSON file at .claude-flow/memory/store.json

This causes MCP memory operations to always show 0 entries while CLI shows correct data.

Steps to Reproduce

  1. Install claude-flow v3.0.0-alpha.125
  2. Add MCP server: claude mcp add claude-flow -- bunx -y @claude-flow/cli@latest
  3. Store data via CLI:
    bunx @claude-flow/cli@latest memory store --key "test" --value "hello" --namespace default
  4. Verify CLI shows the entry:
    bunx @claude-flow/cli@latest memory list
    # Shows 1+ entries
  5. Use MCP tool to list memory:
    mcp__claude-flow__memory_list
    # Shows 0 entries
    

Expected Behavior

MCP memory tools should see the same data as CLI memory commands. Both should use the same storage backend.

Actual Behavior

  • CLI stores to .swarm/memory.db (SQLite) - works correctly
  • MCP tools read from .claude-flow/memory/store.json (JSON) - always empty
  • No synchronization between backends

Evidence

Source code analysis of memory-tools.js:

const MEMORY_DIR = '.claude-flow/memory';
const MEMORY_FILE = 'store.json';
function getMemoryPath() {
    return resolve(join(MEMORY_DIR, MEMORY_FILE));
}

Meanwhile, the CLI uses a different path with SQLite via the memory service.

Environment

  • claude-flow version: 3.0.0-alpha.125
  • Installation: bunx @claude-flow/cli@latest
  • OS: Linux (WSL2)
  • Node: 22.x
  • Bun: 1.x

Related Issues

Workaround

Currently using CLI via Bash instead of MCP tools for memory operations:

bunx @claude-flow/cli@latest memory search --query "pattern"
bunx @claude-flow/cli@latest memory store --key "k" --value "v"

Suggested Fix

Either:

  1. Unify both backends to use SQLite (recommended for persistence and performance)
  2. Add synchronization layer between backends
  3. Have MCP tools call CLI internally for consistency

Impact

This breaks the MCP integration for Claude Code users who rely on MCP tools for memory operations. The memory system is a core feature for cross-session learning and agent coordination.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions