memories.sh logomemories.sh
MCP Server

Tools Reference

Complete reference for all MCP tools exposed by the memories.sh server.

The hosted memories.sh MCP endpoint exposes 9 tenant-routed core tools. The local CLI MCP server (memories serve) extends that surface with 5 lifecycle tools, 6 reminder tools, and 4 streaming tools.

SaaS apps that already call SDK endpoints (/api/sdk/v1/*) do not need these MCP tools unless they serve MCP-native clients.

Scope model for MCP arguments:

  • tenant_id = AI SDK Project (security/database boundary)
  • user_id = end-user scope inside tenant_id
  • project_id = optional repo context filter (not auth boundary)

Availability notes:

  • Hosted MCP (https://memories.sh/api/mcp) supports the tenant-routed core toolset documented here.
  • Local CLI MCP (memories serve) includes additional lifecycle, reminder, and streaming tools.

get_context

The primary tool for AI agents. Returns all active rules (with path and category metadata) plus memories relevant to an optional search query.

ParameterTypeRequiredDescription
querystringNoSearch query to find relevant memories
project_idstringNoProject identifier (e.g., github.com/user/repo) as an optional repo context filter
user_idstringNoEnd-user scope identifier inside tenant_id
tenant_idstringNoAI SDK Project identifier for security/database routing
limitnumberNoMax memories to return (default: 5)
retrieval_strategystringNoHosted MCP graph strategy: baseline or hybrid_graph
graph_depthnumberNoHosted MCP graph traversal depth (0, 1, 2)
graph_limitnumberNoHosted MCP max graph-expanded memories
modestringNoLocal CLI only: all, working, long_term, rules_only
session_idstringNoLocal CLI only: session identifier for lifecycle-aware retrieval
budget_tokensnumberNoLocal CLI only: context token budget hint
turn_countnumberNoLocal CLI only: current turn count
turn_budgetnumberNoLocal CLI only: turn-count budget
last_activity_atstringNoLocal CLI only: ISO timestamp for inactivity-trigger checks
inactivity_threshold_minutesnumberNoLocal CLI only: inactivity threshold for time-trigger checks
task_completedbooleanNoLocal CLI only: semantic completion hint for checkpointing
include_session_summarybooleanNoLocal CLI only: reserved summary hydration flag
{
  "name": "get_context",
  "arguments": {
    "query": "authentication flow",
    "project_id": "github.com/user/repo",
    "limit": 5
  }
}

Returns all rules first (including path scope and category when set), followed by relevant search results. Uses FTS5 with BM25 ranking for the search query, falling back to LIKE matching for databases without FTS support. When hybrid graph retrieval is enabled, semantically similar memories may be added via graph similar_to edges, and conflict/refinement links may be traversed via contradicts / supersedes edges when LLM extraction is enabled.

When local memories serve callers provide session_id and compaction hints (budget_tokens, turn_budget/turn_count, inactivity fields, or task_completed), get_context may emit a compaction section and perform write-ahead checkpointing before destructive compaction.

If returned memories include contradiction links, the response also includes a conflicts[] array with pair IDs, confidence, explanation text, and a suggestion for clarification.

Example structuredContent conflict payload fragment:

{
  "data": {
    "memories": [
      { "id": "mem_a", "content": "I prefer tea in the afternoon." },
      { "id": "mem_b", "content": "I avoid tea after lunch." }
    ],
    "conflicts": [
      {
        "memoryAId": "mem_a",
        "memoryBId": "mem_b",
        "edgeType": "contradicts",
        "confidence": 0.88,
        "explanation": "These memories are linked by a contradiction edge from relationship extraction.",
        "suggestion": "These memories may conflict. Consider asking the user to clarify which preference is current."
      }
    ],
    "trace": {
      "strategy": "hybrid_graph",
      "conflictCount": 1
    }
  }
}

start_session (local CLI only)

Start a new session for checkpointing and snapshot workflows.

ParameterTypeRequiredDescription
titlestringNoOptional session title
clientstringNoClient label (for example codex, cursor)
user_idstringNoOptional user identifier
metadataobjectNoOptional session metadata object
globalbooleanNoStart as global session
project_idstringNoExplicit project identifier
{
  "name": "start_session",
  "arguments": {
    "title": "Refactor auth middleware",
    "client": "codex",
    "project_id": "github.com/webrenew/memories"
  }
}

checkpoint_session (local CLI only)

Append an event/checkpoint to an active session.

ParameterTypeRequiredDescription
session_idstringYesSession ID
contentstringYesEvent content
rolestringNouser, assistant, or tool (default: assistant)
kindstringNomessage, checkpoint, summary, or event (default: checkpoint)
token_countnumberNoOptional token count for this event
turn_indexnumberNoOptional turn index
is_meaningfulbooleanNoWhether event is meaningful (default: true)
{
  "name": "checkpoint_session",
  "arguments": {
    "session_id": "sess_123",
    "content": "User approved migration strategy",
    "kind": "summary",
    "token_count": 320
  }
}

end_session (local CLI only)

Close a session when task context is complete.

ParameterTypeRequiredDescription
session_idstringYesSession ID
statusstringNoFinal status: closed or compacted (default: closed)
{
  "name": "end_session",
  "arguments": {
    "session_id": "sess_123",
    "status": "compacted"
  }
}

snapshot_session (local CLI only)

Create a raw markdown snapshot from explicit transcript text or recent session events.

ParameterTypeRequiredDescription
session_idstringYesSession ID
source_triggerstringNonew_session, reset, manual, or auto_compaction (default: manual)
slugstringNoOptional snapshot slug
transcript_mdstringNoExplicit transcript markdown
message_countnumberNoEvent count when transcript is generated (default: 15)
meaningful_onlybooleanNoInclude only meaningful events when generating transcript (default: true)
{
  "name": "snapshot_session",
  "arguments": {
    "session_id": "sess_123",
    "source_trigger": "reset",
    "message_count": 15
  }
}

consolidate_memories (local CLI only)

Run consolidation to merge duplicates, supersede stale truths, and write consolidation audit rows.

ParameterTypeRequiredDescription
typesstring[]NoMemory types to include (rule, decision, fact, note, skill)
include_globalbooleanNoInclude global memories (default: true)
global_onlybooleanNoRestrict to global memories only
project_idstringNoExplicit project identifier
dry_runbooleanNoPreview only; do not mutate rows
modelstringNoOptional model identifier for audit metadata
{
  "name": "consolidate_memories",
  "arguments": {
    "types": ["rule", "decision", "fact"],
    "project_id": "github.com/webrenew/memories",
    "dry_run": true
  }
}

add_memory

Store a new memory with optional metadata, path scoping, and categorization.

ParameterTypeRequiredDescription
contentstringYesMemory content
typeenumNorule, decision, fact, note, skill (default: note)
tagsstring[]NoArray of tags
project_idstringNoOptional project/repo context filter (omit for global)
user_idstringNoEnd-user scope identifier inside tenant_id
tenant_idstringNoAI SDK Project identifier for security/database routing
pathsstring[]NoGlob patterns for path-scoped rules
categorystringNoGrouping key (becomes rule filename or skill directory)
metadataobjectNoExtended attributes (JSON object, primarily for skills)
{
  "name": "add_memory",
  "arguments": {
    "content": "Use RESTful naming conventions for all endpoints",
    "type": "rule",
    "paths": ["src/api/**", "src/routes/**"],
    "category": "api"
  }
}

Adding a skill:

{
  "name": "add_memory",
  "arguments": {
    "content": "## Deploy\n\n1. Run tests\n2. Build\n3. Deploy to production",
    "type": "skill",
    "category": "deploy",
    "metadata": {
      "name": "deploy",
      "description": "Deploy the application to production"
    }
  }
}

search_memories

Full-text search across memories with BM25 ranking. Uses FTS5 when available, falling back to LIKE matching.

ParameterTypeRequiredDescription
querystringYesSearch query
project_idstringNoOptional project/repo context filter
user_idstringNoEnd-user scope identifier inside tenant_id
tenant_idstringNoAI SDK Project identifier for security/database routing
typeenumNoFilter by memory type: rule, decision, fact, note, skill
limitnumberNoMax results (default: 10)
{
  "name": "search_memories",
  "arguments": {
    "query": "database schema",
    "project_id": "github.com/user/repo",
    "type": "decision"
  }
}

get_rules

Get all active rules, split by global and project scope.

ParameterTypeRequiredDescription
project_idstringNoOptional project/repo context filter
user_idstringNoEnd-user scope identifier inside tenant_id
tenant_idstringNoAI SDK Project identifier for security/database routing
{
  "name": "get_rules",
  "arguments": {
    "project_id": "github.com/user/repo"
  }
}

list_memories

List recent memories with optional filters.

ParameterTypeRequiredDescription
typeenumNoFilter by type: rule, decision, fact, note, skill
tagsstringNoFilter by tag (substring match — "test" also matches "testing")
project_idstringNoOptional project/repo context filter
user_idstringNoEnd-user scope identifier inside tenant_id
tenant_idstringNoAI SDK Project identifier for security/database routing
limitnumberNoMax results (default: 20)

edit_memory

Update an existing memory's content, type, tags, path scope, or category.

ParameterTypeRequiredDescription
idstringYesMemory ID
contentstringNoNew content
typeenumNoNew type (rule, decision, fact, note, skill)
tagsstring[]NoNew tags
pathsstring[]NoNew glob patterns for path scoping
categorystringNoNew grouping key
metadataobjectNoNew extended attributes
user_idstringNoEnd-user scope identifier inside tenant_id
tenant_idstringNoAI SDK Project identifier for security/database routing
{
  "name": "edit_memory",
  "arguments": {
    "id": "abc123def456",
    "paths": ["src/api/**"],
    "category": "api"
  }
}

forget_memory

Soft-delete a memory by ID.

ParameterTypeRequiredDescription
idstringYesMemory ID to forget
user_idstringNoEnd-user scope identifier inside tenant_id
tenant_idstringNoAI SDK Project identifier for security/database routing

bulk_forget_memories

Bulk soft-delete memories matching filters. Use dry_run: true to preview what would be deleted before committing.

ParameterTypeRequiredDescription
typesstring[]NoFilter by memory types (rule, decision, fact, note, skill)
tagsstring[]NoFilter by tags (substring match — "test" also matches "testing")
older_than_daysintegerNoDelete memories older than N days (must be >= 1)
patternstringNoContent pattern match (* = any chars, ? = single char; matches anywhere in content)
project_idstringNoFilter by project identifier
user_idstringNoEnd-user scope identifier inside tenant_id
tenant_idstringNoAI SDK Project identifier for security/database routing
allbooleanNoDelete all memories (cannot combine with other filters)
dry_runbooleanNoPreview matching memories without deleting (default: false)

Provide at least one filter (types, tags, older_than_days, or pattern), or use all: true. The all flag cannot be combined with other filters.

{
  "name": "bulk_forget_memories",
  "arguments": {
    "types": ["note", "fact"],
    "older_than_days": 90,
    "dry_run": true
  }
}

With dry_run: true, returns a preview with count and memories[] (each with id, type, contentPreview). With dry_run: false, returns count and ids[] of deleted memories. Deletes are batched in groups of 500.

vacuum_memories

Permanently purge all soft-deleted memories to reclaim storage space. This hard-deletes every row where deleted_at IS NOT NULL.

ParameterTypeRequiredDescription
user_idstringNoEnd-user scope identifier inside tenant_id
tenant_idstringNoAI SDK Project identifier for security/database routing
{
  "name": "vacuum_memories",
  "arguments": {}
}

Returns purged (count of permanently removed records) and a message string.

Local CLI Reminder Tools

The reminder tools below are available in the local CLI MCP server (memories serve). They are not part of hosted tenant-routed MCP today.

add_reminder

Create a cron-based reminder.

ParameterTypeRequiredDescription
cron_expressionstringYes5-field cron expression (minute hour day-of-month month day-of-week)
messagestringYesReminder message
globalbooleanNoStore as global reminder
project_idstringNoExplicit project identifier

list_reminders

List reminders in current scope.

ParameterTypeRequiredDescription
include_disabledbooleanNoInclude disabled reminders
project_idstringNoExplicit project identifier

run_due_reminders

Evaluate and emit due reminders.

ParameterTypeRequiredDescription
dry_runbooleanNoPreview due reminders without advancing schedule
project_idstringNoExplicit project identifier

enable_reminder

Enable a reminder and recompute next_trigger_at.

ParameterTypeRequiredDescription
idstringYesReminder ID

disable_reminder

Disable a reminder without deleting it.

ParameterTypeRequiredDescription
idstringYesReminder ID

delete_reminder

Delete a reminder by ID.

ParameterTypeRequiredDescription
idstringYesReminder ID

Local CLI Streaming Tools

Streaming tools are available in local CLI MCP (memories serve) only.

start_memory_stream

Start a stream collector for chunked content.

ParameterTypeRequiredDescription
typestringNoMemory type (rule, decision, fact, note, skill)
tagsstring[]NoTags for the resulting memory
globalbooleanNoStore as global memory
project_idstringNoExplicit project identifier

append_memory_chunk

Append a chunk to an active stream.

ParameterTypeRequiredDescription
stream_idstringYesStream ID from start_memory_stream
chunkstringYesChunk content

finalize_memory_stream

Finalize stream and create the memory.

ParameterTypeRequiredDescription
stream_idstringYesStream ID from start_memory_stream

cancel_memory_stream

Cancel stream and discard buffered chunks.

ParameterTypeRequiredDescription
stream_idstringYesStream ID to cancel

On this page