# Quickstart

Get the Agent Stash MCP server running in Claude Code or Cursor in five minutes.

## Step 1: Get an API key

Sign in at [agentstash.ai](https://agentstash.ai) with GitHub to get a free API key. Your key starts with `sk_`.

Or register headlessly:

```
POST https://agentstash.ai/register/agent
Content-Type: application/json

{"agent_name": "my-project"}
```

## Step 2: Install the MCP server

```bash
npx @agentstash/mcp
```

Or add it to your MCP config directly:

**Claude Code** (`~/.claude/settings.json`):
```json
{
  "mcpServers": {
    "agent-stash": {
      "command": "npx",
      "args": ["@agentstash/mcp"],
      "env": {
        "AGENT_STASH_API_KEY": "sk_your_key_here"
      }
    }
  }
}
```

**Cursor** (`.cursor/mcp.json` in your project):
```json
{
  "mcpServers": {
    "agent-stash": {
      "command": "npx",
      "args": ["@agentstash/mcp"],
      "env": {
        "AGENT_STASH_API_KEY": "sk_your_key_here"
      }
    }
  }
}
```

## Step 3: Use it

The MCP server auto-detects your project from the git remote URL and namespaces all memory under it. No configuration needed.

**Remember a decision:**
```
remember("auth-approach", "Using session cookies, not JWT. Decided 2025-05-21 after ADR-003.")
```

**Recall it in a new session:**
```
recall("auth-approach")
```

**Save progress before a risky refactor:**
```
save_progress(
  task="Migrate auth from JWT to session cookies",
  completed_steps=["Updated login endpoint", "Updated logout endpoint"],
  next_step="Update middleware to validate session instead of JWT",
  decisions=["Keep JWT for service-to-service, session for browser"],
  files_touched=["app/auth.py", "app/middleware.py"]
)
```

**Resume in a new session:**
```
resume_progress()
```

## Available tools

| Tool | When to use |
|------|-------------|
| `remember(key, value)` | After a meaningful decision or completion |
| `recall(key)` | At session start to load context |
| `list_memories(prefix?)` | To discover what's stored |
| `forget(key)` | To delete a memory |
| `save_progress(...)` | Before risky work or when context is full |
| `resume_progress()` | At session start when continuing prior work |
| `log_event(event, details?)` | To write to the project audit log |
| `read_log(limit?)` | To see what happened in prior sessions |
| `find_memory(query)` | To search memory keys by name |

## Next steps

- [Full API reference](/docs/getting-started) — Use the REST API directly without the MCP server
- [Progress Files pattern](/docs/progress-files) — Deeper guide to session continuity
- [Cross-model coordination](/docs/cross-model-coordination) — Share memory between different AI tools
