# a2db MCP server

> Provides AI agents with safe, read-only access to multiple databases using batch queries and structured TSV output.

- Repository: https://github.com/agentic-eng/a2db
- Page: https://hostedmcp.org/servers/agentic-eng/a2db
- Transport: stdio
- Stars: 2
- License: Apache-2.0
- Latest version: 0.2.1

## Install

### Claude Code

```sh
claude mcp add a2db -- uvx a2db
```

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

```json
{
  "mcpServers": {
    "a2db": {
      "command": "uvx",
      "args": [
        "a2db"
      ]
    }
  }
}
```

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

```json
{
  "servers": {
    "a2db": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "a2db"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"a2db","type":"stdio","command":"uvx","args":["a2db"]}'
```

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

```json
{
  "mcpServers": {
    "a2db": {
      "command": "uvx",
      "args": [
        "a2db"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add a2db -- uvx a2db
```

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

```toml
[mcp_servers.a2db]
command = "uvx"
args = ["a2db"]
```

### Gemini CLI

```sh
gemini mcp add -s user a2db uvx -- a2db
```

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

```json
{
  "mcpServers": {
    "a2db": {
      "command": "uvx",
      "args": [
        "a2db"
      ]
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `DB_PASSWORD` | no | no |  |

## Tools (5)

- `login`
- `logout`
- `list_connections`
- `execute`
- `search_objects`

## FAQ

### How does a2db ensure database security?

It uses SQLGlot AST parsing to block all write operations like INSERT, UPDATE, and DELETE, ensuring queries remain read-only.

### How are database credentials handled?

Secrets are kept in environment variables using ${ENV_VAR} syntax and are expanded only at connection time, never stored in plaintext.

### Why does the server use TSV format for query results?

TSV uses 40-60% fewer tokens than JSON row format, making it more efficient for LLM context windows.
