docs: migrate from VitePress to Fumadocs (Next.js)

- Replace VitePress with Fumadocs + Next.js for documentation site
- Configure i18n (English + 简体中文) with language switcher
- Migrate all 17 guide documents to MDX format with updated content
- Add ocean theme, GitHub/Discord/QQ social links
- Update GitHub Actions workflow for Next.js static export
- Update .gitignore for .next, out, .source directories
This commit is contained in:
t8y2 2026-05-06 10:17:17 +08:00
parent 97eeab2801
commit 6a5a380fdd
65 changed files with 4647 additions and 3452 deletions

View File

@ -22,10 +22,13 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 22
- run: cd docs && npm ci && npm run build
- uses: pnpm/action-setup@v4
with:
version: 10
- run: cd docs && pnpm install --frozen-lockfile && pnpm build
- uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist
path: docs/out
deploy:
needs: build

3
.gitignore vendored
View File

@ -6,6 +6,9 @@ node_modules/
# Build output
dist/
/target/
docs/.next/
docs/out/
docs/.source/
# OS files
.DS_Store

View File

@ -1,160 +0,0 @@
import { defineConfig } from 'vitepress'
export default defineConfig({
title: 'DBX',
description: '25+ databases in 15 MB. Desktop & Docker self-hosting, with built-in AI assistant.',
base: '/dbx/',
head: [
['link', { rel: 'icon', href: '/dbx/logo.png' }],
],
locales: {
root: {
label: 'English',
lang: 'en',
themeConfig: {
nav: [
{ text: 'Guide', link: '/guide/what-is-dbx' },
{
text: 'Features',
items: [
{ text: 'Database Support', link: '/guide/databases' },
{ text: 'Query Editor', link: '/guide/query-editor' },
{ text: 'Data Grid', link: '/guide/data-grid' },
{ text: 'Schema Diff', link: '/guide/schema-diff' },
{ text: 'Data Transfer', link: '/guide/data-transfer' },
{ text: 'AI Assistant', link: '/guide/ai-assistant' },
{ text: 'MCP Integration', link: '/guide/mcp' },
],
},
{ text: 'Changelog', link: 'https://github.com/t8y2/dbx/releases' },
{ text: 'Download', link: 'https://github.com/t8y2/dbx/releases' },
],
sidebar: [
{
text: 'Introduction',
items: [
{ text: 'What is DBX?', link: '/guide/what-is-dbx' },
{ text: 'Getting Started', link: '/guide/getting-started' },
{ text: 'Database Support', link: '/guide/databases' },
],
},
{
text: 'Core Features',
items: [
{ text: 'Query Editor', link: '/guide/query-editor' },
{ text: 'Data Grid', link: '/guide/data-grid' },
{ text: 'Schema Browser', link: '/guide/schema-browser' },
],
},
{
text: 'Advanced Features',
items: [
{ text: 'Schema Diff', link: '/guide/schema-diff' },
{ text: 'Data Transfer', link: '/guide/data-transfer' },
{ text: 'Table Structure Editor', link: '/guide/table-structure' },
{ text: 'Field Lineage', link: '/guide/field-lineage' },
{ text: 'Table Import', link: '/guide/table-import' },
{ text: 'SQL File Execution', link: '/guide/sql-file' },
{ text: 'Database Export', link: '/guide/database-export' },
],
},
{
text: 'AI & Automation',
items: [
{ text: 'AI Assistant', link: '/guide/ai-assistant' },
{ text: 'MCP Integration', link: '/guide/mcp' },
],
},
{
text: 'Settings',
items: [
{ text: 'Config Export/Import', link: '/guide/config-export' },
{ text: 'SSH Tunnel', link: '/guide/ssh-tunnel' },
],
},
],
},
},
'zh-CN': {
label: '简体中文',
lang: 'zh-CN',
themeConfig: {
nav: [
{ text: '指南', link: '/zh-CN/guide/what-is-dbx' },
{
text: '功能',
items: [
{ text: '数据库支持', link: '/zh-CN/guide/databases' },
{ text: '查询编辑器', link: '/zh-CN/guide/query-editor' },
{ text: '数据表格', link: '/zh-CN/guide/data-grid' },
{ text: 'Schema 对比', link: '/zh-CN/guide/schema-diff' },
{ text: '数据传输', link: '/zh-CN/guide/data-transfer' },
{ text: 'AI 助手', link: '/zh-CN/guide/ai-assistant' },
{ text: 'MCP 集成', link: '/zh-CN/guide/mcp' },
],
},
{ text: '更新日志', link: 'https://github.com/t8y2/dbx/releases' },
{ text: '下载', link: 'https://github.com/t8y2/dbx/releases' },
],
sidebar: [
{
text: '介绍',
items: [
{ text: '什么是 DBX', link: '/zh-CN/guide/what-is-dbx' },
{ text: '快速开始', link: '/zh-CN/guide/getting-started' },
{ text: '数据库支持', link: '/zh-CN/guide/databases' },
],
},
{
text: '核心功能',
items: [
{ text: '查询编辑器', link: '/zh-CN/guide/query-editor' },
{ text: '数据表格', link: '/zh-CN/guide/data-grid' },
{ text: '结构浏览', link: '/zh-CN/guide/schema-browser' },
],
},
{
text: '高级功能',
items: [
{ text: 'Schema 对比', link: '/zh-CN/guide/schema-diff' },
{ text: '数据传输', link: '/zh-CN/guide/data-transfer' },
{ text: '表结构编辑器', link: '/zh-CN/guide/table-structure' },
{ text: '字段血缘', link: '/zh-CN/guide/field-lineage' },
{ text: '表数据导入', link: '/zh-CN/guide/table-import' },
{ text: 'SQL 文件执行', link: '/zh-CN/guide/sql-file' },
{ text: '数据库导出', link: '/zh-CN/guide/database-export' },
],
},
{
text: 'AI 与自动化',
items: [
{ text: 'AI 助手', link: '/zh-CN/guide/ai-assistant' },
{ text: 'MCP 集成', link: '/zh-CN/guide/mcp' },
],
},
{
text: '设置',
items: [
{ text: '配置导出/导入', link: '/zh-CN/guide/config-export' },
{ text: 'SSH 隧道', link: '/zh-CN/guide/ssh-tunnel' },
],
},
],
},
},
},
themeConfig: {
logo: '/logo.png',
socialLinks: [
{ icon: 'github', link: 'https://github.com/t8y2/dbx' },
{ icon: 'npm', link: 'https://www.npmjs.com/package/@dbx-app/mcp-server' },
],
footer: {
message: 'Released under the AGPL-3.0 License.',
copyright: 'Copyright © 2024-present DBX Contributors',
},
search: {
provider: 'local',
},
},
})

View File

@ -0,0 +1,43 @@
import { source } from '@/lib/source';
import { notFound } from 'next/navigation';
import {
DocsPage,
DocsBody,
DocsTitle,
DocsDescription,
} from 'fumadocs-ui/page';
import defaultMdxComponents from 'fumadocs-ui/mdx';
import type { MDXContent } from 'mdx/types';
import type { TOCItemType } from 'fumadocs-core/toc';
export default async function Page({
params,
}: {
params: Promise<{ lang: string; slug?: string[] }>;
}) {
const { lang, slug } = await params;
const page = source.getPage(slug, lang);
if (!page) notFound();
const { body: MDX, toc } = page.data as unknown as {
body: MDXContent;
toc: TOCItemType[];
};
return (
<DocsPage toc={toc}>
<DocsTitle>{page.data.title}</DocsTitle>
<DocsDescription>{page.data.description}</DocsDescription>
<DocsBody>
<MDX components={{ ...defaultMdxComponents }} />
</DocsBody>
</DocsPage>
);
}
export function generateStaticParams() {
return source.generateParams().map((params) => ({
lang: params.lang,
slug: params.slug,
}));
}

