# MCP in Cursor

Add the SurrealDB MCP Server to Cursor and sign in with your Surreal ID.

With the [SurrealDB MCP Server](/docs/build/ai-agents/mcp.md) connected, Cursor's agent can reach your SurrealDB Cloud account while you work: check what is deployed, query a database, and read logs without leaving the editor.

## Add the server

Cursor reads `~/.cursor/mcp.json` for every project, or `.cursor/mcp.json` for one project. Add a `surrealdb` entry:

```json
{
  "mcpServers": {
    "surrealdb": {
      "url": "https://mcp.surrealdb.com"
    }
  }
}
```

If the file already lists other servers, add this entry alongside them.

## Sign in

Open **Settings → MCP**, find **surrealdb**, and click **Connect**. Cursor opens a browser window where you sign in with your Surreal ID and approve the connection. The indicator beside the server turns green when it is ready.

Nothing about your account is stored in `mcp.json`, so a project-level file is safe to commit. Everyone who opens the project signs in as themselves.

## Check it worked

In the chat panel, ask:

> Which SurrealDB Cloud organisations can you see?

Cursor should answer with your organisations. To see the whole tool surface, ask which SurrealDB tools it has available.

## Using a personal access token instead

For a machine that cannot open a browser, create a token in the [account portal](https://account.surrealdb.com/tokens) and add it as a header:

```json
{
  "mcpServers": {
    "surrealdb": {
      "url": "https://mcp.surrealdb.com",
      "headers": {
        "Authorization": "Bearer <your-token>"
      }
    }
  }
}
```

Give the token only the permissions you want the agent to have. [Signing in](/docs/build/ai-agents/mcp.md#signing-in) lists what each one allows.

> [!WARNING]
> A token in a project-level `.cursor/mcp.json` will be committed with the repository. Keep tokens in the global `~/.cursor/mcp.json` instead.

## Try it

> Create a `task` table in my dev instance with a title and a done flag, insert two rows, then show me the ones that are not done.

Cursor picks the instance, sets the namespace and database, and runs the SurrealQL, showing you each call as it goes. [Example usages](/docs/build/ai-agents/mcp/examples.md) has more, including deploying an instance and investigating a slow query.

## Removing it

Delete the `surrealdb` entry from `mcp.json`. Cursor stops offering the tools in new sessions.

## Troubleshooting

| What you see | What to do |
| --- | --- |
| The indicator stays red | Click **Connect** in **Settings → MCP** and complete the sign-in. Check the URL has no trailing path |
| Tools do not appear in chat | Reload the window after editing `mcp.json` |
| The agent asks you to authenticate on every request | Sign in through **Settings → MCP** rather than answering in chat, so Cursor stores the connection |
| A tool reports a missing permission | You are using a personal access token created without it. Create a new token with that box ticked |
