FishMem

FishMem for Claude Code

Give Claude Code persistent, per-project memory via the FishMem MCP server.

Configure Claude Code to use the FishMem MCP server and it gains persistent memory across sessions. It recalls your conventions before answering and stores durable facts as it works, so it stops re-learning the same codebase every time you open a new conversation.

This guide adds the @fishmem/mcp server to Claude Code two ways: with the claude mcp add command, or with a project-scoped .mcp.json file you can commit to the repo.

Setup

Get an API key

Create a project key in the dashboard. It looks like fm_.... See Authentication for details on keeping it server-side.

Add the server

Register the server with the CLI. The --scope project flag writes a .mcp.json in the current repo so the configuration travels with the project:

claude mcp add fishmem \
  --scope project \
  --env FISHMEM_API_KEY=<your-key> \
  -- npx -y @fishmem/mcp

Or write the .mcp.json yourself:

.mcp.json
{
  "mcpServers": {
    "fishmem": {
      "command": "npx",
      "args": ["-y", "@fishmem/mcp"],
      "env": {
        "FISHMEM_API_KEY": "<your-key>",
        "FISHMEM_PROJECT": "acme-api"
      }
    }
  }
}

Don't commit a real key. Reference an environment variable ("FISHMEM_API_KEY": "${FISHMEM_API_KEY}") or keep the key in a local, git-ignored config.

Verify

Start Claude Code in the repo and run /mcp. You should see fishmem listed as connected, exposing search_memory, add_memory, and list_memories.

Use it

You don't call the tools directly — Claude Code does. Ask it to remember something, or let it search on its own:

> Remember that we run the test suite with `pnpm test --filter api`.

Claude Code calls add_memory to store the fact. In a later session, when you ask "how do I run the API tests?", it calls search_memory and answers from memory instead of guessing.

Set FISHMEM_PROJECT to the repository so memory is per-project — facts from one repo never surface in another. Internally this maps to a run_id scope; see Scoping for how user_id, agent_id, and run_id interact.

.mcp.json
{
  "mcpServers": {
    "fishmem": {
      "command": "npx",
      "args": ["-y", "@fishmem/mcp"],
      "env": {
        "FISHMEM_API_KEY": "${FISHMEM_API_KEY}",
        "FISHMEM_PROJECT": "acme-api",
        "FISHMEM_USER_ID": "alex"
      }
    }
  }
}

Recall across sessions

Memory persists on the server, so a convention learned once is available forever. A typical arc:

Session 1
> Use the `Result` type for fallible functions, not exceptions.
  (Claude Code calls add_memory)

Session 2, days later, new terminal
> Add a function that parses the config file.
  (Claude Code calls search_memory, finds the convention,
   and returns a Result-typed function without being reminded)

Next steps

On this page