mcpField
D
db-view-mcp

db-view-mcp

Local
github.com/conte777Databases0Updated 12w ago

About db-view-mcp

db-view-mcp is an MCP server for accessing PostgreSQL and ClickHouse databases from AI assistants. It combines query, schema, and analysis tools with stdio and HTTP transports, plus SQL safeguards for read-only operations.

Key features

  1. 01Connect multiple PostgreSQL and ClickHouse databases
  2. 02Run read and write SQL operations
  3. 03Inspect schemas and export DDL
  4. 04Analyze queries and track slow queries
  5. 05Use stdio or HTTP transport

Use cases

  1. 01Query databases from an IDE-integrated assistant
  2. 02Provide remote database access over HTTP
  3. 03Inspect tables and columns before querying
  4. 04Review query plans and slow queries

MCP support

The server exposes database query, schema introspection, and query analysis tools to MCP clients. It supports stdio and HTTP transports, with optional bearer authentication for HTTP.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"db-view": {
"command": "npx",
"args": [
"-y",
"@conte777/db-view-mcp"
]
}
}
}
Run commandnpx -y @conte777/db-view-mcp

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@conte777/db-view-mcp

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

db-view-mcp

npm CI

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

Features

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

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

Quick start

1. Configure

Copy the example config and edit it:

cp config.example.json config.json

Minimal stdio config:

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

Every field, default, and the full config reference (SSL/TLS, per-database overrides, environment substitution, HTTP transport) is in docs/configuration.md.

2. Run
# Stdio (default)
npm start -- --config config.json

# HTTP (set transport.type to "http" in config, or override on the CLI)
npm start -- --config config.json --transport http

# Development (no build needed)
npm run dev -- --config config.json
3. Add an MCP client

Claude Desktop (claude_desktop_config.json) or Claude Code (.mcp.json), stdio:

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

Any MCP client, HTTP:

node dist/index.js --config config.json --transport http
# Server listens on http://127.0.0.1:3000/mcp

See docs/http-transport.md for sessions, auth, and curl examples.

Documentation

DocContents
docs/configuration.mdEvery config field, defaults, SSL/TLS, rowFormat, env substitution, hot reload
docs/tools.mdThe 9 tools: params, output, examples, error codes, per-database mode
docs/http-transport.mdstdio vs HTTP, sessions, bearer auth, /health, curl
docs/security.mdRead-only SQL validator, deny-lists, response caps, network exposure
docs/architecture.mdSource tree, layers, connector model, lifecycle (hot reload, shutdown)
CONTRIBUTING.mdBuild, test, lint, hooks, CI

ClickHouse limitations

  • Transactions are not supported (transaction begin throws).
  • Query params are ignored — use ClickHouse's native {name:Type} syntax in the SQL.

Development

See CONTRIBUTING.md for build/test/lint commands, coverage thresholds, git hooks, and CI.

License

MIT

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.