memories serve
Start the MCP server (stdio or SSE transport).
memories serve [options]Start the Model Context Protocol (MCP) server. Supports two transport modes:
- stdio (default) — For desktop apps like Cursor, Claude Code
- SSE/HTTP — For web-based tools like v0
Options
| Option | Description | Default |
|---|---|---|
--sse | Use SSE/HTTP transport instead of stdio | false |
-p, --port <port> | Port for SSE server | 3030 |
--host <host> | Host to bind to | 127.0.0.1 |
--cors | Enable CORS for cross-origin requests | false |
Stdio Transport (Default)
For desktop apps that spawn the server as a subprocess:
memories serveThe server communicates via stdin/stdout using the MCP protocol. Diagnostic messages go to stderr.
Auto-Configuration
Run memories init to automatically configure MCP for detected tools:
memories initThis adds the appropriate config to each tool's MCP settings.
Manual Configuration
Add to your tool's MCP config:
{
"mcpServers": {
"memories": {
"command": "npx",
"args": ["-y", "@memories.sh/cli", "serve"]
}
}
}SSE Transport (Local Development)
For local development and testing with web-based tools:
memories serve --sseOutput:
[memories] Starting MCP server with SSE transport
[memories] Listening on http://127.0.0.1:3030
[memories] Connect v0 or other clients to: http://127.0.0.1:3030/mcpExamples
# Local development
memories serve --sse
# Custom port
memories serve --sse --port 8080
# Enable CORS for browser clients
memories serve --sse --corsEndpoints
| Endpoint | Description |
|---|---|
GET/POST /mcp | MCP Streamable HTTP endpoint |
GET /health | Health check (returns {"status":"ok"}) |
For production use with v0 and web tools, use the hosted endpoint at https://memories.sh/api/mcp with an API key from your dashboard. See the v0 integration guide.
Available Tools
The MCP server exposes these tools:
| Tool | Description |
|---|---|
get_context | Get rules and relevant memories (primary tool) |
add_memory | Store a memory (global: true or project_id override) |
search_memories | Full-text or semantic search |
get_rules | Get all active rules |
list_memories | List recent memories |
edit_memory | Update a memory |
forget_memory | Soft-delete a memory |
bulk_forget_memories | Bulk soft-delete memories matching filters |
vacuum_memories | Permanently purge soft-deleted memories |
add_reminder | Create a cron-based reminder |
list_reminders | List reminders |
run_due_reminders | Evaluate and emit due reminders |
enable_reminder | Enable a reminder |
disable_reminder | Disable a reminder |
delete_reminder | Delete a reminder |
When your MCP client runs outside the target repo, pass project_id to force project scope:
{
"name": "add_memory",
"arguments": {
"content": "Use backoff for transient failures",
"type": "rule",
"project_id": "github.com/webrenew/agent-space"
}
}Use global: true for global memories. Do not send both global and project_id.
Available Resources
| Resource | Description |
|---|---|
memories://rules | All active rules |
memories://recent | 20 most recent memories |
memories://project/{projectId} | All memories for a specific project |
Config Locations by Tool
| Tool | Config Location | Transport |
|---|---|---|
| Cursor | .cursor/mcp.json | stdio |
| Claude Code | .mcp.json | stdio |
| Windsurf | .windsurf/mcp.json | stdio |
| VS Code | .vscode/mcp.json | stdio |
| v0 | MCP settings | SSE |
Security Note
The SSE server exposes your memories over HTTP. Only bind to 127.0.0.1 (default) unless using a tunnel with authentication.
See the v0 integration guide for security best practices when exposing the server remotely.