Integrate OceanBase MCP Server with Cline
seekdb supports vector data storage, vector indexing, and embedding-based vector search. You can store vectorized data in seekdb for further search.
Cline is an open-source AI coding assistant that supports the MCP protocol.
This topic uses Cline to demonstrate how to quickly build a backend application using OceanBase MCP Server.
Prerequisites
-
You have deployed seekdb.
-
You have an existing MySQL database and account available in your environment, and the database account has been granted read and write privileges.
-
You have installed Python 3.11 or later and the corresponding pip. If your machine has a low Python version, you can use Miniconda to create a new Python 3.11 or later environment. For more information, see Miniconda installation guide.
-
Install Git based on your operating system.
-
Install uv, a Python package manager. After the installation, run the
uv --versioncommand to verify the installation:pip install uv
uv --version -
Install Cline:
-
If you are using Visual Studio Code IDE, search for the Cline extension and install it in the
Extensionssection. The extension name isCline. After the installation, click the settings icon to configure the large model API for Cline as follows:
-
If you do not have an IDE, download Cline from Cline and follow the installation guide.
-
Step 1: Obtain the database connection information
Contact your seekdb deployment engineer or administrator to obtain the database connection string. For example:
obclient -h$host -P$port -u$user_name -p$password -D$database_name
Parameters:
-
$host: The IP address for connecting to seekdb. -
$port: The port number for connecting to seekdb. Default is2881. -
$database_name: The name of the database to access.tipThe connected user must have
CREATE,INSERT,DROP, andSELECTprivileges on the database. -
$user_name: The username for connecting to the database. -
$password: The password for the account.
Step 2: Configure the OceanBase MCP Server
This example uses Visual Studio Code to demonstrate how to configure the OceanBase MCP Server.
Clone the OceanBase MCP Server repository
Run the following command to download the source code to your local device:
git clone https://github.com/oceanbase/mcp-oceanbase.git
Go to the source code directory:
cd mcp-oceanbase
Install dependencies
Run the following command in the mcp-oceanbase directory to create a virtual environment and install dependencies:
uv venv
source .venv/bin/activate
uv pip install .
Create a working directory for Visual Studio Code
Manually create a working directory for Visual Studio Code on your local device and open it with Visual Studio Code. The files generated by Cline will be placed in this directory. The name of the sample directory is cline-generate.
Configure the OceanBase MCP Server in Cline
Click the Cline icon on the left-side navigation pane to open the Cline dialog box.

Add and configure MCP servers
-
Click the MCP Servers icon as shown in the following figure.

-
Manually configure the OceanBase MCP Server according to the numbered instructions in the figure below.

-
Edit the configuration file.
In the
cline_mcp_settings.jsonfile that was opened in the previous step, enter the following configuration information and save the file. Replace/path/to/your/mcp-oceanbase/src/oceanbase_mcp_serverwith the absolute path of theoceanbase_mcp_serverfolder, and replaceOB_HOST,OB_PORT,OB_USER,OB_PASSWORD, andOB_DATABASEwith your database information.The configuration file is as follows:
{
"mcpServers": {
"oceanbase": {
"command": "uv",
"args": [
"--directory",
"/path/to/your/mcp-oceanbase/src/oceanbase_mcp_server",
"run",
"oceanbase_mcp_server"
],
"env": {
"OB_HOST": "***",
"OB_PORT": "***",
"OB_USER": "***",
"OB_PASSWORD": "***",
"OB_DATABASE": "***"
}
}
}
} -
If the configuration is successful, the MCP Server is displayed in ready status, and the MCP
ToolsandResourcesinformation will be displayed, as shown in the following figure:
-
Click the switch button in the following figure to enable the MCP Server so that Cline can use it:

Test the MCP Server
Open the Cline session dialog box and enter the prompt How many tables are there in the dataanalysis_english database. Cline will display the SQL statement about to be executed. Confirm the SQL statement and click the Act button.

Cline will display the table names in the dataanalysis_english database, indicating that it can properly connect to seekdb.

