Skip to content

Memory

Memory MCP maintains a persistent knowledge graph across sessions, enabling Claude to remember decisions, patterns, and preferences over time.

{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
}
}
}

Named items in the knowledge graph (e.g., “AuthService”, “UserModel”).

Facts about entities (e.g., “uses JWT tokens”, “requires database”).

Connections between entities (e.g., “AuthService” → “uses” → “UserRepository”).

ToolDescription
create_entitiesCreate new entities
delete_entitiesRemove entities
open_nodesOpen specific entities by name
search_nodesSearch for entities
ToolDescription
add_observationsAdd facts to entities
delete_observationsRemove observations
ToolDescription
create_relationsLink entities together
delete_relationsRemove links
ToolDescription
read_graphRead entire knowledge graph
/index

Memory stores:

  • Entity: “src/api” — “Contains REST endpoints”
  • Entity: “src/services” — “Business logic layer”
  • Relation: “api” → “depends on” → “services”
/brainstorm Authentication strategy

Memory stores:

  • Entity: “AuthDecision”
  • Observation: “Chose JWT over sessions for scalability”
  • Observation: “User prefers stateless auth”
/fix Race condition in checkout

Memory stores:

  • Entity: “CheckoutBug”
  • Observation: “Caused by async state update”
  • Observation: “Fixed with mutex lock”
CommandHow Memory Helps
/brainstormRemembers design decisions
/planRecalls previous task patterns
/fixStores bug patterns for future reference
/indexPersists project structure

Session 1:

/brainstorm Authentication for mobile app
→ Decision: Use OAuth with refresh tokens
→ Memory stores this decision

Session 2:

/feature Add logout functionality
→ Memory recalls: "Uses OAuth with refresh tokens"
→ Claude knows to invalidate refresh token

Over time:

create_entities(["AuthService", "UserRepository", "TokenManager"])
add_observations("AuthService", [
"Handles OAuth flow",
"Uses refresh tokens",
"Integrates with Google/GitHub"
])
create_relations([
{"from": "AuthService", "to": "TokenManager", "type": "uses"},
{"from": "AuthService", "to": "UserRepository", "type": "queries"}
])

Later query:

search_nodes("auth")
→ Returns full context about authentication architecture

Entity names should be clear and consistent:

  • “AuthService” not “AS”
  • “PaymentFlow” not “pmt”

Include why, not just what:

  • “Uses JWT because stateless scales better”
  • “Chose Postgres for ACID compliance”

Relations should express real dependencies:

  • “depends on”, “uses”, “calls”, “creates”

Use read_graph periodically to review stored knowledge and prune outdated information.

Memory data is stored locally and persists between sessions. The knowledge graph grows over time as you work with Claude Kit.

If the graph becomes unwieldy:

  1. Use search_nodes to find specific entities
  2. Delete outdated entities with delete_entities
  3. Remove stale observations

If Claude doesn’t recall something:

  • Check if entity exists with search_nodes
  • Observations may not have been stored
  • Entity names may differ