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

# MCP

> Serve remember and query as tools of an MCP server, so MCP clients can use gligabao as their memory.

gligabao can serve `remember` and `query` as tools of an [MCP](https://modelcontextprotocol.io) (Model Context Protocol) server, so that MCP clients (Claude Desktop, Claude Code, IDE agents, ...) can use it as their memory. It is built on the official Go SDK, [`modelcontextprotocol/go-sdk`](https://github.com/modelcontextprotocol/go-sdk).

> [!WARNING]
>
> **It is off by default and has no authentication.** Enable it with `mcp = true` in the config file (`build/gligabao.toml`) or `serve --mcp`. Callers choose the `user_id` themselves, exactly as with the REST API when no `Auth` hook is set, so turn it on only on a trusted network. The endpoint is **not** covered by the `Auth` hook (a warning is logged at startup if both are set); when gligabao is [mounted](https://gligabao.mintlify.site/embedding/go-library.md#mounting-on-your-own-http-server) on a host's mux, `MountOptions.Wrap` does cover it, as it is under `/v1/gb/`.

## Endpoint

`/v1/gb/mcp`, the MCP *streamable HTTP* transport (`POST`; `GET` and `DELETE` are answered too, as the transport requires). The server is stateless: no session is kept between calls, and answers are plain JSON (no event stream).

```sh theme={null}
claude mcp add --transport http gligabao http://localhost:7878/v1/gb/mcp
```

For a client that takes a JSON config:

```json theme={null}
{"mcpServers": {"gligabao": {"type": "http", "url": "http://localhost:7878/v1/gb/mcp"}}}
```

## Tools

Only these two tools are exposed for now. Each runs the handler of the matching REST endpoint in process, so validation, limits, errors, monitoring events (`remember.completed`, `query.completed`, ...) and results are those of the endpoint; see its page for the details of every field.

### `remember`

Stores a text in memory, like [`POST /v1/gb/remember`](https://gligabao.mintlify.site/api-reference/remember) with a text.

| Argument | | |
| - | - | - |
| `user_id` | required | The user that owns the dataset |
| `text` | required | The text to remember (at most 1 MiB) |
| `dataset` | optional | The dataset to store into, created if missing (default `main`) |
| `kind` | optional | `knowledge` (default) or `episode` |
| `session_id` | optional | A label for the user/agent session ([Sessions](https://gligabao.mintlify.site/concepts/sessions.md)) |
| `reference_time` | optional | When the text was written, RFC 3339 (default now) |

The other options of the endpoint (`image`, `models`, `reasoning`, `web_search`, `timeseries`) are not available through MCP yet.

### `query`

Answers a question from the graph, like [`POST /v1/gb/query`](https://gligabao.mintlify.site/api-reference/query).

| Argument | | |
| - | - | - |
| `user_id` | required | The user that owns the dataset |
| `query` | required | The question |
| `dataset` | optional | The dataset to search (default `main`) |
| `session_id` | optional | A label for the user/agent session |
| `reasoning` | optional | `none` (default), `low`, `medium` or `high` |

### Results

On success the result is the JSON response of the endpoint, both as the tool's structured content and as text. If the endpoint answers with an error status (invalid argument `400`, dataset not found `404`, no LLM key `503`, failed LLM call `502`, ...) the result is a tool error (`isError: true`) whose text is the endpoint's message and status, so that the model can see what went wrong and correct the call. Arguments that do not match the tool's input schema (a missing `user_id` or `text`) are rejected by the MCP layer before the handler runs.

## Not included yet

Authentication, the other endpoints (datasets, timeseries, ontologies) as tools, MCP resources and prompts. See the [roadmap](https://github.com/deepblue-phoenix/gligabao/blob/main/docs/roadmap/ROADMAP.md).


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