View File

@ -0,0 +1,67 @@
import type { ReactNode } from 'react';
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
import { source } from '@/lib/source';
function DiscordIcon() {
return (
<svg viewBox="0 0 24 24" fill="currentColor" width="1em" height="1em">
<path d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z" />
</svg>
);
}
function QQIcon() {
return (
<svg viewBox="0 0 120 145" fill="currentColor" width="1em" height="1em">
<path d="M60.503 142.237c-12.533 0-24.038-4.195-31.445-10.46-3.762 1.124-8.574 2.932-11.61 5.175-2.6 1.918-2.275 3.874-1.807 4.663 2.056 3.47 35.273 2.216 44.862 1.136zm0 0c12.535 0 24.039-4.195 31.447-10.46 3.76 1.124 8.573 2.932 11.61 5.175 2.598 1.918 2.274 3.874 1.805 4.663-2.056 3.47-35.272 2.216-44.862 1.136zm0 0" />
<path d="M60.576 67.119c20.698-.14 37.286-4.147 42.907-5.683 1.34-.367 2.056-1.024 2.056-1.024.005-.189.085-3.37.085-5.01C105.624 27.768 92.58.001 60.5 0 28.42.001 15.375 27.769 15.375 55.401c0 1.642.08 4.822.086 5.01 0 0 .583.615 1.65.913 5.19 1.444 22.09 5.65 43.312 5.795zm56.245 23.02c-1.283-4.129-3.034-8.944-4.808-13.568 0 0-1.02-.126-1.537.023-15.913 4.623-35.202 7.57-49.9 7.392h-.153c-14.616.175-33.774-2.737-49.634-7.315-.606-.175-1.802-.1-1.802-.1-1.774 4.624-3.525 9.44-4.808 13.568-6.119 19.69-4.136 27.838-2.627 28.02 3.239.392 12.606-14.821 12.606-14.821 0 15.459 13.957 39.195 45.918 39.413h.848c31.96-.218 45.917-23.954 45.917-39.413 0 0 9.368 15.213 12.607 14.822 1.508-.183 3.491-8.332-2.627-28.021" />
<path fill="#fff" d="M49.085 40.824c-4.352.197-8.07-4.76-8.304-11.063-.236-6.305 3.098-11.576 7.45-11.773 4.347-.195 8.064 4.76 8.3 11.065.238 6.306-3.097 11.577-7.446 11.771m31.133-11.063c-.233 6.302-3.951 11.26-8.303 11.063-4.35-.195-7.684-5.465-7.446-11.77.236-6.305 3.952-11.26 8.3-11.066 4.352.197 7.686 5.468 7.449 11.773" />
</svg>
);
}
export default async function Layout({
params,
children,
}: {
params: Promise<{ lang: string }>;
children: ReactNode;
}) {
const { lang } = await params;
return (
<DocsLayout
tree={source.getPageTree(lang)}
nav={{
title: (
<div className="flex items-center gap-2">
<img src="/dbx/logo.png" alt="DBX" width={24} height={24} />
<span className="font-semibold">DBX</span>
</div>
),
}}
githubUrl="https://github.com/t8y2/dbx"
links={[
{
type: 'icon',
icon: <DiscordIcon />,
text: 'Discord',
url: 'https://discord.gg/W7NyVDRt6a',
external: true,
},
{
type: 'icon',
icon: <QQIcon />,
text: 'QQ',
url: 'https://qm.qq.com/cgi-bin/qm/qr?k=&group_code=1087880322',
external: true,
},
]}
sidebar={{
defaultOpenLevel: 1,
}}
>
{children}
</DocsLayout>
);
}

View File

@ -0,0 +1,27 @@
import type { ReactNode } from 'react';
import { RootProvider } from 'fumadocs-ui/provider/next';
import { i18nUI } from '@/lib/i18n';
export default async function LangLayout({
params,
children,
}: {
params: Promise<{ lang: string }>;
children: ReactNode;
}) {
const { lang } = await params;
return (
<html lang={lang} suppressHydrationWarning>
<body className="flex min-h-screen flex-col">
<RootProvider i18n={i18nUI.provider(lang)}>
{children}
</RootProvider>
</body>
</html>
);
}
export function generateStaticParams() {
return [{ lang: 'en' }, { lang: 'cn' }];
}

10
docs/app/[lang]/page.tsx Normal file
View File

@ -0,0 +1,10 @@
import { redirect } from 'next/navigation';
export default async function LangPage({
params,
}: {
params: Promise<{ lang: string }>;
}) {
const { lang } = await params;
redirect(`/${lang}/docs/what-is-dbx`);
}

3
docs/app/global.css Normal file
View File

@ -0,0 +1,3 @@
@import 'tailwindcss';
@import 'fumadocs-ui/css/ocean.css';
@import 'fumadocs-ui/css/preset.css';

15
docs/app/layout.tsx Normal file
View File

@ -0,0 +1,15 @@
import './global.css';
import type { ReactNode } from 'react';
export const metadata = {
title: {
default: 'DBX',
template: '%s | DBX',
},
description: '25+ databases in 15 MB. Desktop & Docker self-hosting, with built-in AI assistant.',
icons: { icon: '/dbx/logo.png' },
};
export default function RootLayout({ children }: { children: ReactNode }) {
return children;
}

5
docs/app/page.tsx Normal file
View File

@ -0,0 +1,5 @@
import { redirect } from 'next/navigation';
export default function Page() {
redirect('/cn');
}

View File

@ -1,4 +1,7 @@
# AI 助手
---
title: AI 助手
description: 内置 AI 助手,帮你编写、解释、优化和修复 SQL 查询。
---
DBX 内置 AI 助手,帮你编写、解释、优化和修复 SQL 查询。
@ -6,7 +9,7 @@ DBX 内置 AI 助手,帮你编写、解释、优化和修复 SQL 查询。
1. 点击工具栏的 **设置** 图标
2. 进入 **AI 设置**
3. 选择供应商Claude 或 OpenAI
3. 选择供应商Claude、OpenAI 或自定义端点
4. 输入 API Key
5. 选择模型
@ -38,8 +41,10 @@ AI 助手会根据你的数据库结构生成 SQL。
|---|---|
| Anthropic (Claude) | Claude 4 Opus、Claude 4 Sonnet、Claude 3.5 Haiku |
| OpenAI | GPT-4o、GPT-4o-mini、o3-mini |
| 兼容接口 | 任何 OpenAI 兼容的 API 端点 |
| 自定义端点 | 任何 OpenAI 兼容的 API 端点 |
你可以配置自定义的 OpenAI 兼容端点(自定义端点),连接第三方或自托管的 AI 服务。只需在 AI 设置中选择"自定义端点",填入 API 地址和 Key 即可。
## 更强大的 AI 体验
除了内置 AI 助手,还可以试试 [MCP 集成](/zh-CN/guide/mcp)。它让 Claude Code、Cursor 等 AI 编程助手直接查询你的数据库,并在 DBX 中打开结果。
除了内置 AI 助手,还可以试试 [MCP 集成](/cn/docs/mcp)。它让 Claude Code、Cursor 等 AI 编程助手直接查询你的数据库,并在 DBX 中打开结果。

View File

