> ## Documentation Index
> Fetch the complete documentation index at: https://docs.starlight-search.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Server

> Connect Reflect memory tools to Cursor, Claude Code, Windsurf, and any MCP-compatible client.

<Tip>
  Just want to wire up an MCP client quickly? See [For AI Agents](/for-agents#mcp-server) for a 2-minute quickstart with all the major IDE configs in one place. This page is the deep-dive reference.
</Tip>

The Reflect MCP server exposes two tools — `retrieve_memories` and `create_memory` — over the [Model Context Protocol](https://modelcontextprotocol.io). Connect it to any MCP-capable agent or IDE and your AI assistant will automatically query past lessons before hard tasks and record new ones after each run.

**MCP endpoint:** `https://api.starlight-search.com/mcp`\
**Auth:** `Authorization: Bearer <your-api-key>`\
**Transport:** Streamable HTTP

Get your API key from the [Reflect console](https://reflect.starlight-search.com).

***

## Claude Code

Add the server to your project or global config:

```bash theme={null}
claude mcp add --transport http reflect https://api.starlight-search.com/mcp \
  --header "Authorization: Bearer rf_live_..."
```

Or add it manually to `.claude/settings.json` (project) or `~/.claude/settings.json` (global):

```json theme={null}
{
  "mcpServers": {
    "reflect": {
      "type": "http",
      "url": "https://api.starlight-search.com/mcp",
      "headers": {
        "Authorization": "Bearer rf_live_..."
      }
    }
  }
}
```

Verify it loaded:

```bash theme={null}
claude mcp list
```

***

## Cursor

Open **Settings → MCP** (or `~/.cursor/mcp.json`) and add:

```json theme={null}
{
  "mcpServers": {
    "reflect": {
      "type": "http",
      "url": "https://api.starlight-search.com/mcp",
      "headers": {
        "Authorization": "Bearer rf_live_..."
      }
    }
  }
}
```

Restart Cursor. The tools appear in Agent mode automatically.

***

## Windsurf

Open **Settings → Cascade → MCP Servers** and add a new server:

```json theme={null}
{
  "reflect": {
    "serverUrl": "https://api.starlight-search.com/mcp",
    "headers": {
      "Authorization": "Bearer rf_live_..."
    }
  }
}
```

***

## Cline / Continue / other MCP clients

Any client that supports streamable HTTP transport uses the same config pattern:

```json theme={null}
{
  "mcpServers": {
    "reflect": {
      "type": "http",
      "url": "https://api.starlight-search.com/mcp",
      "headers": {
        "Authorization": "Bearer rf_live_..."
      }
    }
  }
}
```

***

## Per-project scoping with X-Project-Id

By default the server uses the project ID configured on your API key. To scope memories to a specific project per-request, pass the `X-Project-Id` header:

```json theme={null}
{
  "headers": {
    "Authorization": "Bearer rf_live_...",
    "X-Project-Id": "my-project"
  }
}
```

***

## Available tools

### `retrieve_memories`

Search the memory store for lessons from prior tasks. Call this **before** starting non-trivial work.

| Parameter | Type   | Default  | Description                                                                 |
| --------- | ------ | -------- | --------------------------------------------------------------------------- |
| `query`   | string | required | Natural-language description of the task you are about to do                |
| `limit`   | int    | 5        | Max memories to return (up to 20)                                           |
| `lambda_` | float  | 0.5      | Blend between semantic similarity (1.0) and Q-value / learned utility (0.0) |

Returns a list of memories with `id`, `task`, `reflection`, `q_value`, `similarity`, `score`, and `success`. Save the `memory_ids` — you'll pass them to `create_memory`.

### `create_memory`

Persist a memory the agent **writes itself**. You author the reflection (`summary` + `guidance`) from what you just did and submit it with a pass/fail `result` — Reflect stores it directly, with no trajectory and no background model. Call this **after** the user confirms success or gives corrective feedback.

| Parameter              | Type                 | Default  | Description                                                    |
| ---------------------- | -------------------- | -------- | -------------------------------------------------------------- |
| `task`                 | string               | required | The task the agent was executing (embedded for retrieval)      |
| `summary`              | string               | required | One-line lesson from the run, written by you                   |
| `guidance`             | string               | required | Actionable guidance a future run should follow, written by you |
| `result`               | `"pass"` or `"fail"` | required | Outcome — drives the reward signal                             |
| `key_mistake`          | string               | optional | What went wrong (mainly meaningful on a `fail`)                |
| `correct_action`       | string               | optional | What the run should have done instead                          |
| `applicable_tools`     | list\[string]        | optional | Tools, files, or areas this lesson applies to                  |
| `retrieved_memory_ids` | list\[string]        | optional | IDs from `retrieve_memories` — enables Q-value updates         |

***

## Verify the connection

The health endpoint requires no auth:

```bash theme={null}
curl https://api.starlight-search.com/mcp/health
# {"status": "ok"}
```
