# Persistent Memory for Claude Desktop

Add persistent, encrypted memory to Claude Desktop using MCP.
Memories survive across sessions — Claude remembers what you told it yesterday.

**Docs**: https://synapselayer.org/docs  
**Smithery**: https://smithery.ai/server/synapselayer/synapse-protocol

---

## Prerequisites

- Python 3.10+
- Claude Desktop installed
- A Synapse Layer API key (`sk_live_...`) — get one free at [forge.synapselayer.org](https://forge.synapselayer.org)

## Installation

```bash
pip install synapse-layer
```

Verify the installation:

```bash
python -c "import synapse_layer; print(synapse_layer.__version__)"
```

## Claude Desktop Configuration

Open your Claude Desktop MCP configuration file:

- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`

Add the Synapse Layer MCP server:

```json
{
  "mcpServers": {
    "synapse-layer": {
      "command": "python",
      "args": ["-m", "synapse_layer.mcp"],
      "env": { "SYNAPSE_API_KEY": "your-api-key-here" }
    }
  }
}
```

Replace `your-api-key-here` with your actual `sk_live_...` key.

Restart Claude Desktop after saving.

## Testing the Connection

Open Claude Desktop and type:

> "Remember that my favorite programming language is Python and I work at Acme Corp."

Claude should confirm the memory was stored. Then start a **new conversation** and ask:

> "What's my favorite programming language?"

If Claude responds with "Python" — persistent memory is working.

## Example Prompts to Test Memory

| Prompt | What it tests |
|--------|---------------|
| "Remember I prefer dark mode." | Basic memory storage |
| "What do you remember about me?" (new session) | Cross-session recall |
| "Forget that I work at Acme Corp." | Memory deletion |
| "Remember: project deadline is July 15." | Structured context |
| "What's my project deadline?" (new session) | Semantic recall |

## Troubleshooting

### 1. "MCP server not found" error

Make sure `synapse-layer` is installed in the Python environment that Claude Desktop uses. Try:

```bash
which python
python -m synapse_layer.mcp --help
```

If using a virtual environment, provide the full path in `command`:

```json
{
  "command": "/Users/you/.venv/bin/python",
  "args": ["-m", "synapse_layer.mcp"]
}
```

### 2. "Authentication failed" error

Verify your API key:

```bash
curl -H "Authorization: Bearer sk_live_..." https://synapselayer.org/api/v1/health
```

You should see `{"status": "ok"}`. If not, generate a new key at [forge.synapselayer.org](https://forge.synapselayer.org).

### 3. Memories not persisting across sessions

Check that the MCP server is running (look for the green indicator in Claude Desktop settings). If the server crashes silently, check logs:

```bash
python -m synapse_layer.mcp 2>&1 | head -20
```

---

**Next**: [Cross-Agent Memory](./03-cross-agent-memory.py) — share memories between different agents.
