MCP server

/

Coding assistants

Cursor

Installing SurrealDB Agent Memory as an MCP server in Cursor.

Installing SurrealDB Agent Memory in Cursor gives every AI interaction in your editor access to persistent memory. Cursor's agent can recall previous decisions, project context, and user preferences across sessions without you having to repeat yourself.

For integration rules your agent should follow (auth, scope, endpoints, common mistakes), see Agent guide (AGENTS.md). You can copy that page into .cursor/rules/ or a project skill.

The MCP server lives at /mcp on your SurrealDB Agent Memory instance. On SurrealDB Cloud the base is your context host from SurrealDB Studio API keys; self-hosted, it is your server's base URL. Point Cursor at it with install-mcp:

npx install-mcp https://<your-context-host>/mcp \
  --client cursor \
  --header "Authorization: Bearer <your-api-key>" \
  --oauth no

The URL is the first argument; auth is passed with --header, and --oauth no skips the OAuth prompt (SurrealDB Agent Memory uses a static Bearer key). The command writes the configuration to ~/.cursor/mcp.json. If that file already exists, the spectron entry is merged in without disturbing other MCP servers.

SurrealDB Cloud: use your context host from SurrealDB Studio API keys (not a generic shared domain):

{
  "mcpServers": {
    "spectron": {
      "url": "https://<your-context-host>/mcp",
      "headers": {
        "Authorization": "Bearer <your-api-key>",
        "X-Spectron-Context": "acme-prod"
      }
    }
  }
}

Self-hosted: replace the URL with your SurrealDB Agent Memory server's base URL + /mcp.

Note

X-Spectron-Context is a client-side convenience for templating. Each API key is bound to one Context, so context_id is optional on every tool call; omit it to use the key's Context. An explicit value that does not match the key still returns 401.

The shipped install-mcp helper does not set a default scope. Narrow reads and writes by passing a scope argument on each tool (slash paths, for example ["org/acme/user/alice"] or ["org/acme/project/platform-v3"]). Register paths with spectron scopes create before first use.

For project isolation, use separate contexts or distinct scope paths in tool arguments, not install-time flags.

  1. Open Cursor

  2. Navigate to Settings → Features → MCP

  3. You should see spectron listed with a green indicator confirming the server is reachable

  4. Open the chat panel and ask: "What MCP tools do you have available?" - Cursor should report the seven SurrealDB Agent Memory tools

If the indicator is red, check that the URL (your context host + /mcp) and API key in ~/.cursor/mcp.json are correct.

At the start of a work session, tell Cursor about the project:

"Remember that we're using a hexagonal architecture pattern in this codebase and that all new services should implement the Repository interface before touching the domain layer."

Cursor invokes remember with an appropriate scope (for example ["org/acme/project/platform-v3"]). The next time you start a session, that instruction is retrieved by recall before Cursor answers questions about architecture.

When you ask an architectural question:

"Should I add this feature to the gateway service or create a new service?"

Cursor calls recall with the query and scope before composing its response, retrieving previous decisions about service boundaries.

If you have synced your documentation into SurrealDB Agent Memory's authoritative knowledge:

"What does our internal wiki say about the deployment process?"

Cursor calls recall against the knowledge base and incorporates the retrieved content into its response.

To change the API key or context host after installation, edit ~/.cursor/mcp.json directly or re-run the install command. Re-running merges the new values over the existing entry:

npx install-mcp https://<your-context-host>/mcp \
  --client cursor \
  --header "Authorization: Bearer <your-api-key>" \
  --oauth no

Open ~/.cursor/mcp.json and delete the "spectron" key from mcpServers. Cursor will no longer offer the SurrealDB Agent Memory tools in subsequent sessions.

Was this page helpful?