db-view-mcp

by conte777

296 downloads Not rated yet

About

MCP server that gives AI assistants direct access to PostgreSQL and ClickHouse databases. Supports stdio and HTTP transports.

Explore

- Multi-database — connect to any number of PostgreSQL and ClickHouse instances simultaneously
- Dual transport — stdio for IDE integration (Cursor, Claude Code), HTTP for remote/multi-client access
- Read & write tools — SELECT queries with row limits, INSERT/UPDATE/DELETE, DDL, transactions
- Schema introspection — list tables, describe columns, export full DDL
- Query analysis — EXPLAIN ANALYZE support, slow query tracking
- SQL safety — read-only tools validate SQL to block accidental writes
- Flexible tool modes — single tool with database parameter, or separate tool per database
- Lazy connections — databases connect on first use by default
- Bearer auth — optional token-based authentication for HTTP transport
- Session management — stateful (per-session MCP server) or stateless HTTP mode

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name db-view-mcp
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

npm install @conte777/db-view-mcp

Or clone and build from source:

git clone <repo-url>
cd db-view-mcp
npm install
npm run build

npm start -- --config config.json

npm start -- --config config.json --transport http

Optional bearer token authentication:

{
  "transport": {
    "type": "http",
    "auth": {
      "type": "bearer",
      "token": "your-secret-token"
    }
  }
}

Requests to /mcp must include Authorization: Bearer your-secret-token. Requests without a valid token receive 401 Unauthorized. The /health endpoint is not protected.

Set "toolsPerDatabase": true in defaults to register a separate tool for each database. Instead of a single query tool with a database parameter, you get query_main_pg, query_analytics, etc. Useful when connecting many databases to avoid parameter confusion.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "db-view-mcp": {
            "database": {
                "command": "npx",
                "args": [
                    "-y",
                    "@conte777/db-view-mcp",
                    "--config",
                    "/path/to/config.json"
                ]
            }
        }
    }
}

McpServers

{
    "database": {
        "command": "npx",
        "args": [
            "-y",
            "@conte777/db-view-mcp",
            "--config",
            "/path/to/config.json"
        ]
    }
}

MCP server that gives AI assistants direct access to PostgreSQL and ClickHouse databases. Supports stdio and HTTP transports, allowing both local IDE integration and remote network access.

Features

- Multi-database — connect to any number of PostgreSQL and ClickHouse instances simultaneously
- Dual transport — stdio for IDE integration (Cursor, Claude Code), HTTP for remote/multi-client access
- Read & write tools — SELECT queries with row limits, INSERT/UPDATE/DELETE, DDL, transactions
- Schema introspection — list tables, describe columns, export full DDL
- Query analysis — EXPLAIN ANALYZE support, slow query tracking
- SQL safety — read-only tools validate SQL to block accidental writes
- Flexible tool modes — single tool with database parameter, or separate tool per database
- Lazy connections — databases connect on first use by default
- Bearer auth — optional token-based authentication for HTTP transport
- Session management — stateful (per-session MCP server) or stateless HTTP mode

Quick start

Install

npm install @conte777/db-view-mcp

Or clone and build from source:

git clone <repo-url>
cd db-view-mcp
npm install
npm run build

Configure

Copy the example config and edit it:

cp config.example.json config.json

Minimal config (stdio, default):

{
  "databases": [
    {
      "id": "main_pg",
      "type": "postgresql",
      "host": "localhost",
      "port": 5432,
      "database": "myapp",
      "user": "admin",
      "password": "secret123"
    }
  ]
}

HTTP transport config:

{
  "transport": {
    "type": "http",
    "port": 3000,
    "host": "127.0.0.1",
    "stateless": false,
    "auth": {
      "type": "bearer",
      "token": "your-secret-token"
    }
  },
  "databases": [
    {
      "id": "main_pg",
      "type": "postgresql",
      "host": "localhost",
      "port": 5432,
      "database": "myapp",
      "user": "admin",
      "password": "secret123"
    }
  ]
}

Run

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.