@ -1,3 +1,8 @@
---
title: AI Assistant
description: Built-in AI assistant for writing, explaining, optimizing, and fixing SQL queries.
---
# AI Assistant
DBX has a built-in AI assistant that helps you write, explain, optimize, and fix SQL queries.
@ -6,8 +11,8 @@ DBX has a built-in AI assistant that helps you write, explain, optimize, and fix
1. Click the **Settings** icon in the toolbar
2. Go to **AI Settings**
3. Choose your provider (Claude or OpenAI)
4. Enter your API key
3. Choose your provider (Claude, OpenAI, or a custom OpenAI-compatible endpoint)
4. Enter your API key (and endpoint URL for custom providers)
5. Select a model
## Features
@ -38,8 +43,8 @@ When a query fails, click **Fix with AI** to get a corrected version.
|---|---|
| Anthropic (Claude) | Claude 4 Opus, Claude 4 Sonnet, Claude 3.5 Haiku |
| OpenAI | GPT-4o, GPT-4o-mini, o3-mini |
| Compatible | Any OpenAI-compatible API endpoint |
| Custom / OpenAI-compatible | Any endpoint that implements the OpenAI chat completions API (e.g., Ollama, LM Studio, Azure OpenAI, self-hosted models) |
## Beyond Built-in AI
For a more powerful AI-driven database experience, try the [MCP integration](/guide/mcp). It lets AI coding agents like Claude Code and Cursor directly query your databases and open results in DBX.
For a more powerful AI-driven database experience, try the [MCP integration](/docs/mcp). It lets AI coding agents like Claude Code and Cursor directly query your databases and open results in DBX.

View File

@ -1,17 +1,20 @@
# 配置导出/导入
---
title: 配置导出/导入
description: 导出数据库连接配置(含加密密码),方便在不同电脑之间迁移。
---
导出数据库连接配置(含加密密码),方便在不同电脑之间迁移。
## 导出
1. 点击侧边栏顶部的 **导出** 按钮(↓)
1. 点击侧边栏顶部的 **导出** 按钮
2. 输入密码短语来加密连接密码
3. 选择保存位置
4. 导出文件包含所有连接及密码,已加密
## 导入
1. 点击侧边栏顶部的 **导入** 按钮(↑)
1. 点击侧边栏顶部的 **导入** 按钮
2. 选择导出的文件
3. 如果文件已加密,输入密码短语
4. 连接导入完成,密码自动恢复

View File

@ -1,17 +1,22 @@
---
title: Config Export/Import
description: Export and import database connections with encrypted passwords to migrate between machines.
---
# Config Export/Import
Export your database connections (with encrypted passwords) to migrate between machines.
## Export
1. Click the **Export** button (↓) in the sidebar header
1. Click the **Export** button in the sidebar header
2. Enter a passphrase to encrypt your passwords
3. Choose a save location
4. The exported file contains all connections with passwords, encrypted
## Import
1. Click the **Import** button (↑) in the sidebar header
1. Click the **Import** button in the sidebar header
2. Select the exported file
3. If encrypted, enter the passphrase
4. Connections are imported with passwords restored

View File

@ -1,4 +1,7 @@
# 数据表格
---
title: 数据表格
description: 浏览和编辑表中的数据,支持虚拟滚动、行内编辑、排序过滤和多种格式导出。
---
DBX 的数据表格组件用于浏览和编辑表中的数据,支持大数据量虚拟滚动、行内编辑、排序过滤以及多种格式导出。

View File

@ -1,3 +1,8 @@
---
title: Data Grid
description: Browse, edit, and export query results in a high-performance spreadsheet-like interface.
---
# Data Grid
The Data Grid displays query results and table data in a high-performance, spreadsheet-like interface. It supports browsing large datasets, inline editing, and exporting data in multiple formats.

View File

@ -1,4 +1,7 @@
# 数据传输
---
title: 数据传输
description: 在不同数据库引擎之间传输数据,支持跨引擎迁移。
---
DBX 支持在不同数据库引擎之间传输数据,例如将 MySQL 中的数据迁移到 PostgreSQL或从 SQLite 导入数据到 SQL Server。

View File

@ -1,3 +1,8 @@
---
title: Data Transfer
description: Move data between database connections, even across different database engines.
---
# Data Transfer
Data Transfer moves data between two database connections, even when they use different database engines. This is useful for migrating data, populating a development environment, or consolidating data from multiple sources.

View File

@ -1,4 +1,7 @@
# 数据库导出
---
title: 数据库导出
description: 将整个数据库导出为 SQL 文件,包含表结构和数据,适用于备份和迁移。
---
DBX 支持将整个数据库导出为 SQL 文件包含表结构DDL和数据适用于数据库备份和迁移。

View File

@ -1,3 +1,8 @@
---
title: Database Export
description: Generate SQL dump files with table definitions and row data.
---
# Database Export
Database Export generates a SQL dump of your database, including table definitions (DDL) and row data. The output is a `.sql` file that can be used to recreate the database or transfer it to another environment.
@ -35,4 +40,4 @@ Set the row limit to `0` or leave it blank to export all rows.
3. Choose the output file location.
4. Start the export.
The generated `.sql` file can be executed in DBX using the [SQL File Execution](./sql-file.md) feature, or in any compatible database client.
The generated `.sql` file can be executed in DBX using the [SQL File Execution](/docs/sql-file) feature, or in any compatible database client.

View File

@ -1,6 +1,9 @@
# 数据库支持
---
title: 数据库支持
description: DBX 通过 Rust 原生驱动支持 25+ 种数据库。
---
DBX 通过 Rust 原生驱动支持 13+ 种数据库。
DBX 通过 Rust 原生驱动支持 25+ 种数据库。
## 完整支持
@ -46,6 +49,4 @@ DBX 通过 Rust 原生驱动支持 13+ 种数据库。
| CockroachDB | 26257 | |
| DM达梦 | 5236 | 需开启 PG 兼容模式 |
::: tip 达梦数据库说明
达梦数据库需要开启 PG 兼容模式。在 `dm.ini` 中设置 `COMPATIBLE_MODE=7` 并重启服务。
:::
**达梦数据库说明:** 达梦数据库需要开启 PG 兼容模式。在 `dm.ini` 中设置 `COMPATIBLE_MODE=7` 并重启服务。

View File

@ -1,6 +1,11 @@
---
title: Database Support
description: DBX supports 25+ database engines through native Rust drivers.
---
# Database Support
DBX supports 13+ database engines through native Rust drivers.
DBX supports 25+ database engines through native Rust drivers.
## Fully Supported
@ -46,6 +51,5 @@ These databases use PostgreSQL protocol and work with the PostgreSQL driver:
| CockroachDB | 26257 | |
| DM (Dameng) | 5236 | Requires PG compatibility mode |
::: tip DM (Dameng) Note
DM database requires PG compatibility mode to be enabled. Set `COMPATIBLE_MODE=7` in `dm.ini` and restart the service.
:::
> **DM (Dameng) Note:**
> DM database requires PG compatibility mode to be enabled. Set `COMPATIBLE_MODE=7` in `dm.ini` and restart the service.

View File

@ -1,4 +1,7 @@
# 字段血缘
---
title: 字段血缘
description: 理解数据库中字段之间的关联关系,追踪数据的来源和去向。
---
字段血缘功能帮助你理解数据库中字段之间的关联关系追踪数据的来源和去向。DBX 会从多个维度自动分析字段之间的关联,并标注置信度。

View File

@ -1,3 +1,8 @@
---
title: Field Lineage
description: Trace column relationships across foreign keys, views, and query history.
---
# Field Lineage
Field Lineage helps you understand how columns in your database relate to each other. It traces relationships across foreign keys, views, and query history to give you a complete picture of where data comes from and where it flows.

View File

