# Claw Store MCP Server

A local MCP (Model Context Protocol) server that gives Claude Desktop, Cursor, Windsurf,
and any other MCP-compatible AI tool access to **Claw Store** — decentralized, encrypted
memory backed by Jackal Protocol.

Encryption keys never leave your machine. The Railway API never sees plaintext.

---

## What it does

| Tool | Description |
|------|-------------|
| `save_memory` | Encrypts content locally, uploads to Jackal via the Claw Store API |
| `load_memory` | Downloads from Jackal, decrypts locally |
| `get_usage` | Shows storage quota (bytes used / total) |

---

## Prerequisites

1. **Python 3.11+**
2. A **Claw Store API key** — sign in at https://web-production-5cce7.up.railway.app/auth/login

---

## Installation

```bash
cd MCP_Server-Dev
pip install -e .
```

Or without editable install:

```bash
pip install mcp cryptography
```

---

## Claude Desktop setup

Edit `~/AppData/Roaming/Claude/claude_desktop_config.json` (Windows) or
`~/Library/Application Support/Claude/claude_desktop_config.json` (macOS):

```json
{
  "mcpServers": {
    "claw-store": {
      "command": "python",
      "args": ["-m", "claw_store_mcp"],
      "env": {
        "JACKAL_MEMORY_API_KEY": "your-api-key-here"
      }
    }
  }
}
```

Restart Claude Desktop. You should see **claw-store** in the MCP tools panel.

### Optional: pin your encryption key

On first use, an AES-256 key is auto-generated at `~/.config/jackal-memory/key`.
To use the same key on multiple machines, copy that hex string into the env block:

```json
"JACKAL_MEMORY_ENCRYPTION_KEY": "abc123..."
```

---

## Cursor / Windsurf setup

Add to your IDE's MCP server config (exact location varies by tool):

```json
{
  "claw-store": {
    "command": "python",
    "args": ["-m", "claw_store_mcp"],
    "env": {
      "JACKAL_MEMORY_API_KEY": "your-api-key-here"
    }
  }
}
```

---

## Manual test

```bash
JACKAL_MEMORY_API_KEY=your-key python -m claw_store_mcp
```

The process should start silently (it speaks MCP over stdio). Use `Ctrl-C` to exit.

---

## Cross-compatibility with the OpenClaw skill

The MCP server uses the same encryption key file (`~/.config/jackal-memory/key`) and
the same ciphertext format as the OpenClaw `claw_store` skill. Memories saved via MCP
are loadable by the skill, and vice versa — as long as both run on the same machine
(or share the encryption key via `JACKAL_MEMORY_ENCRYPTION_KEY`).

---

## File locations

| File | Purpose |
|------|---------|
| `~/.config/jackal-memory/key` | AES-256 encryption key (hex) |
| `~/.config/jackal-memory/jackal-mnemonic` | BIP39 wallet mnemonic (generated on first save) |
