feat: Add persistent memory example using Dakera MCP — addresses long-term memory gap (#12)
Author: ferhimedamineCreated Jul 1, 2026Updated Jul 3, 2026
Context
Issue #12 ("Long-term memory support") has been open since January 2025. The current 15 use-case examples in examples/usecases/ all use ephemeral context — nothing survives across agent restarts.
Proposal
Add examples/usecases/persistent_memory_agent/ demonstrating cross-session memory with Dakera — a self-hosted MCP-compatible memory server (@dakera-ai/dakera-mcp on npm, 14 tools).
Files
mcp_agent.config.yaml
$schema: ../../../schema/mcp-agent.config.schema.json
execution_engine: asyncio
logger:
transports: [console, file]
level: info
path_settings:
path_pattern: "logs/memory-agent-{unique_id}.jsonl"
unique_id: "timestamp"
timestamp_format: "%Y%m%d_%H%M%S"
mcp:
servers:
dakera:
transport: stdio
command: "uvx"
args: ["dakera-mcp"]
env:
DAKERA_API_URL: "${DAKERA_API_URL}"
DAKERA_API_KEY: "${DAKERA_API_KEY}"
fetch:
command: "uvx"
args: ["mcp-server-fetch"]
anthropic:
default_model: claude-sonnet-4-5main.py
"""Persistent memory agent using Dakera MCP.
Demonstrates cross-session memory: run this script twice and the agent
remembers what it learned in the first run.
Prereq: docker run -p 3000:3000 -e DAKERA_API_KEY=demo dakera/dakera:latest
"""
import asyncio
from mcp_agent.app import MCPApp
from mcp_agent.agents.agent import Agent
from mcp_agent.workflows.llm.augmented_llm_anthropic import AnthropicAugmentedLLM
app = MCPApp(name="persistent_memory_agent")
async def run_research_phase():
"""Phase 1: Research and persist findings to Dakera."""
async with app.run() as mcp_app:
agent = Agent(
name="memory_researcher",
instruction="""You are a research assistant with persistent memory.
When you learn something new, store it using dakera_store.
When answering questions, first check your memory with dakera_recall.""",
server_names=["dakera", "fetch"],
)
async with agent:
llm = await agent.attach_llm(AnthropicAugmentedLLM)
result = await llm.generate_str(
"Research the top 3 use cases for agentic AI in 2025. "
"Store each finding as a separate memory entry using dakera_store.",
)
print(f"[Phase 1 complete] {result[:200]}...")
async def run_recall_phase():
"""Phase 2: Start a fresh agent — it can recall what Phase 1 stored."""
async with app.run() as mcp_app:
agent = Agent(
name="memory_reader",
instruction="You are an assistant. Use dakera_recall to check your memory before answering.",
server_names=["dakera"],
)
async with agent:
llm = await agent.attach_llm(AnthropicAugmentedLLM)
result = await llm.generate_str(
"What do you know about agentic AI use cases? Check your memory first.",
)
print(f"[Phase 2 recall] {result}")
if __name__ == "__main__":
asyncio.run(run_research_phase())
print("\n--- Simulating new agent session ---\n")
asyncio.run(run_recall_phase())README.md
Explains the three memory tiers from issue #12:
- Short-term: mcp-agent
Contextobject (in-process, ephemeral) - Session memory: Dakera
dakera_store/dakera_session_start - Long-term recall: Dakera
dakera_recall(semantic search, decay-weighted)
Why Dakera for this example
uvx dakera-mcp— zero config startup, no API keys needed for local dev- 14 MCP tools:
dakera_store,dakera_recall,dakera_search,dakera_session_start,dakera_extract_entities,dakera_knowledge_graph, etc. - Self-hosted — no external service required, data stays local
- Directly closes the feature request in #12
Happy to submit this as a PR.
Source: lastmile-ai/mcp-agent