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

# GBrain MCP

> Connect GBrain to an MCP client

Use GBrain's MCP server to make your GBrain memory available inside MCP-aware AI clients.

## Install GBrain

1. Install the GBrain CLI:

```bash theme={null}
bun install -g github:garrytan/gbrain
```

2. Create a local GBrain database:

```bash theme={null}
gbrain init --pglite
```

3. Verify the install:

```bash theme={null}
gbrain doctor
```

4. Import markdown sources you want GBrain to search:

```bash theme={null}
gbrain import ~/notes
```

## Use a local MCP client

Use this path for clients that can start a local stdio MCP server, such as Claude Code, Cursor, Windsurf, or other local agent clients.

1. Open your MCP client's server configuration.
2. Add a server named `gbrain`.
3. Set the command to `gbrain`.
4. Set the arguments to `serve`.

Use this JSON shape if your client accepts MCP server JSON:

```json theme={null}
{
    "gbrain": {
        "command": "gbrain",
        "args": ["serve"]
    }
}
```

For Claude Code, run:

```bash theme={null}
claude mcp add gbrain -- gbrain serve
```

## Use a remote MCP connector

Use this path for clients that ask for an MCP server URL, such as Perplexity Computer, Claude Desktop remote connectors, Claude Cowork, ChatGPT connectors, or other hosted AI clients.

1. Start the HTTP MCP server:

```bash theme={null}
gbrain serve --http --port 3131
```

2. Copy the admin bootstrap token printed by the server.
3. Open the admin dashboard:

```text theme={null}
http://localhost:3131/admin
```

4. Paste the bootstrap token to enter the dashboard.
5. Create a client or access token for the AI client you want to connect.
6. Expose the HTTP server with your preferred deployment or tunnel.
7. In your AI client's connector settings, add the GBrain MCP server URL:

```text theme={null}
https://YOUR-DOMAIN.example/mcp
```

8. If the client asks for a bearer token, create one for that client:

```bash theme={null}
gbrain auth create "client-name"
```

9. Enter the token as a bearer token or request header:

```json theme={null}
{
    "Authorization": "Bearer YOUR_GBRAIN_ACCESS_TOKEN"
}
```

10. Save the connector.

## Use GBrain in chats

1. Open a chat in the connected AI client.
2. Enable or select the `gbrain` connector.
3. Ask the client to search, read, or synthesize from your GBrain memory.

Example:

```text theme={null}
Use GBrain to summarize what my notes say about our MCP integration plans.
```

## Connection values

For local stdio clients:

```text theme={null}
Command: gbrain
Arguments: serve
```

For remote HTTP clients:

```text theme={null}
Server URL: https://YOUR-DOMAIN.example/mcp
Authorization: Bearer YOUR_GBRAIN_ACCESS_TOKEN
```

GBrain also supports OAuth-based connectors for clients that require OAuth 2.1 with PKCE.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.