Create a RESTful API project using FastAPI
You can use FastAPI to quickly create a RESTful API project. FastAPI is a Python web framework that allows you to build RESTful APIs efficiently.
-
Create the customer table
In the dialog box, enter the prompt:
Create a "customer" table with "ID" as the primary key, including the fields "name", "age", "telephone", and "location". Confirm the SQL statement and click theActbutton.
-
Insert test data
In the dialog box, enter the prompt:
Insert 10 rows of test data. Confirm the SQL statement and click theActbutton.
After the data is inserted, the execution result will be displayed.

-
Create a FastAPI project
In the dialog box, enter the prompt:
Create a FastAPI project and generate a RESTful API based on the "customer" table. Confirm the SQL statement and click theActbutton.
This step will automatically generate files. We recommend selecting "Accept All" the first time, because AI-generated files may be uncertain; you can adjust them later as needed.
-
Create a virtual environment and install dependencies
Run the following command to create a virtual environment using the uv package manager and install the dependency packages in the current directory:
uv venv
source .venv/bin/activate
uv pip install -r requirements.txt -
Start the FastAPI project
Run the following command to start the FastAPI project:
uvicorn main:app --reload -
View data in the table
Run the following command in the command line, or use another request tool, to view the data in the table:
curl http://127.0.0.1:8000/customersThe return result is as follows:
[{"ID":1,"name":"Alice Johnson","age":28,"telephone":"123-456-7890","location":"New York"},{"ID":2,"name":"Bob Smith","age":34,"telephone":"234-567-8901","location":"Los Angeles"},{"ID":3,"name":"Charlie Brown","age":45,"telephone":"345-678-9012","location":"Chicago"},{"ID":4,"name":"David Wilson","age":56,"telephone":"456-789-0123","location":"Houston"},{"ID":5,"name":"Eve Davis","age":67,"telephone":"567-890-1234","location":"Phoenix"},{"ID":6,"name":"Frank Garcia","age":78,"telephone":"678-901-2345","location":"Philadelphia"},{"ID":7,"name":"Grace Martinez","age":89,"telephone":"789-012-3456","location":"San Antonio"},{"ID":8,"name":"Hannah Robinson","age":19,"telephone":"890-123-4567","location":"San Diego"},{"ID":9,"name":"Ian Clark","age":23,"telephone":"901-234-5678","location":"Dallas"},{"ID":10,"name":"Julia Lewis","age":31,"telephone":"012-345-6789","location":"San Jose"}]You can see that the RESTful APIs for creating, reading, updating, and deleting data have been successfully generated:
from fastapi import FastAPI, Depends, HTTPException
from sqlalchemy.orm import Session
from models import Customer
from database import SessionLocal, engine
from pydantic import BaseModel
app = FastAPI()
# Database dependency
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()
# Request model
class CustomerCreate(BaseModel):
name: str
age: int
telephone: str
location: str
# Response model
class CustomerResponse(CustomerCreate):
id: int
class Config:
from_attributes = True
@app.post("/customers/")
def create_customer(customer: CustomerCreate, db: Session = Depends(get_db)):
db_customer = Customer(**customer.model_dump())
db.add(db_customer)
db.commit()
db.refresh(db_customer)
return db_customer
@app.get("/customers/{customer_id}")
def read_customer(customer_id: int, db: Session = Depends(get_db)):
customer = db.query(Customer).filter(Customer.id == customer_id).first()
if customer is None:
raise HTTPException(status_code=404, detail="Customer not found")
return customer
@app.get("/customers/")
def read_customers(skip: int = 0, limit: int = 10, db: Session = Depends(get_db)):
return db.query(Customer).offset(skip).limit(limit).all()
@app.put("/customers/{customer_id}")
def update_customer(customer_id: int, customer: CustomerCreate, db: Session = Depends(get_db)):
db_customer = db.query(Customer).filter(Customer.id == customer_id).first()
if db_customer is None:
raise HTTPException(status_code=404, detail="Customer not found")
for field, value in customer.model_dump().items():
setattr(db_customer, field, value)
db.commit()
db.refresh(db_customer)
return db_customer
@app.delete("/customers/{customer_id}")
def delete_customer(customer_id: int, db: Session = Depends(get_db)):
customer = db.query(Customer).filter(Customer.id == customer_id).first()
if customer is None:
raise HTTPException(status_code=404, detail="Customer not found")
db.delete(customer)
db.commit()
return {"message": "Customer deleted successfully"}