MCP Server
Fallback real-time access for agents that need more than static configs.
The primary way to use memories.sh is the CLI — memories generate writes native config files that each tool reads natively. For browser-based agents (v0, bolt.new, Lovable) or any MCP client where the CLI can't run, the built-in MCP server provides real-time access.
If you are building a SaaS app and already using SDK endpoints (/api/sdk/v1/*), you usually do not need MCP.
Use MCP when your product must serve MCP-native clients directly.
Quick Install
Add memories.sh to your AI assistant. You'll need an API key from the dashboard.
When to Use the MCP Server
Use memories generate first. The MCP server is useful when:
- Browser-based agents — v0, bolt.new, Lovable, and other tools where the CLI can't run
- Agents need to add new memories during a conversation
- You want live search without regenerating files
- You want both — generated files for rules, MCP for real-time context
Cloud MCP (Recommended)
For signed-up users, the easiest way to connect is via our hosted MCP endpoint. This works with any tool that supports HTTP-based MCP.
1. Generate an API Key
Get your API key from the API Keys dashboard page or run:
memories login2. Configure Your Tool
See the MCP Integration Guide for tool-specific setup instructions, including:
- Cursor — One-click install or manual config
- Claude Code — CLI command
- Claude Desktop — Config file
- Windsurf — Config file
- VS Code — Config file
- v0 / Web Tools — Paste endpoint URL
Cloud MCP syncs memories across all your devices and doesn't require the CLI to be running locally.
Local MCP (Self-Hosted)
For local-only use or self-hosted setups, run the MCP server locally via stdio:
memories serveConfigure your tool to spawn the local server:
{
"mcpServers": {
"memories": {
"command": "npx",
"args": ["-y", "@memories.sh/cli", "serve"]
}
}
}The local server communicates over stdio and logs diagnostic information to stderr.
Available Tools and Resources
The MCP server exposes:
- 9 hosted core tools on
https://memories.sh/api/mcpfor reading, writing, searching, and managing memories - 5 additional local lifecycle tools (
start_session,checkpoint_session,end_session,snapshot_session,consolidate_memories) when runningmemories serve - 6 local reminder tools (
add_reminder,list_reminders,run_due_reminders,enable_reminder,disable_reminder,delete_reminder) when runningmemories serve - 4 local streaming tools (
start_memory_stream,append_memory_chunk,finalize_memory_stream,cancel_memory_stream) when runningmemories serve - 3 resources — for accessing rules, recent memories, and project-specific data
See the Tools Reference, Resources Reference, and Tenant Routing for complete documentation.
Lifecycle-Aware MCP Pattern
For long sessions, treat MCP reads/writes as a lifecycle sequence instead of one-off calls:
start_session(local CLI MCP) to open a tracked session.get_contextwithsession_id+ compaction hints (budget_tokens,turn_count,turn_budget, inactivity fields).- If compaction is signaled, call
checkpoint_sessionbefore boundary operations. - On reset/handoff boundaries, persist a raw transcript slice via
snapshot_session. end_sessionwhen the task closes.
The hosted MCP endpoint focuses on tenant-routed core memory tools. Local lifecycle tools are exposed when running memories serve.