docs(mcp): update docs for connection CRUD tools and SQLite storage
- Add dbx_add_connection and dbx_remove_connection to all docs - Update storage references from JSON files to SQLite (dbx.db) - Bump MCP server version to 0.2.0
This commit is contained in:
parent
4c97aa0516
commit
5a281a8216
|
|
@ -124,6 +124,35 @@ DBX MCP Server 提供以下工具,AI 助手会根据你的需求自动调用
|
|||
| `connection_name` | 是 | DBX 连接名称 |
|
||||
| `sql` | 是 | SQL 查询语句 |
|
||||
|
||||
### `dbx_add_connection`
|
||||
|
||||
添加新的数据库连接。
|
||||
|
||||
| 参数 | 必填 | 说明 |
|
||||
|---|---|---|
|
||||
| `name` | 是 | 连接名称 |
|
||||
| `db_type` | 是 | 数据库类型(postgres、mysql、sqlite、redis 等) |
|
||||
| `host` | 是 | 数据库主机 |
|
||||
| `port` | 是 | 数据库端口 |
|
||||
| `username` | 否 | 用户名 |
|
||||
| `password` | 否 | 密码 |
|
||||
| `database` | 否 | 默认数据库名 |
|
||||
| `ssl` | 否 | 是否启用 SSL(默认 false) |
|
||||
|
||||
**示例对话:**
|
||||
> "添加一个 PostgreSQL 连接,名称 prod-db,地址 db.example.com:5432"
|
||||
|
||||
### `dbx_remove_connection`
|
||||
|
||||
删除数据库连接。
|
||||
|
||||
| 参数 | 必填 | 说明 |
|
||||
|---|---|---|
|
||||
| `connection_name` | 是 | 要删除的连接名称 |
|
||||
|
||||
**示例对话:**
|
||||
> "删除 test-db 连接"
|
||||
|
||||
### `dbx_open_table`
|
||||
|
||||
在 DBX 桌面端打开指定表。**需要 DBX 正在运行。**
|
||||
|
|
@ -151,15 +180,13 @@ DBX 会自动新开一个 tab 显示数据,窗口自动置前。
|
|||
|
||||
### 连接配置
|
||||
|
||||
MCP Server 从 DBX 的配置目录读取连接信息:
|
||||
MCP Server 从 DBX 的 SQLite 数据库读取连接信息:
|
||||
|
||||
| 平台 | 路径 |
|
||||
|---|---|
|
||||
| macOS | `~/Library/Application Support/com.dbx.app/connections.json` |
|
||||
| Linux | `~/.config/com.dbx.app/connections.json` |
|
||||
| Windows | `%APPDATA%\com.dbx.app\connections.json` |
|
||||
|
||||
密码从系统钥匙串中获取(macOS Keychain / Linux Secret Service / Windows 凭据管理器)。
|
||||
| macOS | `~/Library/Application Support/com.dbx.app/dbx.db` |
|
||||
| Linux | `~/.config/com.dbx.app/dbx.db` |
|
||||
| Windows | `%APPDATA%\com.dbx.app\dbx.db` |
|
||||
|
||||
### UI 联动
|
||||
|
||||
|
|
|
|||
|
|
@ -124,6 +124,35 @@ Execute a SQL query and return results (max 100 rows).
|
|||
| `connection_name` | Yes | DBX connection name |
|
||||
| `sql` | Yes | SQL query |
|
||||
|
||||
### `dbx_add_connection`
|
||||
|
||||
Add a new database connection to DBX.
|
||||
|
||||
| Parameter | Required | Description |
|
||||
|---|---|---|
|
||||
| `name` | Yes | Connection name |
|
||||
| `db_type` | Yes | Database type (postgres, mysql, sqlite, redis, etc.) |
|
||||
| `host` | Yes | Database host |
|
||||
| `port` | Yes | Database port |
|
||||
| `username` | No | Username |
|
||||
| `password` | No | Password |
|
||||
| `database` | No | Default database name |
|
||||
| `ssl` | No | Enable 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.
|
||||
|
||||
| Parameter | Required | Description |
|
||||
|---|---|---|
|
||||
| `connection_name` | Yes | Name 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.**
|
||||
|
|
@ -151,15 +180,13 @@ Execute a SQL query in DBX desktop app UI. **Requires DBX to be running.**
|
|||
|
||||
### Connection Configs
|
||||
|
||||
The MCP Server reads DBX's connection config files:
|
||||
The MCP Server reads DBX's SQLite database:
|
||||
|
||||
| Platform | Path |
|
||||
|---|---|
|
||||
| macOS | `~/Library/Application Support/com.dbx.app/connections.json` |
|
||||
| Linux | `~/.config/com.dbx.app/connections.json` |
|
||||
| Windows | `%APPDATA%\com.dbx.app\connections.json` |
|
||||
|
||||
Passwords are retrieved from the system keyring (macOS Keychain / Linux Secret Service / Windows Credential Manager).
|
||||
| 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
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ MCP server for [DBX](https://github.com/t8y2/dbx) — lets AI agents (Claude Cod
|
|||
## Features
|
||||
|
||||
- **Zero config** — Automatically reads your DBX connections (including passwords from system keyring)
|
||||
- **5 tools** — List connections, list tables, describe table, execute SQL, open table in DBX UI
|
||||
- **7 tools** — List/add/remove connections, list tables, describe table, execute SQL, open table in DBX UI
|
||||
- **Connection pooling** — Reuses database connections across queries
|
||||
- **PostgreSQL & MySQL** — Supports PostgreSQL, MySQL, and compatible databases (Doris, StarRocks, etc.)
|
||||
- **DBX UI integration** — Open tables directly in the DBX desktop app from your AI agent
|
||||
|
|
@ -69,6 +69,8 @@ In Claude Code, just ask:
|
|||
| Tool | Description |
|
||||
|---|---|
|
||||
| `dbx_list_connections` | List all database connections configured in DBX |
|
||||
| `dbx_add_connection` | Add a new database connection |
|
||||
| `dbx_remove_connection` | Remove a database connection |
|
||||
| `dbx_list_tables` | List tables and views for a connection |
|
||||
| `dbx_describe_table` | Get column definitions for a table |
|
||||
| `dbx_execute_query` | Execute a SQL query (max 100 rows) |
|
||||
|
|
@ -79,17 +81,14 @@ In Claude Code, just ask:
|
|||
```
|
||||
AI Agent → MCP Server → Database
|
||||
↓
|
||||
DBX connections.json
|
||||
+ system keyring (passwords)
|
||||
DBX SQLite database (dbx.db)
|
||||
```
|
||||
|
||||
The MCP server reads your database connections from DBX's config directory:
|
||||
The MCP server reads your database connections from DBX's SQLite database:
|
||||
|
||||
- **macOS**: `~/Library/Application Support/com.dbx.app/connections.json`
|
||||
- **Linux**: `~/.config/com.dbx.app/connections.json`
|
||||
- **Windows**: `%APPDATA%\com.dbx.app\connections.json`
|
||||
|
||||
Passwords are retrieved from the system keyring (macOS Keychain / Linux Secret Service / Windows Credential Manager).
|
||||
- **macOS**: `~/Library/Application Support/com.dbx.app/dbx.db`
|
||||
- **Linux**: `~/.config/com.dbx.app/dbx.db`
|
||||
- **Windows**: `%APPDATA%\com.dbx.app\dbx.db`
|
||||
|
||||
## DBX UI Integration
|
||||
|
||||
|
|
@ -112,8 +111,8 @@ MIT
|
|||
|
||||
### 特性
|
||||
|
||||
- **零配置** — 自动读取 DBX 的连接配置(包括系统钥匙串中的密码)
|
||||
- **5 个工具** — 列出连接、列出表、查看表结构、执行 SQL、在 DBX 中打开表
|
||||
- **零配置** — 自动读取 DBX 的连接配置
|
||||
- **7 个工具** — 列出/添加/删除连接、列出表、查看表结构、执行 SQL、在 DBX 中打开表
|
||||
- **连接池** — 跨查询复用数据库连接
|
||||
- **PostgreSQL 和 MySQL** — 支持 PostgreSQL、MySQL 及兼容数据库(Doris、StarRocks 等)
|
||||
- **DBX UI 联动** — 从 AI 助手直接在 DBX 桌面端打开表
|
||||
|
|
@ -161,6 +160,8 @@ npx @dbx-app/mcp-server
|
|||
| 工具 | 说明 |
|
||||
|---|---|
|
||||
| `dbx_list_connections` | 列出 DBX 中所有已配置的数据库连接 |
|
||||
| `dbx_add_connection` | 添加新的数据库连接 |
|
||||
| `dbx_remove_connection` | 删除数据库连接 |
|
||||
| `dbx_list_tables` | 列出指定连接的表和视图 |
|
||||
| `dbx_describe_table` | 获取表的列定义 |
|
||||
| `dbx_execute_query` | 执行 SQL 查询(最多返回 100 行) |
|
||||
|
|
@ -168,13 +169,11 @@ npx @dbx-app/mcp-server
|
|||
|
||||
### 工作原理
|
||||
|
||||
MCP Server 从 DBX 的配置目录读取连接信息:
|
||||
MCP Server 从 DBX 的 SQLite 数据库读取连接信息:
|
||||
|
||||
- **macOS**: `~/Library/Application Support/com.dbx.app/connections.json`
|
||||
- **Linux**: `~/.config/com.dbx.app/connections.json`
|
||||
- **Windows**: `%APPDATA%\com.dbx.app\connections.json`
|
||||
|
||||
密码从系统钥匙串中获取(macOS Keychain / Linux Secret Service / Windows 凭据管理器)。
|
||||
- **macOS**: `~/Library/Application Support/com.dbx.app/dbx.db`
|
||||
- **Linux**: `~/.config/com.dbx.app/dbx.db`
|
||||
- **Windows**: `%APPDATA%\com.dbx.app\dbx.db`
|
||||
|
||||
### DBX UI 联动
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@dbx-app/mcp-server",
|
||||
"version": "0.1.3",
|
||||
"version": "0.2.0",
|
||||
"mcpName": "io.github.t8y2/dbx",
|
||||
"description": "MCP server for DBX \u2014 query databases from Claude Code, Cursor, and other AI agents",
|
||||
"type": "module",
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
{
|
||||
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
||||
"name": "io.github.t8y2/dbx",
|
||||
"description": "Query databases from AI agents using connections configured in DBX.",
|
||||
"description": "Query and manage databases from AI agents using connections configured in DBX.",
|
||||
"repository": {
|
||||
"url": "https://github.com/t8y2/dbx",
|
||||
"source": "github"
|
||||
},
|
||||
"version": "0.1.3",
|
||||
"version": "0.2.0",
|
||||
"packages": [
|
||||
{
|
||||
"registryType": "npm",
|
||||
"identifier": "@dbx-app/mcp-server",
|
||||
"version": "0.1.3",
|
||||
"version": "0.2.0",
|
||||
"transport": {
|
||||
"type": "stdio"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ function mdTable(headers: string[], rows: string[][]): string {
|
|||
|
||||
const server = new McpServer({
|
||||
name: "dbx",
|
||||
version: "0.1.1",
|
||||
version: "0.2.0",
|
||||
});
|
||||
|
||||
server.tool(
|
||||
|
|
|
|||
Loading…
Reference in New Issue