@ -1,4 +1,7 @@
# 快速开始
---
title: 快速开始
description: 安装 DBX 并创建你的第一个数据库连接。
---
## 安装
@ -27,15 +30,18 @@ scoop install dbx
scoop update dbx
```
### macOS 说明
### Docker 自托管
DBX 未使用 Apple 开发者证书签名,首次打开时 macOS 会阻止运行。解决方法
你也可以通过 Docker 部署 DBX适合团队共享和服务器环境
```bash
xattr -cr /Applications/DBX.app
docker run -d \
--name dbx \
-p 3000:3000 \
ghcr.io/t8y2/dbx:latest
```
或者:**系统设置 → 隐私与安全性 → 仍要打开**。
部署后通过浏览器访问 `http://localhost:3000` 即可使用
## 创建第一个连接
@ -59,7 +65,7 @@ xattr -cr /Applications/DBX.app
git clone https://github.com/t8y2/dbx.git
cd dbx
pnpm install
pnpm tauri dev
pnpm dev:tauri
```
### 构建

View File

@ -1,3 +1,8 @@
---
title: Getting Started
description: Install DBX and create your first database connection.
---
# Getting Started
## Install
@ -27,15 +32,31 @@ Update:
scoop update dbx
```
### macOS Note
### Docker (Self-Hosted)
DBX is not signed with an Apple Developer certificate. On first launch, macOS will block the app. To fix:
You can run DBX as a self-hosted web application using Docker:
```bash
xattr -cr /Applications/DBX.app
docker run -d --name dbx -p 3000:3000 ghcr.io/t8y2/dbx:latest
```
Or: **System Settings → Privacy & Security → Open Anyway**.
Then open `http://localhost:3000` in your browser.
For Docker Compose:
```yaml
services:
dbx:
image: ghcr.io/t8y2/dbx:latest
ports:
- "3000:3000"
volumes:
- dbx-data:/data
restart: unless-stopped
volumes:
dbx-data:
```
## Create Your First Connection
@ -59,7 +80,7 @@ Or: **System Settings → Privacy & Security → Open Anyway**.
git clone https://github.com/t8y2/dbx.git
cd dbx
pnpm install
pnpm tauri dev
pnpm dev:tauri
```
### Build

View File

@ -1,4 +1,7 @@
# MCP 集成
---
title: MCP 集成
description: 通过 MCP 协议让 AI 编程助手直接查询你的数据库。
---
## 什么是 MCP
@ -49,10 +52,10 @@ npm install -g @dbx-app/mcp-server
| 助手 | 支持情况 | 配置方式 |
|---|---|---|
| Claude Code | 原生支持 | `.mcp.json` |
| Cursor | 支持 | `.cursor/mcp.json` |
| Windsurf | 支持 | `.windsurfrules` |
| VS Code + Copilot | 支持 | MCP 扩展 |
| Claude Code | 原生支持 | `.mcp.json` |
| Cursor | 支持 | `.cursor/mcp.json` |
| Windsurf | 支持 | `.windsurfrules` |
| VS Code + Copilot | 支持 | MCP 扩展 |
## 工具列表
@ -161,16 +164,16 @@ MCP 查询支持 PostgreSQL 和 MySQL及兼容数据库Doris、StarRocks
## 常见问题
**MCP Server 连不上数据库**
: 检查 DBX 中该连接是否能正常连接。MCP Server 使用相同的连接配置和密码。
- 检查 DBX 中该连接是否能正常连接。MCP Server 使用相同的连接配置和密码。
**`dbx_open_table` 报 "DBX is not running"**
: 需要先启动 DBX 桌面应用。UI 联动功能依赖 DBX 运行时的本地 HTTP 服务。
- 需要先启动 DBX 桌面应用。UI 联动功能依赖 DBX 运行时的本地 HTTP 服务。
**连接名称找不到**
: 连接名称匹配不区分大小写,但需要和 DBX 中配置的名称一致。用 `dbx_list_connections` 查看所有可用名称。
- 连接名称匹配不区分大小写,但需要和 DBX 中配置的名称一致。用 `dbx_list_connections` 查看所有可用名称。
**查询超时**
: MCP Server 的查询超时为 30 秒。如果查询较慢,考虑添加索引或简化查询。
- MCP Server 的查询超时为 30 秒。如果查询较慢,考虑添加索引或简化查询。
## 系统要求

View File

@ -1,3 +1,8 @@
---
title: MCP Integration
description: Let AI coding agents query your databases through the Model Context Protocol.
---
# MCP Integration
## What is MCP?
@ -49,10 +54,10 @@ Just ask your AI agent:
| Agent | Status | Configuration |
|---|---|---|
| Claude Code | Native | `.mcp.json` |
| Cursor | Supported | `.cursor/mcp.json` |
| Windsurf | Supported | `.windsurfrules` |
| VS Code + Copilot | Supported | MCP extension |
| Claude Code | Native | `.mcp.json` |
| Cursor | Supported | `.cursor/mcp.json` |
| Windsurf | Supported | `.windsurfrules` |
| VS Code + Copilot | Supported | MCP extension |
## Tools
@ -161,16 +166,16 @@ MCP query support: PostgreSQL, MySQL, and compatible databases (Doris, StarRocks
## FAQ
**MCP Server can't connect to my database**
: Check that the connection works in DBX first. The MCP Server uses the same config and credentials.
: Check that the connection works in DBX first. The MCP Server uses the same config and credentials.
**`dbx_open_table` says "DBX is not running"**
: Start the DBX desktop app first. UI integration requires DBX's local HTTP service.
: Start the DBX desktop app first. UI integration requires DBX's local HTTP service.
**Connection name not found**
: Connection name matching is case-insensitive but must match exactly. Use `dbx_list_connections` to see all available names.
: Connection name matching is case-insensitive but must match exactly. Use `dbx_list_connections` to see all available names.
**Query timeout**
: MCP Server has a 30-second query timeout. Consider adding indexes or simplifying your query.
: MCP Server has a 30-second query timeout. Consider adding indexes or simplifying your query.
## Requirements

View File

@ -0,0 +1,27 @@
{
"title": "DBX 文档",
"pages": [
"---介绍---",
"what-is-dbx",
"getting-started",
"databases",
"---核心功能---",
"query-editor",
"data-grid",
"schema-browser",
"---高级功能---",
"schema-diff",
"data-transfer",
"table-structure",
"field-lineage",
"table-import",
"sql-file",
"database-export",
"---AI 与自动化---",
"ai-assistant",
"mcp",
"---设置---",
"config-export",
"ssh-tunnel"
]
}

View File

@ -0,0 +1,27 @@
{
"title": "DBX Docs",
"pages": [
"---Introduction---",
"what-is-dbx",
"getting-started",
"databases",
"---Core Features---",
"query-editor",
"data-grid",
"schema-browser",
"---Advanced Features---",
"schema-diff",
"data-transfer",
"table-structure",
"field-lineage",
"table-import",
"sql-file",
"database-export",
"---AI & Automation---",
"ai-assistant",
"mcp",
"---Settings---",
"config-export",
"ssh-tunnel"
]
}

View File

@ -1,4 +1,7 @@
# 查询编辑器
---
title: 查询编辑器
description: 基于 CodeMirror 6 的 SQL 查询编辑器,提供语法高亮、智能补全和快捷操作。
---
DBX 内置了基于 CodeMirror 6 的 SQL 查询编辑器,提供语法高亮、智能补全和快捷操作,帮助你高效编写和执行 SQL。

View File

@ -1,3 +1,8 @@
---
title: Query Editor
description: Write and execute SQL with syntax highlighting, autocomplete, and query history.
---
# Query Editor
The Query Editor is the primary workspace for writing and executing SQL in DBX. It is built on CodeMirror 6, providing a fast, modern editing experience with deep database awareness.

View File

@ -1,4 +1,7 @@
# 结构浏览
---
title: 结构浏览
description: 树形结构浏览器,快速浏览和管理数据库中的所有对象。
---
DBX 提供树形结构浏览器,让你可以快速浏览和管理数据库中的所有对象。

View File

@ -1,3 +1,8 @@
---
title: Schema Browser
description: Explore database structure with a navigable tree view, search, and context menus.
---
# Schema Browser
The Schema Browser is the sidebar panel that lets you explore the structure of all your connected databases. It presents your database objects in a navigable tree and provides quick actions via context menus.

View File

@ -1,4 +1,7 @@
# Schema 对比
---
title: Schema 对比
description: 比较两个数据库之间的结构差异,并生成同步 SQL。
---
DBX 的 Schema 对比功能可以比较两个数据库之间的结构差异,并生成同步 SQL帮助你快速对齐数据库结构。

View File

@ -1,3 +1,8 @@
---
title: Schema Diff
description: Compare database schemas and generate SQL to synchronize them.
---
# Schema Diff
Schema Diff compares the structure of two databases and generates the SQL needed to synchronize them. This is useful for identifying differences between development and production environments, or between any two database instances.
@ -27,6 +32,5 @@ You can review the generated SQL before taking any action.
Once you have reviewed the generated SQL, you can execute it directly within DBX against the target database. There is no need to copy the SQL to an external tool -- the sync can be completed in a single workflow.
::: warning
Schema sync can make destructive changes (such as dropping tables or columns). Always review the generated SQL carefully before executing, and consider backing up the target database first.
:::
> **Warning:**
> Schema sync can make destructive changes (such as dropping tables or columns). Always review the generated SQL carefully before executing, and consider backing up the target database first.

View File

@ -1,4 +1,7 @@
# SQL 文件执行
---
title: SQL 文件执行
description: 直接执行 .sql 文件,适用于运行数据库迁移脚本、初始化脚本或批量 SQL 操作。
---
DBX 支持直接执行 `.sql` 文件,适用于运行数据库迁移脚本、初始化脚本或批量 SQL 操作。

View File

@ -1,3 +1,8 @@
---
title: SQL File Execution
description: Run .sql files directly within DBX with progress tracking and cancellation support.
---
# SQL File Execution
SQL File Execution lets you run `.sql` files directly within DBX, with progress tracking and the ability to cancel mid-execution. This is useful for running migration scripts, seed data, or database setup files.

View File

@ -1,4 +1,7 @@
# SSH 隧道
---
title: SSH 隧道
description: 通过 SSH 隧道安全地连接不允许直接远程访问的数据库服务器。
---
当数据库服务器不允许直接远程访问时,你可以通过 SSH 隧道安全地连接。DBX 内置了 SSH 隧道支持,无需手动在终端中建立隧道。

View File

@ -1,3 +1,8 @@
---
title: SSH Tunnel
description: Connect to databases through SSH tunnels for secure access to remote servers.
---
# SSH Tunnel
DBX can connect to databases through an SSH tunnel, allowing you to securely access database servers that are not directly reachable from your machine. This is common in production environments where the database is behind a firewall or on a private network.
@ -31,9 +36,8 @@ If your private key is protected by a passphrase, DBX will prompt you to enter i
By default, the SSH tunnel listens only on `localhost` (`127.0.0.1`). If you enable the **Expose to LAN** option, the tunnel binds to `0.0.0.0`, making it accessible to other devices on your local network.
::: warning
Exposing the tunnel to your LAN means any device on the same network can access the tunneled database port. Only enable this on trusted networks.
:::
> **Warning:**
> Exposing the tunnel to your LAN means any device on the same network can access the tunneled database port. Only enable this on trusted networks.
## How It Works

View File

@ -1,4 +1,7 @@
# 表数据导入
---
title: 表数据导入
description: 将外部文件中的数据导入到数据库表中,支持 CSV、TSV、JSON、Excel 格式。
---
DBX 支持将外部文件中的数据导入到数据库表中,适用于批量数据录入和数据迁移场景。

View File

@ -1,3 +1,8 @@
---
title: Table Import
description: Import data from CSV, TSV, JSON, and Excel files into database tables.
---
# Table Import
Table Import lets you load data from local files into a database table. It supports common file formats and provides column mapping to ensure data lands in the right place.
@ -32,6 +37,5 @@ Unmapped file columns are skipped. Unmapped table columns receive their default
| **Append** | Insert the imported rows into the table alongside existing data. |
| **Truncate then import** | Delete all existing rows from the table first, then insert the imported data. |
::: warning
Truncate mode permanently removes all existing data in the target table before importing. Make sure this is the intended behavior before proceeding.
:::
> **Warning:**
> Truncate mode permanently removes all existing data in the target table before importing. Make sure this is the intended behavior before proceeding.

View File

@ -1,4 +1,7 @@
# 表结构编辑器
---
title: 表结构编辑器
description: 可视化的表结构编辑器,无需手写 DDL 语句即可管理表的列和索引。
---
DBX 提供可视化的表结构编辑器,让你无需手写 DDL 语句即可管理表的列和索引。

View File

@ -1,3 +1,8 @@
---
title: Table Structure Editor
description: Visually modify table schemas -- add, edit, and delete columns and indexes.
---
# Table Structure Editor
The Table Structure Editor provides a visual interface for modifying table schemas. Instead of writing `ALTER TABLE` statements by hand, you can add, modify, and delete columns and indexes through a form-based UI.

View File

@ -0,0 +1,46 @@
---
title: 什么是 DBX
description: DBX 是一款开源、轻量、跨平台的数据库管理工具,基于 Tauri 2 和 Rust 构建。
---
DBX 是一款开源、轻量、跨平台的数据库管理工具,基于 [Tauri 2](https://tauri.app/) 和 Rust 构建。
## 为什么选择 DBX
- **轻量** — 安装包约 15 MB不内嵌 Chromium
- **多数据库** — 一个工具管理 MySQL、PostgreSQL、SQLite、Redis、MongoDB 等 25+ 种数据库
- **AI 驱动** — 内置 AI 助手 + MCP Server 对接外部 AI 编程助手
- **安全** — 密码存储在系统钥匙串,支持 SSH 隧道,加密配置导出
- **跨平台** — macOS、Windows、Linux
- **Docker 自托管** — 支持通过 Docker 部署,适合团队共享和服务器环境
## 核心功能
- SQL 查询编辑器(语法高亮、智能补全、查询历史)
- 数据表格(虚拟滚动、行内编辑、导出)
- 结构浏览(树形视图、搜索、右键菜单)
- Schema 图 / ER 图
- 执行计划可视化
- 表结构编辑器(可视化 DDL
- Schema 对比与同步
- 数据迁移(跨引擎传输)
- 数据导入CSV、TSV、JSON、Excel
- 数据库导出DDL + 数据)
- 字段血缘分析
- 配置导出/导入(加密传输)
- AI 助手(自然语言转 SQL、优化、修复
- MCP Server对接 Claude Code、Cursor 等)
## 技术栈
| 层级 | 技术 |
|---|---|
| 框架 | [Tauri 2](https://tauri.app/) |
| 前端 | [Vue 3](https://vuejs.org/) + TypeScript |
| UI | [shadcn-vue](https://www.shadcn-vue.com/) + Tailwind CSS |
| 编辑器 | [CodeMirror 6](https://codemirror.net/) |
| 后端 | Rust + sqlx / tiberius / redis-rs / mongodb |
## 开源协议
[AGPL-3.0](https://github.com/t8y2/dbx/blob/main/LICENSE)

View File

@ -0,0 +1,50 @@
---
title: What is DBX?
description: An open-source, lightweight, cross-platform database management tool built with Tauri 2 and Rust.
---
# What is DBX?
DBX is an open-source, lightweight, cross-platform database management tool built with [Tauri 2](https://tauri.app/) and Rust.
<div style={{textAlign: "center"}}>
<img src="/screenshot.png" alt="DBX Screenshot" style={{maxWidth: "100%", borderRadius: "8px", margin: "16px 0"}} />
</div>
## Why DBX?
- **Lightweight** — ~15 MB installer, no bundled Chromium
- **Multi-database** — One tool for MySQL, PostgreSQL, SQLite, Redis, MongoDB, and 20+ more
- **AI-powered** — Built-in AI assistant + MCP server for external AI agents
- **Secure** — Passwords in system keyring, SSH tunnels, encrypted config export
- **Cross-platform** — macOS, Windows, Linux, Docker (self-hosted)
## Key Features
- **Query Editor** — Syntax highlighting, autocomplete, query history
- **Data Grid** — Virtual scrolling, inline editing, data export
- **Schema Browser** — Tree view, search, pin, column comments
- **Schema Diagram** — Visual ER diagram of your database schema
- **Schema Diff** — Compare and sync schemas between databases
- **Explain Plan** — Visualize query execution plans
- **Data Transfer** — Move data between different database engines
- **Table Import** — Import CSV, TSV, JSON, Excel files into tables
- **Database Export** — Export database structure and data as SQL
- **Field Lineage** — Trace column relationships across tables and views
- **Config Export** — Encrypted export/import of connection configurations
- **AI Assistant** — Natural language to SQL, query explanation, optimization
- **MCP Server** — Let AI agents query your databases directly
## Tech Stack
| Layer | Technology |
|---|---|
| Framework | [Tauri 2](https://tauri.app/) |
| Frontend | [Vue 3](https://vuejs.org/) + TypeScript |
| UI | [shadcn-vue](https://www.shadcn-vue.com/) + Tailwind CSS |
| Editor | [CodeMirror 6](https://codemirror.net/) |
| Backend | Rust + sqlx / tiberius / redis-rs / mongodb |
## License
[AGPL-3.0](https://github.com/t8y2/dbx/blob/main/LICENSE)

View File

@ -1,29 +0,0 @@
# What is DBX?
DBX is an open-source, lightweight, cross-platform database management tool built with [Tauri 2](https://tauri.app/) and Rust.
<div style="text-align:center">
<img src="/screenshot.png" alt="DBX Screenshot" style="max-width:100%;border-radius:8px;margin:16px 0" />
</div>
## Why DBX?
- **Lightweight** — ~15 MB installer, no bundled Chromium
- **Multi-database** — One tool for MySQL, PostgreSQL, SQLite, Redis, MongoDB, and 8 more
- **AI-powered** — Built-in AI assistant + MCP server for external AI agents
- **Secure** — Passwords in system keyring, SSH tunnels, encrypted config export
- **Cross-platform** — macOS, Windows, Linux
## Tech Stack
| Layer | Technology |
|---|---|
| Framework | [Tauri 2](https://tauri.app/) |
| Frontend | [Vue 3](https://vuejs.org/) + TypeScript |
| UI | [shadcn-vue](https://www.shadcn-vue.com/) + Tailwind CSS |
| Editor | [CodeMirror 6](https://codemirror.net/) |
| Backend | Rust + sqlx / tiberius / redis-rs / mongodb |
## License
[MIT](https://github.com/t8y2/dbx/blob/main/LICENSE)

View File

@ -1,97 +0,0 @@
---
layout: home
hero:
name: DBX
text: Database Management Tool
tagline: 25+ databases in 15 MB. Desktop & Docker self-hosting, with built-in AI assistant.
image:
src: /logo.png
alt: DBX
actions:
- theme: brand
text: Get Started
link: /guide/getting-started
- theme: alt
text: Download
link: https://github.com/t8y2/dbx/releases
- theme: alt
text: GitHub
link: https://github.com/t8y2/dbx
features:
- icon: 🗄️
title: 25+ Databases
details: MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, ClickHouse, SQL Server, Oracle, Elasticsearch, and many MySQL/PG-compatible databases.
link: /guide/databases
linkText: View all databases
- icon: ✏️
title: Query Editor
details: CodeMirror 6 with syntax highlighting, smart SQL autocomplete for tables and columns, format SQL, execute selected text, 9 editor themes.
link: /guide/query-editor
linkText: Learn more
- icon: 📊
title: Data Grid
details: Virtual-scrolled table that handles millions of rows. Inline editing, sorting, search, WHERE filter, pagination. Export to CSV, JSON, Markdown.
link: /guide/data-grid
linkText: Learn more
- icon: 🤖
title: AI Assistant
details: Natural language to SQL, explain, optimize, fix errors. Supports Claude, OpenAI, and any OpenAI-compatible endpoint.
link: /guide/ai-assistant
linkText: Learn more
- icon: 🔌
title: MCP Integration
details: Let Claude Code, Cursor, Windsurf and other AI agents query your databases and open tables in DBX directly.
link: /guide/mcp
linkText: Setup guide
- icon: 🔄
title: Schema Diff & Transfer
details: Compare schemas across databases and generate sync SQL. Transfer data between different database engines. ER diagram visualization.
link: /guide/schema-diff
linkText: Learn more
- icon: 🔍
title: Field Lineage
details: Trace column dependencies through foreign keys, views, query history, and same-name fields across tables.
link: /guide/field-lineage
linkText: Learn more
- icon: 🐳
title: Docker Self-Hosting
details: Deploy the web version via Docker with one command. Multi-arch images (amd64/arm64). Persistent data with volumes.
link: /guide/getting-started
linkText: Learn more
---
<style>
.screenshot-section {
max-width: 1152px;
margin: 0 auto;
padding: 48px 24px;
}
.screenshot-section h2 {
text-align: center;
font-size: 1.5rem;
font-weight: 600;
margin-bottom: 24px;
}
.screenshot-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
}
.screenshot-grid img {
width: 100%;
border-radius: 8px;
box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
</style>
<div class="screenshot-section">
<h2>See it in action</h2>
<div class="screenshot-grid">
<img src="/screenshot-light.png" alt="DBX light mode" />
<img src="/screenshot-dark.png" alt="DBX dark mode" />
<img src="/screenshot-er.png" alt="ER diagram" />
<img src="/screenshot-grid.png" alt="Data grid" />
</div>
</div>

12
docs/lib/i18n.ts Normal file
View File

@ -0,0 +1,12 @@
import { defineI18n } from 'fumadocs-core/i18n';
import { defineI18nUI } from 'fumadocs-ui/i18n';
export const i18n = defineI18n({
defaultLanguage: 'en',
languages: ['en', 'cn'],
});
export const i18nUI = defineI18nUI(i18n, {
en: { displayName: 'English' },
cn: { displayName: '简体中文' },
});

9
docs/lib/source.ts Normal file
View File

@ -0,0 +1,9 @@
import { loader } from 'fumadocs-core/source';
import { i18n } from '@/lib/i18n';
import { docs } from '@/.source/server';
export const source = loader({
baseUrl: '/docs',
source: docs.toFumadocsSource(),
i18n,
});

View File

@ -1,447 +0,0 @@
# DBX MCP Guide
[中文](#中文)
## What is MCP?
MCP (Model Context Protocol) is an open protocol that lets AI coding agents (Claude Code, Cursor, etc.) call external tools. DBX's MCP Server exposes your database connections to AI agents, so you can query databases using natural language without writing SQL manually.
```
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
### 1. Install
```bash
npm install -g @dbx-app/mcp-server
```
### 2. Configure Your AI Agent
Create `.mcp.json` in your working directory:
```json
{
"mcpServers": {
"dbx": {
"command": "npx",
"args": ["-y", "@dbx-app/mcp-server"]
}
}
}
```
### 3. Start Using
Just ask your AI agent:
- "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
| Agent | Status | Configuration |
|---|---|---|
| Claude Code | ✅ Native | `.mcp.json` |
| Cursor | ✅ Supported | `.cursor/mcp.json` |
| Windsurf | ✅ Supported | `.windsurfrules` |
| VS Code + Copilot | ✅ Supported | MCP extension |
---
## Tools
### `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.
**Parameters:**
| Parameter | Required | Description |
|---|---|---|
| `connection_name` | Yes | DBX connection name |
| `schema` | No | Schema name (default: public) |
**Example:**
> "Show the tables in my local-pg connection"
---
### `dbx_describe_table`
Get column definitions for a table.
**Parameters:**
| Parameter | Required | Description |
|---|---|---|
| `connection_name` | Yes | DBX connection name |
| `table` | Yes | Table name |
| `schema` | No | Schema name (default: public) |
**Example:**
> "Describe the orders table"
**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).
**Parameters:**
| Parameter | Required | Description |
|---|---|---|
| `connection_name` | Yes | DBX connection name |
| `sql` | Yes | SQL query |
**Example:**
> "Query the top 5 countries by Gini coefficient"
The AI agent will generate and execute SQL automatically.
---
### `dbx_open_table`
Open a table in DBX desktop app UI. **Requires DBX to be running.**
**Parameters:**
| Parameter | Required | Description |
|---|---|---|
| `connection_name` | Yes | DBX connection name |
| `table` | Yes | Table name |
| `database` | No | Database name |
| `schema` | No | Schema name |
**Example:**
> "Open the orders table"
DBX will open a new tab with the table data and bring the window to front.
---
### `dbx_execute_and_show`
Execute a SQL query in DBX desktop app UI. **Requires DBX to be running.**
**Parameters:**
| Parameter | Required | Description |
|---|---|---|
| `connection_name` | Yes | DBX connection name |
| `sql` | Yes | SQL query |
| `database` | No | Database name |
**Example:**
> "Run this query in DBX"
---
## How It Works
### Connection Configs
The MCP Server reads DBX's connection config files:
| 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).
### 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: PostgreSQL, MySQL, and compatible databases (Doris, StarRocks, etc.). UI integration (open table) supports all database types in DBX.
---
## FAQ
**MCP Server can't connect to my database**
Check that the connection works in DBX first. The MCP Server uses the same config and credentials.
**`dbx_open_table` says "DBX is not running"**
Start the DBX desktop app first. UI integration requires DBX's local HTTP service.
**Connection name not found**
Connection name matching is case-insensitive but must match exactly. Use `dbx_list_connections` to see all available names.
**Query timeout**
MCP Server has a 30-second query timeout. Consider adding indexes or simplifying your query.
---
## Requirements
- [DBX](https://github.com/t8y2/dbx) installed with at least one connection configured
- Node.js 18+
- UI integration requires DBX v0.3.9+
---
## 中文
## 什么是 MCP
MCPModel Context Protocol是一个开放协议让 AI 编程助手Claude Code、Cursor 等能够调用外部工具。DBX 的 MCP Server 把你在 DBX 中配置的数据库连接暴露给 AI 助手,这样你可以用自然语言查询数据库,而不需要手动写 SQL。
```
你:"查看 orders 表最近 7 天的订单量趋势"
AI 助手 → MCP Server → 你的数据库 → 返回结果
DBX 的连接配置(含密码)
```
## 快速开始
### 1. 安装
```bash
npm install -g @dbx-app/mcp-server
```
### 2. 配置 AI 助手
在你的工作目录创建 `.mcp.json`
```json
{
"mcpServers": {
"dbx": {
"command": "npx",
"args": ["-y", "@dbx-app/mcp-server"]
}
}
}
```
### 3. 开始使用
在 AI 助手中直接说:
- "列出我的数据库连接"
- "查看 local-pg 上有哪些表"
- "查看 users 表的结构"
- "查询最近 7 天的订单数量"
- "打开 orders 表"(需要 DBX 运行中)
---
## 支持的 AI 助手
| 助手 | 支持情况 | 配置方式 |
|---|---|---|
| Claude Code | ✅ 原生支持 | `.mcp.json` |
| Cursor | ✅ 支持 | `.cursor/mcp.json` |
| Windsurf | ✅ 支持 | `.windsurfrules` |
| VS Code + Copilot | ✅ 支持 | MCP 扩展 |
---
## 工具列表
### `dbx_list_connections`
列出 DBX 中所有已配置的数据库连接。
**示例对话:**
> "列出我的数据库连接"
**返回:**
```
| Name | Type | Host | Port | Database |
| -------- | -------- | --------- | ---- | -------- |
| local-pg | postgres | 127.0.0.1 | 5432 | |
| prod-db | mysql | db.example| 3306 | myapp |
```
---
### `dbx_list_tables`
列出指定连接的表和视图。
**参数:**
| 参数 | 必填 | 说明 |
|---|---|---|
| `connection_name` | 是 | DBX 连接名称 |
| `schema` | 否 | Schema 名称(默认 public |
**示例对话:**
> "查看 local-pg 上有哪些表"
---
### `dbx_describe_table`
获取表的列定义。
**参数:**
| 参数 | 必填 | 说明 |
|---|---|---|
| `connection_name` | 是 | DBX 连接名称 |
| `table` | 是 | 表名 |
| `schema` | 否 | Schema 名称(默认 public |
**示例对话:**
> "查看 orders 表的结构"
**返回:**
```
| Column | Type | Nullable | Default | Comment |
| ----------- | --------- | -------- | ------- | ------- |
| id (PK) | integer | NO | | |
| user_id | integer | NO | | 用户 ID |
| total | numeric | NO | 0 | 订单金额 |
| created_at | timestamp | NO | now() | |
```
---
### `dbx_execute_query`
执行 SQL 查询,返回结果(最多 100 行)。
**参数:**
| 参数 | 必填 | 说明 |
|---|---|---|
| `connection_name` | 是 | DBX 连接名称 |
| `sql` | 是 | SQL 查询语句 |
**示例对话:**
> "查询基尼系数最高的 5 个国家"
AI 助手会自动生成 SQL 并执行。
---
### `dbx_open_table`
在 DBX 桌面端打开指定表。**需要 DBX 正在运行。**
**参数:**
| 参数 | 必填 | 说明 |
|---|---|---|
| `connection_name` | 是 | DBX 连接名称 |
| `table` | 是 | 表名 |
| `database` | 否 | 数据库名 |
| `schema` | 否 | Schema 名称 |
**示例对话:**
> "打开 orders 表"
DBX 会自动新开一个 tab 显示数据,窗口自动置前。
---
### `dbx_execute_and_show`
在 DBX 桌面端执行 SQL 并展示结果。**需要 DBX 正在运行。**
**参数:**
| 参数 | 必填 | 说明 |
|---|---|---|
| `connection_name` | 是 | DBX 连接名称 |
| `sql` | 是 | SQL 查询语句 |
| `database` | 否 | 数据库名 |
**示例对话:**
> "在 DBX 里跑一下这个查询"
---
## 工作原理
### 连接配置
MCP Server 从 DBX 的配置目录读取连接信息:
| 平台 | 路径 |
|---|---|
| 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 凭据管理器)。
### UI 联动
`dbx_open_table``dbx_execute_and_show` 通过本地 HTTP 接口与运行中的 DBX 应用通信:
```
AI 助手 → MCP Server → HTTP localhost → DBX 后端 → Tauri 事件 → 前端打开 tab
```
### 支持的数据库
MCP 查询支持 PostgreSQL 和 MySQL及兼容数据库Doris、StarRocks 等。UI 联动(打开表)支持 DBX 已支持的所有数据库类型。
---
## 常见问题
**MCP Server 连不上数据库**
检查 DBX 中该连接是否能正常连接。MCP Server 使用相同的连接配置和密码。
**`dbx_open_table` 报 "DBX is not running"**
需要先启动 DBX 桌面应用。UI 联动功能依赖 DBX 运行时的本地 HTTP 服务。
**连接名称找不到**
连接名称匹配不区分大小写,但需要和 DBX 中配置的名称一致。用 `dbx_list_connections` 查看所有可用名称。
**查询超时**
MCP Server 的查询超时为 30 秒。如果查询较慢,考虑添加索引或简化查询。
---
## 系统要求
- [DBX](https://github.com/t8y2/dbx) 已安装并配置了至少一个数据库连接
- Node.js 18+
- UI 联动功能需要 DBX v0.3.9+

6
docs/next-env.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/dev/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

12
docs/next.config.mjs Normal file
View File

@ -0,0 +1,12 @@
import { createMDX } from 'fumadocs-mdx/next';
const withMDX = createMDX();
/** @type {import('next').NextConfig} */
const config = {
basePath: '/dbx',
output: 'export',
images: { unoptimized: true },
};
export default withMDX(config);

2514
docs/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,26 @@
{
"name": "dbx-docs",
"private": true,
"type": "module",
"scripts": {
"dev": "vitepress dev",
"build": "vitepress build",
"preview": "vitepress preview"
"dev": "next dev",
"build": "next build",
"start": "next start",
"postinstall": "fumadocs-mdx"
},
"devDependencies": {
"vitepress": "^1.6.4"
"dependencies": {
"@tailwindcss/postcss": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"fumadocs-core": "^16.8.7",
"fumadocs-mdx": "^14.3.2",
"fumadocs-ui": "^16.8.7",
"lucide-react": "^0.515.0",
"next": "^16.2.4",
"postcss": "^8.5.14",
"react": "^19.2.5",
"react-dom": "^19.2.5",
"tailwindcss": "^4.2.4",
"typescript": "^6.0.3"
}
}

3987
docs/pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

6
docs/postcss.config.mjs Normal file
View File

@ -0,0 +1,6 @@
/** @type {import('postcss-load-config').Config} */
export default {
plugins: {
'@tailwindcss/postcss': {},
},
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

9
docs/source.config.ts Normal file
View File

@ -0,0 +1,9 @@
import { defineDocs, defineConfig } from 'fumadocs-mdx/config';
export const docs = defineDocs({
dir: 'content/docs',
});
export default defineConfig({
mdxOptions: {},
});

45
docs/tsconfig.json Normal file
View File

@ -0,0 +1,45 @@
{
"compilerOptions": {
"target": "ESNext",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": [
"./*"
],
"@/content/*": [
"./.source/*"
]
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".source/**/*.ts",
".next/types/**/*.ts",
".next/dev/types/**/*.ts"
],
"exclude": [
"node_modules"
]
}

View File

@ -1,29 +0,0 @@
# 什么是 DBX
DBX 是一款开源、轻量、跨平台的数据库管理工具,基于 [Tauri 2](https://tauri.app/) 和 Rust 构建。
<div style="text-align:center">
<img src="/screenshot.png" alt="DBX 截图" style="max-width:100%;border-radius:8px;margin:16px 0" />
</div>
## 为什么选择 DBX
- **轻量** — 安装包约 15 MB不内嵌 Chromium
- **多数据库** — 一个工具管理 MySQL、PostgreSQL、SQLite、Redis、MongoDB 等 13+ 种数据库
- **AI 驱动** — 内置 AI 助手 + MCP Server 对接外部 AI 编程助手
- **安全** — 密码存储在系统钥匙串,支持 SSH 隧道,加密配置导出
- **跨平台** — macOS、Windows、Linux
## 技术栈
| 层级 | 技术 |
|---|---|
| 框架 | [Tauri 2](https://tauri.app/) |
| 前端 | [Vue 3](https://vuejs.org/) + TypeScript |
| UI | [shadcn-vue](https://www.shadcn-vue.com/) + Tailwind CSS |
| 编辑器 | [CodeMirror 6](https://codemirror.net/) |
| 后端 | Rust + sqlx / tiberius / redis-rs / mongodb |
## 开源协议
[MIT](https://github.com/t8y2/dbx/blob/main/LICENSE)

View File

@ -1,97 +0,0 @@
---
layout: home
hero:
name: DBX
text: 数据库管理工具
tagline: 15 MB 驾驭 25+ 种数据库。桌面端 & Docker 自托管,内置 AI 助手。
image:
src: /logo.png
alt: DBX
actions:
- theme: brand
text: 快速开始
link: /zh-CN/guide/getting-started
- theme: alt
text: 下载
link: https://github.com/t8y2/dbx/releases
- theme: alt
text: GitHub
link: https://github.com/t8y2/dbx
features:
- icon: 🗄️
title: 25+ 种数据库
details: MySQL、PostgreSQL、SQLite、Redis、MongoDB、DuckDB、ClickHouse、SQL Server、Oracle、Elasticsearch以及众多 MySQL/PG 兼容数据库
link: /zh-CN/guide/databases
linkText: 查看所有数据库
- icon: ✏️
title: 查询编辑器
details: CodeMirror 6 语法高亮、智能 SQL 补全(表名和字段)、格式化 SQL、执行选中文本9 种编辑器主题
link: /zh-CN/guide/query-editor
linkText: 了解更多
- icon: 📊
title: 数据表格
details: 虚拟滚动轻松应对百万行数据。行内编辑、排序、搜索、WHERE 过滤、分页。导出为 CSV、JSON、Markdown
link: /zh-CN/guide/data-grid
linkText: 了解更多
- icon: 🤖
title: AI 助手
details: 自然语言生成 SQL、解释、优化、修复错误。支持 Claude、OpenAI 及任何 OpenAI 兼容端点
link: /zh-CN/guide/ai-assistant
linkText: 了解更多
- icon: 🔌
title: MCP 集成
details: 让 Claude Code、Cursor、Windsurf 等 AI 编程助手直接查询数据库,还能在 DBX 中打开表
link: /zh-CN/guide/mcp
linkText: 配置指南
- icon: 🔄
title: Schema 对比与数据传输
details: 跨数据库对比 Schema 并生成同步 SQL。在不同数据库引擎之间传输数据。ER 关系图可视化
link: /zh-CN/guide/schema-diff
linkText: 了解更多
- icon: 🔍
title: 字段血缘
details: 通过外键、视图、查询历史和同名字段追踪列的依赖关系
link: /zh-CN/guide/field-lineage
linkText: 了解更多
- icon: 🐳
title: Docker 自托管
details: 一行命令部署 Web 版本。支持 amd64/arm64 双架构镜像,数据持久化存储
link: /zh-CN/guide/getting-started
linkText: 了解更多
---
<style>
.screenshot-section {
max-width: 1152px;
margin: 0 auto;
padding: 48px 24px;
}
.screenshot-section h2 {
text-align: center;
font-size: 1.5rem;
font-weight: 600;
margin-bottom: 24px;
}
.screenshot-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
}
.screenshot-grid img {
width: 100%;
border-radius: 8px;
box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
</style>
<div class="screenshot-section">
<h2>功能预览</h2>
<div class="screenshot-grid">
<img src="/screenshot-light.png" alt="DBX 亮色模式" />
<img src="/screenshot-dark.png" alt="DBX 深色模式" />
<img src="/screenshot-er.png" alt="ER 关系图" />
<img src="/screenshot-grid.png" alt="数据表格" />
</div>
</div>