DBXDBX

MCP Integration

Let AI coding agents query your databases through the Model Context Protocol.

One line of config to let AI coding agents query your databases directly. Works with Claude Code, Cursor, Windsurf, and VS Code Copilot.

What is MCP?

MCP (Model Context Protocol) is an open protocol that lets AI coding agents call external tools. DBX's MCP Server exposes your database connections to AI agents, so you can query databases using natural language — the AI generates and executes SQL automatically.

You: "Show me the order volume trend for the last 7 days"

AI Agent → MCP Server → Your Database → Results

         DBX connection configs (with passwords)

Quick Start

Install the MCP Server

npm install -g @dbx-app/mcp-server

Configure Your AI Agent

Create .mcp.json in your working directory:

{
  "mcpServers": {
    "dbx": {
      "command": "npx",
      "args": ["-y", "@dbx-app/mcp-server"]
    }
  }
}

Start Using

Just ask your AI agent in natural language:

  • "List my database connections"
  • "Show the tables in my local-pg connection"
  • "Describe the users table"
  • "Query the average salary from employees"
  • "Open the orders table" (requires DBX running)

Supported AI Agents

AgentConfiguration
Claude Code.mcp.json (native support)
Cursor.cursor/mcp.json
Windsurf.windsurfrules
VS Code + CopilotMCP extension

Tools

DBX MCP Server provides the following tools. Your AI agent calls them automatically based on your requests:

dbx_list_connections

List all database connections configured in DBX.

Example:

"List my database connections"

Response:

| Name     | Type     | Host      | Port | Database |
| -------- | -------- | --------- | ---- | -------- |
| local-pg | postgres | 127.0.0.1 | 5432 |          |
| prod-db  | mysql    | db.example| 3306 | myapp    |

dbx_list_tables

List tables and views for a connection.

ParameterRequiredDescription
connection_nameYesDBX connection name
schemaNoSchema name (default: public)

dbx_describe_table

Get column definitions for a table. The AI uses this to understand your data structure before generating queries.

ParameterRequiredDescription
connection_nameYesDBX connection name
tableYesTable name
schemaNoSchema name (default: public)

Response:

| Column      | Type      | Nullable | Default | Comment    |
| ----------- | --------- | -------- | ------- | ---------- |
| id (PK)     | integer   | NO       |         |            |
| user_id     | integer   | NO       |         | User ID    |
| total       | numeric   | NO       | 0       | Order total|
| created_at  | timestamp | NO       | now()   |            |

dbx_execute_query

Execute a SQL query and return results (max 100 rows).

ParameterRequiredDescription
connection_nameYesDBX connection name
sqlYesSQL query

dbx_get_schema_context

Return compact table and column context for SQL generation.

ParameterRequiredDescription
connection_nameYesDBX connection name
schemaNoSchema name
tablesNoSpecific table names to include
max_tablesNoMaximum number of tables to include; capped between 1 and 20

dbx_add_connection

Add a new database connection to DBX.

ParameterRequiredDescription
nameYesConnection name
db_typeYesDatabase type (postgres, mysql, sqlite, redis, etc.)
hostYesDatabase host
portYesDatabase port
usernameNoUsername
passwordNoPassword
databaseNoDefault database name
sslNoEnable SSL (default: false)

Example:

"Add a PostgreSQL connection named prod-db on db.example.com:5432"

dbx_remove_connection

Remove a database connection from DBX.

ParameterRequiredDescription
connection_nameYesName of the connection to remove

Example:

"Remove the test-db connection"

dbx_open_table

Open a table in DBX desktop app UI. Requires DBX to be running.

ParameterRequiredDescription
connection_nameYesDBX connection name
tableYesTable name
databaseNoDatabase name
schemaNoSchema name

DBX opens a new tab with the table data and brings the window to front.

dbx_execute_and_show

Execute a SQL query in DBX desktop app UI. Requires DBX to be running.

ParameterRequiredDescription
connection_nameYesDBX connection name
sqlYesSQL query
databaseNoDatabase name

How It Works

Connection Configs

The MCP Server reads DBX's SQLite database:

PlatformPath
macOS~/Library/Application Support/com.dbx.app/dbx.db
Linux~/.config/com.dbx.app/dbx.db
Windows%APPDATA%\com.dbx.app\dbx.db

UI Integration

dbx_open_table and dbx_execute_and_show communicate with the running DBX app via a local HTTP interface:

AI Agent → MCP Server → HTTP localhost → DBX backend → Tauri event → Frontend opens tab

Supported Databases

MCP query support in desktop local mode is implemented for PostgreSQL, MySQL, and compatible databases. Web mode delegates to the DBX web backend configured by DBX_WEB_URL. UI integration such as opening a table supports all database types that the running DBX desktop app can open.

SQL Safety

MCP query execution is intentionally conservative:

RuleDefault
Empty or unrecognized SQLBlocked
More than one SQL statementBlocked
Non-read SQLBlocked unless writes are explicitly allowed
DROP, TRUNCATE, or ALTERBlocked unless dangerous SQL is explicitly allowed
UPDATE or DELETE without WHERE when writes are allowedBlocked

Set DBX_MCP_ALLOW_WRITES=1 to allow write statements. Set DBX_MCP_ALLOW_DANGEROUS_SQL=1 only in controlled environments where destructive SQL is expected.

Desktop And Web Mode

ModeHow It Is SelectedNotes
Desktop local modeDefaultReads DBX desktop connection storage and can call desktop-only UI bridge tools
Web modeSet DBX_WEB_URLSends requests to the DBX web backend instead of reading local desktop storage

FAQ

Requirements

  • DBX installed with at least one connection configured
  • Node.js 18+
  • UI integration requires DBX v0.3.9+

On this page