> ## Documentation Index
> Fetch the complete documentation index at: https://api-tools.memories.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Server

> Connect any MCP-compatible agent to the Video Datalake — the official MCP server.

<Info>
  **Endpoint**: `https://mcp.memories.ai/mcp` · **Covers**: the Video Datalake
  **Works with**: Claude, Claude Code, Codex, Cursor — any [MCP](https://modelcontextprotocol.io) client
  **Auth**: OAuth — sign in to memories.ai in the browser (no key to paste)
</Info>

The **Memories.ai MCP Server** is our official [Model Context Protocol](https://modelcontextprotocol.io) server for the **Video Datalake**, hosted at `https://mcp.memories.ai/mcp`. Point an MCP-compatible agent at it and it can operate the lake — index and search your video, read any moment, manage the face library, and watch for safety events — all in natural language, with no glue code.

You don't build or run this server — **we host it**. On connect, a browser opens to sign in to your memories.ai account; the server handles auth via OAuth and never sees a pasted key.

## Prerequisites

* A [memories.ai](https://memories.ai) account (free tier works).
* An MCP-compatible client: Claude Code, Codex, Claude Desktop, Cursor, or any other.

## Connect

<Tabs>
  <Tab title="Claude Code / Codex (plugin)">
    The easiest path — the [Memories plugin](/plugin) bundles the MCP server plus commands:

    ```bash theme={null}
    # Claude Code
    claude plugin marketplace add Memories-ai-labs/memories-ai-plugin
    claude plugin install memories@memories-ai
    ```

    On first use a browser opens to sign in and authorize. See the [Plugin](/plugin) page for Codex and the commands.
  </Tab>

  <Tab title="Claude Desktop / Cursor">
    <Steps>
      <Step title="Open connector settings">
        Go to **Settings → Connectors → Add custom connector**.
      </Step>

      <Step title="Set the URL">
        Name it `Memories.ai` and set the URL to `https://mcp.memories.ai/mcp`.
      </Step>

      <Step title="Sign in">
        Save — a browser opens to sign in to memories.ai and authorize. The tools then appear.
      </Step>
    </Steps>
  </Tab>

  <Tab title="Any MCP client">
    Point the client at the remote HTTP endpoint `https://mcp.memories.ai/mcp`. On connect it runs the OAuth sign-in flow — no key to paste.
  </Tab>
</Tabs>

## Verify

Ask your agent:

> *"List the tools available from Memories.ai."*

You should see the tools below. If nothing appears, jump to [Troubleshooting](#troubleshooting).

## What your agent can do

An **intent-first** tool set for the Datalake (not a 1:1 mirror of the REST endpoints):

| Group             | Tools                                                                             |
| ----------------- | --------------------------------------------------------------------------------- |
| **Collections**   | `list_collections` · `create_collection` · `delete_collection`                    |
| **Ingest**        | `upload_video` · `open_stream` · `delete_video`                                   |
| **Search & read** | `search_moments` · `get_moment` (captions · frames · clips · speakers · entities) |
| **Face library**  | `create_person` · `list_persons`                                                  |
| **Safety**        | `list_events`                                                                     |
| **Common**        | `wait_for_operation` — wait for any async task to finish                          |

Tools chain naturally — `search_moments` returns a `ref` that feeds straight into `get_moment`; `upload_video` returns an operation that `wait_for_operation` blocks on until indexing is done.

## Example prompts

Start simple, then compose:

* *"List my collections and how many videos each has."*
* *"Upload this video to `store-cams` and tell me when someone opens a door."*
* *"Search `matches` for every goal and give me the clips."*
* *"Who appears in `vid_abc`, and when?"*
* *"Watch this RTMP stream and alert me on any safety event."*

## Troubleshooting

| Symptom                         | Fix                                                                                                                                  |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| **No Memories.ai tools appear** | Confirm the server URL is `https://mcp.memories.ai/mcp` and your client re-loaded connectors; restart the client.                    |
| **Auth errors / not signed in** | Re-run the browser sign-in and make sure you authorized the memories.ai connection.                                                  |
| **Empty results**               | The account may have no matching data yet (e.g. searching an empty collection), or the query was too narrow — broaden it and retry.  |
| **A tool times out**            | Long jobs (indexing, editing) are async — the agent should call `wait_for_operation`; retry if a dependency was briefly unavailable. |
| **Still stuck**                 | Contact [support@memories.ai](mailto:support@memories.ai) with the tool name and your request.                                       |

## Safety

The server enforces the same guardrails as the [API](/overview):

* **Destructive tools** (`delete_video`, `delete_collection`) require an explicit confirmation argument — an agent can't wipe data on a stray instruction.
* **Face-library tools** require a compliance token; the server never fabricates consent.
* **Signed media URLs** are fetched fresh per request, never cached past expiry.
