# threadctx MCP server

> Provides shared memory for AI coding agents to store and retrieve architectural decisions and project context across local and team environments.

- Repository: https://github.com/threadctx-dev/threadctx-mcp
- Page: https://hostedmcp.org/servers/threadctx-dev/threadctx-mcp
- Transport: stdio
- Stars: 1
- License: MIT
- Latest version: 0.5.0

## Install

### Claude Code

```sh
claude mcp add --env 'THREADCTX_API_KEY=<YOUR_THREADCTX_API_KEY>' threadctx-mcp -- npx -y threadctx-mcp
```

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

```json
{
  "mcpServers": {
    "threadctx-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "threadctx-mcp"
      ],
      "env": {
        "THREADCTX_API_KEY": "<YOUR_THREADCTX_API_KEY>"
      }
    }
  }
}
```

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

```json
{
  "servers": {
    "threadctx-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "threadctx-mcp"
      ],
      "env": {
        "THREADCTX_API_KEY": "<YOUR_THREADCTX_API_KEY>"
      }
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"threadctx-mcp","type":"stdio","command":"npx","args":["-y","threadctx-mcp"],"env":{"THREADCTX_API_KEY":"<YOUR_THREADCTX_API_KEY>"}}'
```

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

```json
{
  "mcpServers": {
    "threadctx-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "threadctx-mcp"
      ],
      "env": {
        "THREADCTX_API_KEY": "<YOUR_THREADCTX_API_KEY>"
      }
    }
  }
}
```

### Codex

```sh
codex mcp add threadctx-mcp --env 'THREADCTX_API_KEY=<YOUR_THREADCTX_API_KEY>' -- npx -y threadctx-mcp
```

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

```toml
[mcp_servers.threadctx-mcp]
command = "npx"
args = ["-y", "threadctx-mcp"]

[mcp_servers.threadctx-mcp.env]
THREADCTX_API_KEY = "<YOUR_THREADCTX_API_KEY>"
```

### Gemini CLI

```sh
gemini mcp add -s user -e 'THREADCTX_API_KEY=<YOUR_THREADCTX_API_KEY>' threadctx-mcp npx -- -y threadctx-mcp
```

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

```json
{
  "mcpServers": {
    "threadctx-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "threadctx-mcp"
      ],
      "env": {
        "THREADCTX_API_KEY": "<YOUR_THREADCTX_API_KEY>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `THREADCTX_API_KEY` | no | yes | API key for cloud mode, issued at threadctx.dev. Not needed in local mode. |
| `ANTHROPIC_API_KEY` | no | no |  |
| `THREADCTX_CAPTURE_ENABLED` | no | no |  |
| `THREADCTX_MODE` | no | no | 'local' (default, free, no signup) or 'cloud' (shared team memory) |

## Tools (2)

- `memory_write`
- `memory_query`

## FAQ

### How does the local mode work?

In local mode, memory is stored as a plain JSON file at ~/.threadctx/local.json with zero native dependencies and no network calls except to your LLM provider.

### How can I turn git history into memory?

You can use the `capture` command to distill recent commits into reusable decisions using your own LLM provider key.

### Is my API key safe when using cloud mode?

Yes, the API key is read from the THREADCTX_API_KEY environment variable at runtime and is never included in committed files.
