Skip to main content

Build your own OceanBase MCP server with Google GenAI Toolbox

MCP (Model Context Protocol) is an open-source protocol introduced by Anthropic in November 2024. It enables large language models to interact with external tools or data sources. With MCP, users no longer need to manually copy and execute the output of large models. Instead, the model can directly command the tool to perform the corresponding action (Action).

Google GenAI Toolbox for Databases is an open-source toolbox that simplifies the development of tools by handling complex tasks such as connection pooling and authentication. This allows you to develop tools more easily, quickly, and securely.

This topic shows you how to build an OceanBase MCP server without writing any code using Google GenAI Toolbox.

Prerequisites

  • You have deployed seekdb.

  • You have installed Git based on the operating system you use.

  • Your system supports running binary files (Linux, macOS, or Windows).

Step 1: Obtain database connection information

You can use the following commands to quickly deploy a seekdb for testing:

# Deploy a standalone instance
docker run -d -p 2881:2881 oceanbase/seekdb

# Connect to seekdb
mysql -uroot -h127.0.0.1 -P2881 -p

Step 2: Download Google GenAI Toolbox and start using it

Download the Toolbox binary

Download the latest version of the Toolbox binary:

export OS="linux/amd64" # Choose one of linux/amd64, darwin/arm64, darwin/amd64, or windows/amd64
export VERSION="0.11.0"
curl -O https://storage.googleapis.com/genai-toolbox/v$VERSION/$OS/toolbox

Make the binary file executable:

chmod +x toolbox

Create a configuration file

Create a tools.yaml file and write the following content. Replace the connection information with your seekdb address. This example configuration shows how to use the Toolbox to retrieve an ASH report and cluster information through the MCP tool. You can customize your own tools.

sources:
oceanbase:
kind: oceanbase
host: 172.xxx.xxx.xxx
port: 2881
database: test
user: root
password: "******"
queryTimeout: 60s
tools:
get-ash-report:
kind: oceanbase-sql
source: oceanbase
description: Get ASH report
parameters:
- name: start_time
type: string
description: The start time of the ASH report.
- name: end_time
type: string
description: The end time of the ASH report.
- name: tenant_id
type: string
description: The tenant ID of the ASH report.
statement: CALL DBMS_WORKLOAD_REPOSITORY.ASH_REPORT(?,?, NULL, NULL, NULL, 'TEXT', NULL, NULL, ?);
get-all-server-nodes:
kind: oceanbase-sql
source: oceanbase
description: Get all server nodes
statement: select * from DBA_OB_SERVERS;
toolsets:
my_first_toolset:
- get-ash-report

Start the Toolbox

Start the Toolbox. You should see the following output:

./toolbox --tools-file tools.yaml
2025-08-28T10:37:49.776637+08:00 INFO "Initialized 1 sources."
2025-08-28T10:37:49.777513+08:00 INFO "Initialized 0 authServices."
2025-08-28T10:37:49.777586+08:00 INFO "Initialized 1 tools."
2025-08-28T10:37:49.777627+08:00 INFO "Initialized 2 toolsets."
2025-08-28T10:37:49.778334+08:00 INFO "Server ready to serve!"

Step 3: (Optional) Test with MCP Inspector

Inspector is an interactive development tool for testing and debugging MCP servers.

You can directly run Inspector using npx without installation:

npx @modelcontextprotocol/inspector node build/index.js

Configure the connection

  1. Open the link displayed above and fill in the connection information.
  2. For the transport type, select SSE.
  3. For the URL, enter http://127.0.0.1:5000/mcp/sse.
  4. Click the Connect button.
  5. In the Tools tab, click List Tools and try the get-all-server-nodes tool. You should see the following output:
{
"BLOCK_MIGRATE_IN_TIME": null,
"BUILD_VERSION": "4.3.5.3_103000102025071821-4b8c513fcc2194bad9eb2f93c789040f6dd01f11(Jul 18 2025 21:11:10)",
"CREATE_TIME": "2025-07-23T17:49:40.554851Z",
"ID": 1,
"LAST_OFFLINE_TIME": null,
"MODIFY_TIME": "2025-07-23T17:52:49.259607Z",
"SQL_PORT": 2881,
"START_SERVICE_TIME": "2025-07-23T17:52:47.354459Z",
"STATUS": "ACTIVE",
"STOP_TIME": null,
"SVR_IP": "x.x.x.x",
"SVR_PORT": 2881,
"WITH_ROOTSERVER": "YES",
"ZONE": "zone1"
}

Step 4: Integrate with your MCP client

After the test is successful, you now have your own MCP server without writing any code. You can integrate any MCP client with the large language model to make your work more efficient.

Supported MCP clients

  • Continue - An IDE plugin that supports Visual Studio Code and IntelliJ IDEA
  • Claude Desktop - Anthropic's desktop application
  • Cline - A command-line AI assistant
  • Other clients that support the MCP protocol

What to do next

  • Customize the tool configuration and add more seekdb-related SQL queries.
  • Integrate it into your workflow to improve database management and analysis efficiency.
  • Explore more MCP tools and features.