# JetBrains

Installing SurrealDB Agent Memory as an MCP server in JetBrains IDEs (IntelliJ IDEA, PyCharm, WebStorm, Rider, and more).

JetBrains AI Assistant supports MCP servers across the IDE suite: IntelliJ IDEA, PyCharm, WebStorm, GoLand, Rider, and the others. Installing SurrealDB Agent Memory gives the assistant persistent memory across sessions, so it can recall previous decisions and project context without you repeating them.

For integration rules your agent should follow (auth, scope, endpoints, common mistakes), see **[Agent guide (AGENTS.md)](/docs/agent-memory/reference/agents.md)**.

## Configure

The `install-mcp` helper does not cover JetBrains IDEs, so configure the server by hand. Open **Settings → Tools → AI Assistant → Model Context Protocol (MCP)**, click **Add**, and paste a JSON configuration. AI Assistant connects to remote servers over Streamable HTTP:

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

On **SurrealDB Cloud**, use your context host from SurrealDB Studio **API keys** (not a generic shared domain). **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`**.

## Verify the installation

1. Reopen **Settings → Tools → AI Assistant → Model Context Protocol (MCP)** and confirm **spectron** is listed and connected
2. Open the AI Assistant chat and ask "What MCP tools do you have available?" It should report the SurrealDB Agent Memory tools

If the server fails to connect, check that the URL (your context host + `/mcp`) and API key are correct.

## Usage examples

**Store a project decision:**

> "Remember that this service uses hexagonal architecture and all adapters live under `internal/adapters`."

AI Assistant calls `memory_store` with a suitable `scope`.

**Recall context before a change:**

> "What did we decide about where adapters live in this project?"

AI Assistant calls `memory_recall` before answering.

## Scope per project

Narrow reads and writes with the per-tool **`scope`** argument (slash paths, for example `["org/acme/project/platform"]`). Register paths with `spectron scopes create` before first use. For project isolation, use separate contexts or distinct scope paths.

## Removing SurrealDB Agent Memory

Open **Settings → Tools → AI Assistant → Model Context Protocol (MCP)**, select the **spectron** entry, and remove it.
