---
title: "OceanBase MCP Server 与 Continue 集成 - OceanBase 数据库 V4.3.5 | OceanBase 文档中心"
description: OceanBase MCP Server 与 Continue 集成 MCP（Model Context Protocol） 是 Anthropic 公司于 2024 年 11 月推出并开源，旨在实现大语言模型与外部工具或数据源交互的协议。通过 MCP，用户不需要将大模型的输出手动复制执行，大模型可以直接指挥工具执行…
---
切换语言

- 中文站 - 简体中文
- International - English
- 日本站 - 日本語

文档反馈![](https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*P8CuR4UJ_FkAAAAAAAAAAAAADiGDAQ/original) OceanBase 数据库分布式版 - V 4.3.5 LTS

# OceanBase MCP Server 与 Continue 集成

更新时间：2026-04-09 14:12:04

[编辑](https://github.com/oceanbase/oceanbase-doc/edit/V4.3.5/zh-CN/680.ecological-integration/1100.AI/1100.continue.md)  

[MCP（Model Context Protocol）](https://modelcontextprotocol.io/introduction) 是 Anthropic 公司于 2024 年 11 月推出并开源，旨在实现大语言模型与外部工具或数据源交互的协议。通过 MCP，用户不需要将大模型的输出手动复制执行，大模型可以直接指挥工具执行相应的动作（Action）。

[OceanBase MCP Server](https://github.com/oceanbase/mcp-oceanbase/tree/main/src/oceanbase_mcp_server) 通过 MCP 协议提供了大模型与 OceanBase 数据库交互的能力，可以执行 SQL 语句。通过合适的客户端可以快速搭建项目原型，已在 github 上开源。

[Continue](https://continue.dev) 是一款可集成 MCP Server 的 IDE 插件，支持 Visual Studio Code 和 IntelliJ IDEA。

本文将展示如何使用 Continue 与 OceanBase MCP Server 集成，快速构建后端应用程序。

## 前提条件

- 您已完成部署 OceanBase 数据库并且创建了 MySQL 模式用户租户。创建用户租户的详细信息，参见 [创建租户](https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000002013128)。
 - 安装 [Python 3.11 及以上版本](https://www.python.org/downloads/) 和相应 [pip](https://pip.pypa.io/en/stable/installation/)。如果您的机器上 Python 版本较低，可以使用 Miniconda 来创建新的 Python 3.11 及以上的环境，具体可参考 [Miniconda 安装指南](https://docs.anaconda.com/miniconda/install/)。
 - 根据所用的操作系统，安装 [Git](https://git-scm.com//downloads)。
 - 安装 Python 包管理器 uv。安装完成后，可使用 `uv --version` 命令验证安装是否成功：

  ```shell
  pip install uv
  uv --version

  ```
 - 使用 Visual Studio Code 或 IntelliJ IDEA 安装 Continue 插件，插件名称为 `Continue`。

  ![配置大模型 API](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/cloud/integrations/AI/continue-1.png)

     - 安装完成后，点击 `Add Models`，为 Continue 配置大模型 API。API 配置示例如下：

      ![配置大模型 API](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/cloud/integrations/AI/continue-2.png)

           - 配置文件示例如下：

            ```json
            name: Local Assistant
            version: 1.0.0
            schema: v1
            models:
                # 模型名称
                - name: DeepSeek-R1-671B
                # 模型厂商
                provider: deepseek
                # 模型类型
                model: DeepSeek-R1-671B
                # 模型访问的 URL 地址
                apiBase: *********
                # 模型访问的 API 密钥
                apiKey: ********
            # 上下文提供者
            context:
                - provider: code
                - provider: docs
                - provider: diff
                - provider: terminal
                - provider: problems
                - provider: folder
                - provider: codebase

            ```

## 步骤一：获取数据库连接信息

联系 OceanBase 数据库部署人员或者管理员获取相应的数据库连接串，例如：

```sql
obclient -h$host -P$port -u$user_name -p$password -D$database_name

```

**参数说明：**

- `$host`：提供 OceanBase 数据库连接 IP。OceanBase 数据库代理（OceanBase Database Proxy，ODP）连接方式使用的是一个 ODP 地址；直连方式使用的是 OBServer 节点的 IP 地址。
 - `$port`：提供 OceanBase 数据库连接端口。ODP 连接的方式默认是 `2883`，在部署 ODP 时可自定义；直连方式默认是 `2881`，在部署 OceanBase 数据库时可自定义。
 - `$database_name`：需要访问的数据库名称。

  #### 注意

  连接租户的用户需要拥有该数据库的 `CREATE`、`INSERT`、`DROP` 和 `SELECT` 权限。更多有关用户权限的信息，请参见 [MySQL 模式下的权限分类](https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000002016100)。
 - `$user_name`：提供租户的连接账户。ODP 连接的常用格式：`用户名@租户名#集群名` 或者 `集群名:租户名:用户名`；直连方式格式：`用户名@租户名`。
 - `$password`：提供账户密码。

更多连接串的信息，请参见 [通过 OBClient 连接 OceanBase 租户](https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000002013251)。

## 步骤二：配置 OceanBase MCP Server

### 克隆 OceanBase MCP Server 仓库

执行下面的命令将源代码下载到本地：

```shell
git clone https://github.com/oceanbase/mcp-oceanbase.git

```

进入源代码目录：

```shell
cd mcp-oceanbase

```

### 安装依赖

在 `mcp-oceanbase` 目录下执行下面的命令创建虚拟环境，并安装依赖：

```shell
uv venv
source .venv/bin/activate
uv pip install .

```

### 添加并配置 MCP Servers

1. 点击对话框上方菜单栏最右侧按钮，打开 MCP 面板。

   ![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/cloud/integrations/AI/continue-3.png)
 2. 点击添加 `MCP Servers`。

   #### 注意

   MCP 仅可在 Continue 的 Agent 模式下使用。

   ![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/cloud/integrations/AI/continue-4.png)
 3. 填写配置文件，点击确认。

   `/path/to/your/mcp-oceanbase/src/oceanbase_mcp_server` 需要替换为 `oceanbase_mcp_server` 文件夹的绝对路径，`OB_HOST`、`OB_PORT`、`OB_USER`、`OB_PASSWORD`、`OB_DATABASE` 需要替换为自己数据库的对应信息：

   ```json
   name: OceanBase
   version: 0.0.1
   schema: v1
   mcpServers:
       - name: 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: "***"

   ```
 4. 如配置成功，将显示以下内容：

   ![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/cloud/integrations/AI/continue-5.png)

 上一篇 下一篇 ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ)[AI](https://www.oceanbase.com/obi) 咨询热线
