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

# Connect via MCP

> Connect Claude Code, Codex, Cursor, and other MCP clients to MemoryLake with standard OAuth2

MemoryLake runs a **remote MCP server** that any MCP-capable client can connect to over HTTP. Authorization uses standard **OAuth2** — you never paste a secret into a config file, and you choose which workspace and boundary the client may access on the consent screen.

## Server URL

```text theme={null}
https://app.memorylake.ai/memorylake/mcp/v2
```

The console shows this URL with a copy button at **Integrations → MCP**, along with ready-made commands per client.

<Info>
  The connect page is scope-less: there is no project picker. You pick the workspace and boundary during the OAuth consent step, so one client connection can be re-authorized to a different scope without editing any config.
</Info>

## Connect Your Client

<Tabs>
  <Tab title="Claude Code">
    ```bash theme={null}
    claude mcp add --transport http --scope user memorylake https://app.memorylake.ai/memorylake/mcp/v2
    ```

    Claude Code opens the MemoryLake consent screen on first use. Approve it, choose your workspace and boundary, and the tools appear.
  </Tab>

  <Tab title="Codex">
    Add the server to your Codex configuration:

    ```toml theme={null}
    [mcp_servers.memorylake]
    url = "https://app.memorylake.ai/memorylake/mcp/v2"
    ```

    Then sign in:

    ```bash theme={null}
    codex mcp login memorylake
    ```
  </Tab>

  <Tab title="Cursor / Claude Desktop">
    ```json theme={null}
    {
      "mcpServers": {
        "memorylake": {
          "url": "https://app.memorylake.ai/memorylake/mcp/v2"
        }
      }
    }
    ```

    Restart the client; it will prompt for OAuth authorization on first connection.
  </Tab>

  <Tab title="Other clients">
    Any client that supports remote MCP servers over HTTP with OAuth2 works. Point it at the server URL above — no API key, no custom headers. The client performs the standard OAuth2 authorization-code flow and stores the resulting token itself.
  </Tab>
</Tabs>

## What Connected Clients Can Do

Once authorized, the client gets tools for searching and analyzing the content in scope:

| Tool                                            | What it does                                                                                    |
| ----------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| `search_memory`                                 | Hybrid keyword + semantic search across memories and documents                                  |
| `fetch_memory`                                  | Fetch detailed metadata and download links for specific results                                 |
| `get_memorylake_metadata`                       | Overview — file counts by type, spreadsheet sheet names, document stats                         |
| `create_memory_code_runner` / `run_memory_code` | Sandboxed Python (pandas, numpy, …) over the files in scope, with state persisting across calls |
| `nl_query_database`                             | Natural-language SQL over a connected database, where one is configured                         |

OpenAI-protocol clients are automatically served simplified `search` / `fetch` variants of the same tools — one endpoint adapts to the client.

These tools read and analyze; they do not modify or delete your documents and memories.

## Managing Access

* **Re-scope**: re-run the OAuth flow to authorize a different workspace or boundary — no config change needed.
* **Revoke**: remove the authorization from the console; the client's token stops working immediately.
* **Token lifetime**: access tokens are short-lived and refreshed automatically by the client.

<Note>
  Earlier versions of MemoryLake used a v1 MCP endpoint with a project-scoped key embedded in the URL (`…/mcp/v1?apikey=…`). That flow has been retired from the console in favor of OAuth2. The v1 endpoint remains available for backward compatibility, but new integrations should use the v2 URL above.
</Note>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Client can't connect">
    Confirm the URL ends in `/mcp/v2` and the client is configured for a **remote HTTP** MCP server (not a local command). Make sure the client supports OAuth2 for MCP — older clients that only accept static tokens cannot use the v2 endpoint.
  </Accordion>

  <Accordion title="Authorization succeeds but no tools appear">
    Check that you completed workspace and boundary selection on the consent screen. Re-run the client's MCP login to retry.
  </Accordion>

  <Accordion title="Tools return nothing">
    The authorized scope may point at an empty project. Confirm in the console that the workspace and project you selected actually contain documents or memories.
  </Accordion>

  <Accordion title="I don't see MCP in my console">
    MCP availability depends on your deployment. If **Integrations → MCP** is missing, contact [support@memorylake.ai](mailto:support@memorylake.ai).
  </Accordion>
</AccordionGroup>
