功能簡(jiǎn)介
OceanBase MCP Server 是一款為 OceanBase 數(shù)據(jù)庫(kù)打造的 MCP 服務(wù)端,實(shí)現(xiàn)了安全可控的數(shù)據(jù)庫(kù)交互通道。它讓 AI 助手可以在受控環(huán)境下,讀取表數(shù)據(jù)、執(zhí)行 SQL 查詢(xún),便于數(shù)據(jù)庫(kù)探索與分析,同時(shí)保障數(shù)據(jù)安全。
主要功能特性
-
- ? 列出
OceanBase
-
- ?數(shù)據(jù)庫(kù)中的表資源? 讀取表內(nèi)容? 執(zhí)行
SQL
- ?查詢(xún)并提供異常處理? 通過(guò)環(huán)境變量實(shí)現(xiàn)安全的數(shù)據(jù)庫(kù)訪(fǎng)問(wèn)? 全面日志記錄,便于審計(jì)和追蹤
快速開(kāi)始指引
- 1. 克隆項(xiàng)目代碼:?
git clone https://github.com/oceanbase/mcp-oceanbase.git?
-
- 2. 安裝 Python 包管理器 uv 并創(chuàng)建虛擬環(huán)境3. 復(fù)制
?.env.template
-
- ? 為
?.env?
-
- ?并配置數(shù)據(jù)庫(kù)連接信息4. 安裝依賴(lài):?`uv pip install .?``5. 選擇
stdio
-
- ?或
sse
- ?模式啟動(dòng) MCP Server
可用工具
-
- ? 執(zhí)行
SQL
-
- ?查詢(xún)? 獲取當(dāng)前租戶(hù)信息? 獲取所有服務(wù)器節(jié)點(diǎn)(僅 sys 租戶(hù))? 獲取資源容量(僅 sys 租戶(hù))? 獲取
ASH
- ?報(bào)告? 官方文檔檢索(實(shí)驗(yàn)性)
MCP配置
可通過(guò)環(huán)境變量(OB_HOST、OB_PORT、OB_USER、OB_PASSWORD、OB_DATABASE)或?.env
?文件配置數(shù)據(jù)庫(kù)連接參數(shù)。支持?stdio
?和?sse
?兩種通訊模式,端口、主機(jī)可自定義。
{
? "mcpServers": {
? ? "oceanbase": {
? ? ? "command": "uv",
? ? ? "args": [
? ? ? ? "--directory",?
? ? ? ? "path/to/mcp-oceanbase",
? ? ? ? "run",
? ? ? ? "oceanbase_mcp_server"
? ? ? ],
? ? ? "env": {
? ? ? ? "OB_HOST": "localhost",
? ? ? ? "OB_PORT": "2881",
? ? ? ? "OB_USER": "your_username",
? ? ? ? "OB_PASSWORD": "your_password",
? ? ? ? "OB_DATABASE": "your_database",
? ? ? ? "UV_DEFAULT_INDEX": "https://mirrors.aliyun.com/pypi/simple/"
? ? ? }
? ? }
? }
}
項(xiàng)目地址
github:https://github.com/oceanbase/mcp-oceanbase
獲取密鑰流程:https://qianniucity.feishu.cn/wiki/WSBYwhIBbixbsNkyhoxcV4U9nKe?from=from_copylink
完整操作流程:https://qianniucity.feishu.cn/wiki/Iy5PwuYuCiPwrQk6xTgc5j6Anob?from=from_copylink
#OceanBase??#MCP??#數(shù)據(jù)庫(kù)安全??#AI助手??#SQL