C13 Updated 2026-06-20
Pillar 2 - Memory in any agent via MCP

Add persistent memory to Claude Code in 2 minutes (MCP)

Paste a Claude Code MCP config that runs npx answer-engine-mcp, points at engine.answeragent.ai, and gives Claude persistent scoped memory.

To add persistent memory to Claude Code, create an Answer Engine key, paste a .mcp.json entry that runs npx answer-engine-mcp, and restart Claude Code. The server gives Claude the same scoped memory tools used by Cursor and Codex, so the setup is portable instead of tied to one agent.

Last updated: June 20, 2026.

What does this install actually add?

It adds an MCP server that Claude Code can launch as a local stdio process. The Model Context Protocol is the open standard for connecting AI applications to external systems, and the official MCP docs describe broad client support across Claude, ChatGPT, Cursor, VS Code, and other tools. In this setup, Answer Engine is the external system: it stores and retrieves scoped memory from your content library, while Claude Code remains the agent that decides when to call a tool.

Claude Code already documents MCP as the way to connect external tools, databases, APIs, and hosted services into the coding agent (Claude Code MCP reference). The quickstart also shows the operational loop you should expect: add a server, check its connection status, then use it from a session (Claude Code MCP quickstart).

For Answer Engine, the practical result is simple: instead of pasting the same background into every Claude Code session, Claude can call memory tools that search or write to the library you selected. The memory is still scoped by your key and library id. Claude does not get every source by default; it gets the MCP tools and asks for what it needs.

What should you have before you paste the config?

You need three things:

  • Claude Code installed and authenticated.
  • Node.js available on your path so npx answer-engine-mcp can run.
  • An Answer Engine Programmatic API key scoped to the library you want Claude to use.

Use a key that starts with ae_live_ in production. If you are testing locally, keep the same config shape but swap the key and library id. Do not commit a real key into a repository. If a team wants to share a project-level .mcp.json, put placeholders in the file and let each developer provide secrets through local environment management.

Where do you put the Claude Code MCP config?

For a project-scoped setup, create .mcp.json in the project root. Claude Code’s quickstart explains that project-scoped MCP entries live in .mcp.json, while user and local scopes are stored elsewhere (Claude Code MCP quickstart). Project scope is useful when every developer working in the repo should see the same memory server name and command.

Paste this JSON and replace the key and library id:

{
  "mcpServers": {
    "answer-engine": {
      "command": "npx",
      "args": ["answer-engine-mcp"],
      "env": {
        "ANSWER_ENGINE_API_KEY": "ae_live_your_key_here",
        "ANSWER_ENGINE_API_URL": "https://engine.answeragent.ai",
        "ANSWER_ENGINE_LIBRARY": "your-library-id"
      }
    }
  }
}

The command is intentionally npx with answer-engine-mcp as the argument. The install command you can run directly for a smoke test is:

npx answer-engine-mcp

When Claude Code launches the server, it passes the environment variables from the config. ANSWER_ENGINE_API_URL must point at https://engine.answeragent.ai; do not use older snippets that point at a stale API host.

What output should you expect after restart?

After you save the config, restart Claude Code in the project. The first run may take a moment while npx resolves the package. Then use /mcp inside Claude Code, or run the relevant MCP status command for your scope, and look for this shape:

answer-engine
status: connected
command: npx answer-engine-mcp
api: https://engine.answeragent.ai
library: your-library-id
tools: search_content, get_content, list_tags, summarize_collection, ask, save_content, append_memory

If you run the server command directly in a terminal, the stdio server writes startup status to stderr:

Answer Engine MCP server started

That direct terminal smoke test only proves the local process starts. The real verification is in Claude Code: the server should show as connected, and Claude should be able to see Answer Engine tools after you approve the server. Claude Code’s troubleshooting section is useful if a server starts but exposes no tools or has a missing environment variable (Claude Code MCP quickstart).

How do you test that Claude can remember something?

Use a small, boring fact first. Ask Claude Code to save a memory that has a clear source and then ask it to retrieve that fact in a new session. For example:

Save this project memory in Answer Engine: the staging API host for this repo is staging.example.internal. Source: local setup note from June 20, 2026.

Then restart Claude Code and ask:

Use Answer Engine memory to find the staging API host for this repo.

You are checking the wiring, not trying to prove a benchmark. A good result names the remembered fact and points back to the source text or saved memory item. If Claude answers from its own guess instead of calling the MCP server, explicitly ask it to use the answer-engine MCP server for the test.

Why use MCP instead of another Claude-only memory feature?

MCP keeps the memory layer outside the client. Claude Code is one excellent surface for a coding workflow, but the memory should not be trapped inside one agent. The MCP introduction describes a client-server model where applications connect to external systems through a common protocol (Model Context Protocol introduction). That is the portability argument: one Answer Engine memory library can be exposed through MCP to more than one client.

That matters for teams because agent clients change faster than source systems. You might use Claude Code for repository work, Cursor for day-to-day editing, and Codex for another automation path. The memory layer should stay consistent across those clients so the organization does not create separate memory silos.

The same server works in Cursor and Codex too — no lock-in. Use the sibling guide, Add persistent memory to Cursor, when you want the .cursor/mcp.json version of this setup.

What should you avoid when configuring memory?

Avoid three common mistakes.

First, do not paste a real ae_live_ key into a shared repository. If you commit .mcp.json, use placeholders or environment-variable expansion and document how each developer provides the secret locally.

Second, do not use stale hosts. Every Answer Engine config in this guide uses https://engine.answeragent.ai, and hosted HTTP MCP references should use https://engine.answeragent.ai/mcp. Older examples that use another host should be treated as outdated.

Third, do not treat memory as an unreviewed dump of every chat. Persistent memory is useful when it has scope, source, and lifecycle metadata. The broader Agent Memory guide explains why memory needs a write path, source lineage, supersession handling, and deletion posture instead of just a larger prompt.

How do you generate the config instead of hand-editing it?

Use the MCP setup generator. Pick Claude Code, enter the library id, optionally paste the site you plan to ingest, and copy the generated config. The generator emits the same JSON shape shown here and keeps the host fixed to https://engine.answeragent.ai.

The site field is only a setup note on the public generator. Actual web ingest still runs through the product’s verified Firecrawl-backed scrape and crawl path after you connect sources. Keeping generation and ingest separate makes the config safe to use before you have signed in or minted a real long-lived key.

Which sources support this setup?

Fig. 9 FAQPage schema / visible answers
FIG. 9

FAQ

What is the fastest way to add persistent memory to Claude Code?

Create a scoped Answer Engine API key, add the Answer Engine MCP server to Claude Code with npx answer-engine-mcp, and restart Claude Code so the tools load.

Does this Claude Code memory setup lock me into Claude?

No. The same MCP server configuration shape works in Cursor and other MCP clients, so the memory layer can move with the agent workflow.

Which host should the config use?

Use https://engine.answeragent.ai for the API base URL and https://engine.answeragent.ai/mcp for hosted HTTP MCP references.

Can I commit this Claude Code MCP config?

You can commit a project-scoped .mcp.json only if it uses environment-variable placeholders and does not contain a real API key.

NEXT

Build memory you can inspect.

Answer Engine gives agents a persistent, tenant-isolated memory layer via MCP, with source-aware recall and roadmap-labeled inspection work.