# sqlite MCP server

> Enables AI clients to perform CRUD operations and execute SQL queries on SQLCipher 4 encrypted SQLite databases.

- Repository: https://github.com/rosch100/mcp-sqlite
- Page: https://hostedmcp.org/servers/rosch100/mcp-sqlite
- Transport: stdio
- Stars: 0
- License: Apache-2.0
- Latest version: 0.2.4

## Install

### Claude Code

```sh
claude mcp add --env 'DB_PASSPHRASE=<YOUR_DB_PASSPHRASE>' --env 'DB_PATH=<DB_PATH>' mcp-sqlite -- docker run -i --rm ghcr.io/rosch100/mcp-sqlite:0.2.4
```

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

```json
{
  "mcpServers": {
    "mcp-sqlite": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/rosch100/mcp-sqlite:0.2.4"
      ],
      "env": {
        "DB_PASSPHRASE": "<YOUR_DB_PASSPHRASE>",
        "DB_PATH": "<DB_PATH>"
      }
    }
  }
}
```

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

```json
{
  "servers": {
    "mcp-sqlite": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/rosch100/mcp-sqlite:0.2.4"
      ],
      "env": {
        "DB_PASSPHRASE": "<YOUR_DB_PASSPHRASE>",
        "DB_PATH": "<DB_PATH>"
      }
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"mcp-sqlite","type":"stdio","command":"docker","args":["run","-i","--rm","ghcr.io/rosch100/mcp-sqlite:0.2.4"],"env":{"DB_PASSPHRASE":"<YOUR_DB_PASSPHRASE>","DB_PATH":"<DB_PATH>"}}'
```

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

```json
{
  "mcpServers": {
    "mcp-sqlite": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/rosch100/mcp-sqlite:0.2.4"
      ],
      "env": {
        "DB_PASSPHRASE": "<YOUR_DB_PASSPHRASE>",
        "DB_PATH": "<DB_PATH>"
      }
    }
  }
}
```

### Codex

```sh
codex mcp add mcp-sqlite --env 'DB_PASSPHRASE=<YOUR_DB_PASSPHRASE>' --env 'DB_PATH=<DB_PATH>' -- docker run -i --rm ghcr.io/rosch100/mcp-sqlite:0.2.4
```

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

```toml
[mcp_servers.mcp-sqlite]
command = "docker"
args = ["run", "-i", "--rm", "ghcr.io/rosch100/mcp-sqlite:0.2.4"]

[mcp_servers.mcp-sqlite.env]
DB_PASSPHRASE = "<YOUR_DB_PASSPHRASE>"
DB_PATH = "<DB_PATH>"
```

### Gemini CLI

```sh
gemini mcp add -s user -e 'DB_PASSPHRASE=<YOUR_DB_PASSPHRASE>' -e 'DB_PATH=<DB_PATH>' mcp-sqlite docker -- run -i --rm ghcr.io/rosch100/mcp-sqlite:0.2.4
```

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

```json
{
  "mcpServers": {
    "mcp-sqlite": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/rosch100/mcp-sqlite:0.2.4"
      ],
      "env": {
        "DB_PASSPHRASE": "<YOUR_DB_PASSPHRASE>",
        "DB_PATH": "<DB_PATH>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `DB_PASSPHRASE` | yes | yes | Passphrase for decrypting the database |
| `DB_PATH` | yes | no | Path to the encrypted SQLite database file |
| `JAVA_HOME` | no | no |  |
| `MCP_DEBUG` | no | no |  |
| `MCP_SQLITE_ENCRYPTION_KEY` | no | no |  |

## Tools (11)

- `db_path`
- `passphrase`
- `include_columns`
- `table`
- `columns`
- `filters`
- `limit`
- `offset`
- `sql`
- `primary_keys`
- `rows`

## FAQ

### Which applications use encrypted SQLite databases that this server can access?

It works with databases from MoneyMoney, 1Password, Signal, WhatsApp, Firefox, Telegram, KeePass, and other SQLCipher-based apps.

### Can I use this server to read databases that are currently locked by another application?

Yes, by setting the 'immutable' parameter to true, you can open the database in a way that avoids file locks, though write operations will be disabled.

### How can I securely handle database passphrases?

You can use AES-256-GCM encrypted passphrases with macOS Keychain integration or provide an encryption key via the MCP_SQLITE_ENCRYPTION_KEY environment variable.
