Skip to content

Commit cb61e14

Browse files
authored
Update 02-mcp.md
1 parent bf30e4c commit cb61e14

File tree

1 file changed

+27
-23
lines changed

1 file changed

+27
-23
lines changed

docs/en/guides/51-ai-functions/02-mcp.md

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,18 @@ This tutorial shows you how to build a conversational Business Intelligence tool
1717

1818
![Databend MCP ChatBI](@site/static/img/connect/databend-mcp-chatbi.png)
1919

20+
## Prerequisites
21+
22+
Before getting started, you'll need:
23+
24+
1. **Databend Database** - Either [Databend Cloud](https://app.databend.com) (free tier available) or a self-hosted instance
25+
2. **DeepSeek API Key** - Get your key from [https://platform.deepseek.com/api_keys](https://platform.deepseek.com/api_keys)
26+
2027
## Step-by-Step Tutorial
2128

2229
### Step 1: Setup Databend Connection
2330

24-
First, you need a Databend database to connect to:
31+
If you don't already have a Databend database:
2532

2633
1. **Sign up for [Databend Cloud](https://app.databend.com)** (free tier available)
2734
2. **Create a warehouse and database**
@@ -34,7 +41,19 @@ For detailed DSN format and examples, see [Connection String Documentation](http
3441
| **Databend Cloud** | `databend://user:pwd@host:443/database?warehouse=wh` |
3542
| **Self-hosted** | `databend://user:pwd@localhost:8000/database?sslmode=disable` |
3643

37-
### Step 2: Install Dependencies
44+
### Step 2: Setup API Keys and Environment
45+
46+
Set up your API key and database connection:
47+
48+
```bash
49+
# Set your DeepSeek API key
50+
export DEEPSEEK_API_KEY="your-deepseek-api-key"
51+
52+
# Set your Databend connection string
53+
export DATABEND_DSN="your-databend-connection-string"
54+
```
55+
56+
### Step 3: Install Dependencies
3857

3958
Create a virtual environment and install the required packages:
4059

@@ -44,10 +63,10 @@ python3 -m venv .venv
4463
source .venv/bin/activate
4564

4665
# Install packages
47-
pip install packaging openai agno openrouter sqlalchemy fastapi mcp-databend
66+
pip install packaging openai agno sqlalchemy fastapi mcp-databend
4867
```
4968

50-
### Step 3: Create ChatBI Agent
69+
### Step 4: Create ChatBI Agent
5170

5271
Now create your ChatBI agent that uses mcp-databend to interact with your database.
5372

@@ -63,17 +82,16 @@ from agno.agent import Agent
6382
from agno.playground import Playground
6483
from agno.storage.sqlite import SqliteStorage
6584
from agno.tools.mcp import MCPTools
66-
from agno.models.openrouter import OpenRouter
85+
from agno.models.deepseek import DeepSeek
6786
from fastapi import FastAPI
6887

6988
logging.basicConfig(level=logging.INFO)
7089
logger = logging.getLogger(__name__)
7190

7291
def check_env_vars():
73-
"""Check required environment variables"""
7492
required = {
7593
"DATABEND_DSN": "https://docs.databend.com/developer/drivers/#connection-string-dsn",
76-
"OPENROUTER_API_KEY": "https://openrouter.ai/settings/keys"
94+
"DEEPSEEK_API_KEY": "https://platform.deepseek.com/api_keys"
7795
}
7896

7997
missing = [var for var in required if not os.getenv(var)]
@@ -82,7 +100,7 @@ def check_env_vars():
82100
print("❌ Missing environment variables:")
83101
for var in missing:
84102
print(f"{var}: {required[var]}")
85-
print("\nExample: export DATABEND_DSN='...' OPENROUTER_API_KEY='...'")
103+
print("\nExample: export DATABEND_DSN='...' DEEPSEEK_API_KEY='...'")
86104
sys.exit(1)
87105

88106
print("✅ Environment variables OK")
@@ -117,10 +135,7 @@ databend = DatabendTool()
117135

118136
agent = Agent(
119137
name="ChatBI",
120-
model=OpenRouter(
121-
id=os.getenv("MODEL_ID", "anthropic/claude-sonnet-4"),
122-
api_key=os.getenv("OPENROUTER_API_KEY")
123-
),
138+
model=DeepSeek(),
124139
tools=[],
125140
instructions=[
126141
"You are ChatBI - a Business Intelligence assistant for Databend.",
@@ -164,18 +179,7 @@ if __name__ == "__main__":
164179
print("🤖 Starting MCP Server for Databend")
165180
print("Open http://localhost:7777 to start chatting!")
166181
playground.serve(app="agent:app", host="127.0.0.1", port=7777)
167-
```
168-
169-
### Step 4: Configure Environment
170-
171-
Set up your API keys and database connection:
172182

173-
```bash
174-
# Set your OpenRouter API key
175-
export OPENROUTER_API_KEY="your-openrouter-key"
176-
177-
# Set your Databend connection string
178-
export DATABEND_DSN="your-databend-connection-string"
179183
```
180184

181185
### Step 5: Start Your ChatBI Agent

0 commit comments

Comments
 (0)