Skip to main content
Glama
agentcore-memory-mcp

agentcore-memory-mcp

by htuann

agentcore-memory-mcp

An MCP server that gives AI agents long-term memory stored in Amazon Bedrock AgentCore Memory. Every agent or machine that points at the same memory shares what it knows.

It supports two ways to save memory:

  • Exact text (memory_store): your words are stored unchanged, with optional tags.

  • Extracted memory (memory_store_session): you send a conversation, and AgentCore turns it into facts, user preferences and a session summary in the background.

Tools

Tool

What it does

memory_store(content, conversation_id, metadata)

Saves text exactly as written. Tags go in metadata.tags.

memory_store_session(turns, session_id)

Sends a chat for background extraction. Takes about a minute to appear.

memory_search(query, tags, after, before, limit, memory_type)

Semantic search, best match first.

memory_list(page, page_size, tags, memory_type)

Lists memories, newest first.

memory_delete(content_hash, tags, tag_match, before, after, dry_run)

Deletes by id or by filter. At least one filter is required.

memory_update(content_hash, updates, preserve_timestamps)

Changes the text and/or tags.

content_hash is the AgentCore record id. memory_type is facts, prefs, summaries or manual (the exact-text records). Every tool replies with JSON, and bad input comes back as {"error": "..."} and not as an exception.

Related MCP server: clude-memory

Setup

You need Python 3.12 or newer and AWS credentials that can use AgentCore Memory.

  1. Install:

    pip install -e .
  2. Create the memory once. infra/memory.json defines three strategies (facts, summaries, preferences) and their namespaces:

    aws bedrock-agentcore-control create-memory --cli-input-json file://infra/memory.json

    Wait until aws bedrock-agentcore-control get-memory --memory-id <id> shows ACTIVE. Note the memory id and the id of the facts strategy from its output.

  3. Configure the server with environment variables:

    Variable

    Required

    Meaning

    AGENTCORE_MEMORY_ID

    yes

    Id from step 2

    AGENTCORE_FACTS_STRATEGY_ID

    yes

    Id of the facts strategy

    AGENTCORE_ACTOR_ID

    yes

    Who the memories belong to: letters, digits, _, -

    AWS_REGION or AGENTCORE_REGION

    yes

    Region of the memory

    AGENTCORE_NAMESPACE_ROOT

    no

    Default /memory. Must match infra/memory.json.

  4. Register it with your MCP client. See examples/mcp_config.json.

How it stores things

  • An AgentCore record has no tag field and allows only one namespace. Tags on exact-text records are kept in a [tags: a, b] footer in the stored text, and removed when read.

  • Exact-text records live under <root>/facts/<actor>/manual, so searching facts finds them too.

  • Reads are eventually consistent for a few seconds after a write.

  • memory_list and bulk delete read every record. They raise an error past 20,000 records and do not silently truncate. Use memory_type or tags to narrow.

Permissions

The server needs these actions on the memory resource: CreateEvent, RetrieveMemoryRecords, ListMemoryRecords, GetMemoryRecord, BatchCreateMemoryRecords, BatchUpdateMemoryRecords and DeleteMemoryRecord (prefix each with bedrock-agentcore:). Check the names against the AWS service authorization reference before you write a policy. Grant only these on the one memory.

Do not store secrets or regulated data in the memory unless your own policies allow it. The actor id is part of every namespace path, so use a different actor id for each person who shares a memory.

Costs

AgentCore Memory is a paid AWS service, and extraction uses a model. Check current pricing, and set an AWS Budget before you load data.

Development

pip install -e ".[dev]"
pytest -q            # offline, uses a fake AWS API
mypy --strict src
black --check src tests examples

examples/live_smoke.py runs the whole tool set against a real memory. It writes one record and deletes it.

Limits

  • No export, import or deduplication tools.

  • One memory and one actor per server process.

  • Semantic search quality and extraction behavior come from AgentCore, not this code.

License

MIT. See LICENSE.

Available Tools

6 tools
memory_deleteA

Delete one memory by content_hash, or all that match tags and dates.

At least one filter is required. With dry_run true, nothing is deleted and the matches are listed.

Inputs: tags, after, before, dry_run, +2 more. Returns: result

memory_listB

List memories, newest first. memory_type is facts, prefs, summaries or manual.

Inputs: page, tags, page_size, memory_type. Returns: result

memory_storeA

Store text exactly as written. Put tags in metadata, as {"tags": ["a", "b"]}.

Use memory_store_session instead when you want facts extracted from a chat.

Inputs: content (required), metadata, conversation_id. Returns: result

memory_store_sessionB

Send a conversation to be turned into facts, preferences and a summary.

turns is a list of {"role": "user" or "assistant", "content": "..."}. Extraction runs in the background and takes about a minute. Tags and metadata are ignored: extracted memories cannot carry them.

Inputs: turns (required), session_id (required), tags, metadata. Returns: result

memory_updateC

Change a memory. updates may hold content (new text) and tags (new tag list).

Tags may also be given as {"metadata": {"tags": [...]}}. Passing tags replaces the existing ones.

Inputs: updates (required), content_hash (required), preserve_timestamps. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 6 tools

    Disambiguation4/5

    Each tool maps to a distinct operation (store raw, store from session, search, list, delete, update), and the descriptions explicitly disambiguate the closest pair (memory_store vs memory_store_session). The only residual confusion is memory_list vs memory_search for retrieval and how memory_update identifies its target.

    Naming Consistency5/5

    All names follow the same memory_<verb> snake_case convention with a consistent shared prefix. memory_store_session is a natural extension rather than a deviation.

    Tool Count5/5

    Six tools is well-scoped for a memory service: write paths, read paths, mutation, and deletion. No obviously redundant or missing surface-level tool.

    Completeness4/5

    The lifecycle is essentially covered: store, ingest session, search, list, update, delete (with dry_run). Minor gaps: memory_update does not state how the target memory is identified, and there is no dedicated get-by-hash tool, though search/list partially compensate.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides AI agents with persistent, searchable long-term memory across sessions, enabling storage, full-text retrieval, updates, GDPR-compliant deletion, session summaries, and cross-referencing with per-namespace isolation.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to store, recall, update, delete, and analyze persistent memories with semantic search, decay, and anomaly retrieval across hosted, self-hosted, or fully local storage modes.
      80 npm
      23
      MIT