Claude Code plugin
Install the agentmemory plugin to connect Claude Code to Agent Memory over MCP with two environment variables.
The agentmemory plugin packages the remote MCP connection for Claude Code. Once installed, Claude Code has the Agent Memory tools (search_memory, add_memory, consolidate, report_outcome and the rest) and receives the server's memory-usage instructions on every session.
The plugin is a thin wrapper: it registers one HTTP MCP server named agent-memory and reads its URL and API key from your environment. It holds no code of its own.
Install
Set the environment variables
export AGENT_MEMORY_API_KEY="amk_..."
# Only for a self-hosted deployment:
# export AGENT_MEMORY_URL="https://memory.example.internal/v1/mcp"| Variable | Default | Notes |
|---|---|---|
AGENT_MEMORY_URL | https://memory.empecta.com/v1/mcp | The full MCP endpoint URL, including /v1/mcp (or /v1/workspaces/<id>/mcp). |
AGENT_MEMORY_API_KEY | — | A workspace API key, sent as Authorization: Bearer …. |
Set them in the shell that launches Claude Code (or your shell profile) so the plugin's configuration can expand them.
Add the marketplace
The plugin lives in its own public repository, erkansezgin/agentmemory-claude-plugin. In Claude Code, add it as a marketplace:
/plugin marketplace add erkansezgin/agentmemory-claude-pluginor from a local clone:
/plugin marketplace add /path/to/agentmemory-claude-pluginInstall the plugin
/plugin install agentmemory@agentmemoryRestart Claude Code if prompted, then run /mcp to check that agent-memory is connected.
What it configures
The plugin's MCP configuration is equivalent to:
{
"agent-memory": {
"type": "http",
"url": "${AGENT_MEMORY_URL:-https://memory.empecta.com/v1/mcp}",
"headers": {
"Authorization": "Bearer ${AGENT_MEMORY_API_KEY}"
}
}
}If you prefer not to use a plugin, the same connection is one command:
claude mcp add --transport http agent-memory "$AGENT_MEMORY_URL" \
--header "Authorization: Bearer $AGENT_MEMORY_API_KEY"Tips
- Pick the key's agent binding deliberately. Create the key with a dedicated agent ID such as
claude-code, so memories written from Claude Code are attributed to it. The tools never need anagentIdargument unless the key is bound to several agents. - Scope per project. Point different projects at different workspaces (separate keys) or at application-scoped keys, so each codebase recalls its own decisions plus the shared workspace pool. See Scoping.
- Reinforce the loop. Claude Code receives the server's usage protocol automatically. For extra reliability, add the memory rule from the MCP guide to your project's
CLAUDE.md. - Keys stay out of the repo. The plugin only references environment variables; never commit an
amk_key.