11import DetailsWrap from '@site/src /components/DetailsWrap';
22
3- # 适用于 Databend 的 MCP 服务器
3+ # 适用于 Databend 的 MCP Server
44
5- [ mcp-databend] ( https://github.com/databendlabs/mcp-databend ) 是一个 MCP(Model Context Protocol,模型上下文协议 )服务器,它让 AI 助手能够使用自然语言直接与你的 Databend 数据库交互。
5+ [ mcp-databend] ( https://github.com/databendlabs/mcp-databend ) 是一个 MCP(Model Context Protocol)服务器,它让 AI 助手能够使用自然语言直接与您的 Databend 数据库交互。
66
77## mcp-databend 能做什么
88
@@ -13,28 +13,28 @@ import DetailsWrap from '@site/src/components/DetailsWrap';
1313
1414## 构建 ChatBI 工具
1515
16- 本教程将演示如何使用 mcp-databend 和 Agno 框架构建对话式商业智能 (Business Intelligence,BI )工具。你将创建一个本地 Agent,能够用自然语言回答数据问题。
16+ 本教程将演示如何使用 mcp-databend 和 Agno 框架构建一个对话式商业智能 (Business Intelligence)工具。您将创建一个本地 Agent,能够用自然语言回答数据问题。
1717
1818![ Databend MCP ChatBI] ( @site/static/img/connect/databend-mcp-chatbi.png )
1919
2020## 分步教程
2121
22- ### 步骤 1 :配置 Databend 连接
22+ ### 第 1 步 :配置 Databend 连接
2323
24- 首先,你需要一个可连接的 Databend 数据库:
24+ 首先,您需要一个可连接的 Databend 数据库:
2525
26261 . ** 注册 [ Databend Cloud] ( https://app.databend.cn ) ** (提供免费套餐)
27- 2 . ** 创建 Warehouse 和数据库 **
28- 3 . ** 在控制台获取连接字符串**
27+ 2 . ** 创建 Warehouse 和 Database **
28+ 3 . ** 在控制台获取连接字符串(Connection String) **
2929
30- 有关 DSN 格式和示例的详细信息,请参阅 [ 连接字符串文档] ( https://docs.databend.cn/developer/drivers/#connection-string-dsn ) 。
30+ 有关 DSN 格式和示例的详细信息,请参阅[ 连接字符串文档] ( https://docs.databend.cn/developer/drivers/#connection-string-dsn ) 。
3131
32- | 部署方式 | 连接字符串示例 |
33- | ------------------ | ------------------------------------------------------------- |
34- | ** Databend Cloud** | ` databend://user:pwd@host:443/database?warehouse=wh ` |
35- | ** 自托管** | ` databend://user:pwd@localhost:8000/database?sslmode=disable ` |
32+ | 部署方式 | 连接字符串示例 |
33+ | ------------------ | ------------------------------------------------------------ |
34+ | ** Databend Cloud** | ` databend://user:pwd@host:443/database?warehouse=wh ` |
35+ | ** 自托管** | ` databend://user:pwd@localhost:8000/database?sslmode=disable ` |
3636
37- ### 步骤 2 :安装依赖
37+ ### 第 2 步 :安装依赖
3838
3939创建虚拟环境并安装所需包:
4040
@@ -47,9 +47,9 @@ source .venv/bin/activate
4747pip install packaging openai agno openrouter sqlalchemy fastapi mcp-databend
4848```
4949
50- ### 步骤 3 :创建 ChatBI Agent
50+ ### 第 3 步 :创建 ChatBI Agent
5151
52- 现在创建 ChatBI Agent,它将使用 mcp-databend 与数据库交互 。
52+ 现在创建 ChatBI Agent,它将使用 mcp-databend 与您的数据库交互 。
5353
5454创建文件 ` agent.py ` :
5555<DetailsWrap >
@@ -127,10 +127,10 @@ agent = Agent(
127127 ),
128128 tools = [],
129129 instructions = [
130- " 你是 ChatBI —— Databend 的商业智能助手 。" ,
130+ " 你是 ChatBI - 专为 Databend 打造的商业智能助手 。" ,
131131 " 帮助用户使用自然语言探索和分析数据。" ,
132- " 始终从探索可用数据库和表开始 。" ,
133- " 将查询结果格式化为清晰易读的表格 。" ,
132+ " 始终先探索可用的数据库和表 。" ,
133+ " 以清晰、易读的表格格式展示查询结果 。" ,
134134 " 在分析中提供见解和解释。"
135135 ],
136136 storage = SqliteStorage(table_name = " chatbi" , db_file = " chatbi.db" ),
@@ -145,7 +145,7 @@ agent = Agent(
145145async def lifespan (app : FastAPI):
146146 tool = databend.create()
147147 if not await databend.init():
148- logger.error(" 初始化 Databend 失败 " )
148+ logger.error(" Databend 初始化失败 " )
149149 raise RuntimeError (" Databend 连接失败" )
150150
151151 agent.tools.append(tool)
@@ -165,17 +165,16 @@ playground = Playground(
165165app = playground.get_app(lifespan = lifespan)
166166
167167if __name__ == " __main__" :
168- print (" 🤖 正在为 Databend 启动 MCP 服务器 " )
168+ print (" 🤖 正在启动 Databend 的 MCP Server " )
169169 print (" 打开 http://localhost:7777 开始聊天!" )
170170 playground.serve(app = " agent:app" , host = " 127.0.0.1" , port = 7777 )
171171```
172172
173173</details >
174174</DetailsWrap >
175+ ### 第 4 步:配置环境
175176
176- ### 步骤 4:配置环境
177-
178- 设置 API 密钥和数据库连接:
177+ 设置您的 API 密钥和数据库连接:
179178
180179``` bash
181180# 设置 OpenRouter API 密钥
@@ -185,19 +184,19 @@ export OPENROUTER_API_KEY="your-openrouter-key"
185184export DATABEND_DSN=" your-databend-connection-string"
186185```
187186
188- ### 步骤 5 :启动 ChatBI Agent
187+ ### 第 5 步 :启动 ChatBI Agent
189188
190189运行 Agent 启动本地服务器:
191190
192191``` bash
193192python agent.py
194193```
195194
196- 你将看到 :
195+ 您将看到 :
197196
198197```
199198✅ 环境变量检查通过
200- 🤖 正在为 Databend 启动 MCP 服务器
199+ 🤖 正在启动 Databend 的 MCP Server
201200打开 http://localhost:7777 开始聊天!
202201INFO Starting playground on http://127.0.0.1:7777
203202INFO: Started server process [189851]
@@ -208,7 +207,7 @@ INFO: Application startup complete.
208207INFO: Uvicorn running on http://127.0.0.1:7777 (Press CTRL+C to quit)
209208```
210209
211- ### 步骤 6 :设置 Web 界面
210+ ### 第 6 步 :设置 Web 界面
212211
213212为获得更佳体验,可配置 Agno 的 Web 界面:
214213
@@ -220,22 +219,22 @@ npx create-agent-ui@latest
220219cd agent-ui && npm run dev
221220```
222221
223- ** 连接到 Agent:**
222+ ** 连接到您的 Agent:**
224223
2252241 . 打开 [ http://localhost:3000 ] ( http://localhost:3000 )
2262252 . 选择 "localhost:7777" 作为端点
227- 3 . 开始提问你的数据 !
226+ 3 . 开始提问关于您的数据 !
228227
229228** 试试这些查询:**
230229
231230- "显示所有数据库"
232231- "我有哪些表?"
233232- "描述我的表结构"
234- - "运行查询展示示例数据 "
233+ - "运行查询显示示例数据 "
235234
236235## 资源
237236
238- - ** GitHub 仓库** : [ databendlabs/mcp-databend] ( https://github.com/databendlabs/mcp-databend )
239- - ** PyPI 包** : [ mcp-databend] ( https://pypi.org/project/mcp-databend )
240- - ** Agno 框架** : [ Agno MCP] ( https://docs.agno.com/tools/mcp/mcp )
241- - ** Agent UI** : [ Agent UI] ( https://docs.agno.com/agent-ui/introduction )
237+ - ** GitHub 仓库** :[ databendlabs/mcp-databend] ( https://github.com/databendlabs/mcp-databend )
238+ - ** PyPI 包** :[ mcp-databend] ( https://pypi.org/project/mcp-databend )
239+ - ** Agno 框架** :[ Agno MCP] ( https://docs.agno.com/tools/mcp/mcp )
240+ - ** Agent UI** :[ Agent UI] ( https://docs.agno.com/agent-ui/introduction )
0 commit comments