# database MCP server

> Provides an AI-driven database workbench for PostgreSQL, MySQL, and SQLite with connection grouping, schema discovery, and automatic rollback capabilities.

- Repository: https://github.com/cocaxcode/database-mcp
- Page: https://hostedmcp.org/servers/cocaxcode/database-mcp
- Transport: stdio
- Stars: 5
- License: MIT
- Latest version: 0.1.14

## Install

### Claude Code

```sh
claude mcp add database-mcp -- npx -y @cocaxcode/database-mcp
```

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

```json
{
  "mcpServers": {
    "database-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@cocaxcode/database-mcp"
      ]
    }
  }
}
```

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

```json
{
  "servers": {
    "database-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@cocaxcode/database-mcp"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"database-mcp","type":"stdio","command":"npx","args":["-y","@cocaxcode/database-mcp"]}'
```

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

```json
{
  "mcpServers": {
    "database-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@cocaxcode/database-mcp"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add database-mcp -- npx -y @cocaxcode/database-mcp
```

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

```toml
[mcp_servers.database-mcp]
command = "npx"
args = ["-y", "@cocaxcode/database-mcp"]
```

### Gemini CLI

```sh
gemini mcp add -s user database-mcp npx -- -y @cocaxcode/database-mcp
```

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

```json
{
  "mcpServers": {
    "database-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@cocaxcode/database-mcp"
      ]
    }
  }
}
```

## FAQ

### Which databases are supported?

The server supports PostgreSQL, MySQL, and SQLite.

### How does the rollback feature work?

Every mutation captures a pre-state snapshot, allowing you to undo operations like DELETE, UPDATE, or INSERT using reverse SQL.

### Is my data and credential information secure?

Yes, credentials are stored locally in a JSON file on your machine and never leave your device or get sent to the cloud.

### Can I organize my connections by project?

Yes, you can use Connection Groups to scope connections to specific directories, ensuring you only see relevant databases when working in a project folder.
