# TinyContext MCP server

> Provides a token-light local memory layer for AI agents using SQLite with hybrid BM25 and dense retrieval.

- Repository: https://github.com/TinySuiteHQ/TinyContext
- Page: https://hostedmcp.org/servers/tinysuitehq/tinycontext
- Official: yes
- Transport: stdio
- Stars: 10
- License: MIT
- Latest version: 0.5.4

## Install

### Claude Code

```sh
claude mcp add --env 'OTEL_EXPORTER_OTLP_HEADERS=<YOUR_OTEL_EXPORTER_OTLP_HEADERS>' tinycontext -- docker run -i --rm docker.io/marcellm01/tinycontext:v0.5.4
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "tinycontext": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "docker.io/marcellm01/tinycontext:v0.5.4"
      ],
      "env": {
        "OTEL_EXPORTER_OTLP_HEADERS": "<YOUR_OTEL_EXPORTER_OTLP_HEADERS>"
      }
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "tinycontext": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "docker.io/marcellm01/tinycontext:v0.5.4"
      ],
      "env": {
        "OTEL_EXPORTER_OTLP_HEADERS": "<YOUR_OTEL_EXPORTER_OTLP_HEADERS>"
      }
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"tinycontext","type":"stdio","command":"docker","args":["run","-i","--rm","docker.io/marcellm01/tinycontext:v0.5.4"],"env":{"OTEL_EXPORTER_OTLP_HEADERS":"<YOUR_OTEL_EXPORTER_OTLP_HEADERS>"}}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "tinycontext": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "docker.io/marcellm01/tinycontext:v0.5.4"
      ],
      "env": {
        "OTEL_EXPORTER_OTLP_HEADERS": "<YOUR_OTEL_EXPORTER_OTLP_HEADERS>"
      }
    }
  }
}
```

### Codex

```sh
codex mcp add tinycontext --env 'OTEL_EXPORTER_OTLP_HEADERS=<YOUR_OTEL_EXPORTER_OTLP_HEADERS>' -- docker run -i --rm docker.io/marcellm01/tinycontext:v0.5.4
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.tinycontext]
command = "docker"
args = ["run", "-i", "--rm", "docker.io/marcellm01/tinycontext:v0.5.4"]

[mcp_servers.tinycontext.env]
OTEL_EXPORTER_OTLP_HEADERS = "<YOUR_OTEL_EXPORTER_OTLP_HEADERS>"
```

### Gemini CLI

```sh
gemini mcp add -s user -e 'OTEL_EXPORTER_OTLP_HEADERS=<YOUR_OTEL_EXPORTER_OTLP_HEADERS>' tinycontext docker -- run -i --rm docker.io/marcellm01/tinycontext:v0.5.4
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "tinycontext": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "docker.io/marcellm01/tinycontext:v0.5.4"
      ],
      "env": {
        "OTEL_EXPORTER_OTLP_HEADERS": "<YOUR_OTEL_EXPORTER_OTLP_HEADERS>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `OTEL_EXPORTER_OTLP_HEADERS` | no | yes | Optional OTLP collector headers. |
| `MCP_TRANSPORT` | no | no | MCP transport to serve: stdio (default), sse, or streamable-http. |
| `OTEL_EXPORTER_OTLP_ENDPOINT` | no | no | OTLP collector endpoint for optional OpenTelemetry traces and metrics. |
| `OTEL_EXPORTER_OTLP_PROTOCOL` | no | no | OTLP protocol: http/protobuf or grpc. |
| `OTEL_SERVICE_NAME` | no | no | OpenTelemetry service name; defaults to tinycontext when telemetry is enabled. |
| `TINYCONTEXT_CONFIG_PATH` | no | no | Path to a context_config.json inside the container. |
| `TINYCONTEXT_MEMORY_DB_PATH` | no | no | Path to the TinyContext SQLite database. |
| `TINYCONTEXT_MODELS_DIR` | no | no | Directory used for downloaded ONNX embedding bundles. |
| `TINYCONTEXT_TENANT_SECRET` | no | no |  |
| `TINYCONTEXT_TRUSTED_PROXY_CIDRS` | no | no |  |
| `TINYCONTEXT_TRUSTED_PROXY_TOKEN` | no | no |  |

## FAQ

### How does TinyContext handle memory retrieval?

It stores memories and embeddings in SQLite, ranking them using a hybrid of BM25 and dense retrieval to fit within a specified token budget.

### Can I use TinyContext without a hosted account or a large vector database?

Yes, it is designed to work locally without a hosted account or the requirement of a separate giant vector database.
