Files
doris-mcp-server/examples/cursor
haijun huang d4ea125e35 add cursor demo (#4)
* add cursor demo

* fix image
2025-07-02 10:00:22 +08:00
..
2025-07-02 10:00:22 +08:00

Cursor Example: Integrating Doris MCP Server

This guide provides step-by-step instructions on how to integrate the doris-mcp-server with the Cursor IDE. This integration allows you to interact with your Apache Doris database using natural language queries directly within Cursor's AI chat.

Table of Contents


Prerequisites

Before you begin, ensure you have the following installed and configured:

  • The Cursor IDE
  • Git for cloning the repository
  • Access to an Apache Doris cluster (FE host, port, username, and password)
  • uv, a fast Python package installer and runner

You can install uv with one of the following commands:

# For macOS (recommended)
brew install uv

# For other systems using pipx
pipx install uv

Step 1: Set Up the Project

First, clone the doris-mcp-server repository to your local machine:

git clone https://github.com/apache/doris-mcp-server.git

cd doris-mcp-server

The necessary dependencies are listed in requirements.txt and will be managed automatically by uv in the next step.


Step 2: Configure the MCP Server in Cursor

  1. Open the cloned doris-mcp-server directory in Cursor.
  2. Click the ⚙️ icon (top-right), then go to Tools & Integrations. add MCP Server
  3. Click Add a custom MCP Server.
  4. Paste the following JSON configuration:
{
  "mcpServers": {
    "doris-mcp": {
      "command": "uv",
      "args": [
        "run",
        "--project",
        "/path/to/your/doris-mcp-server",
        "mcp-doris-server"
      ],  
      "env": {
        "DB_HOST": "your_doris_fe_host",
        "DB_PORT": "9030",
        "DB_USER": "your_username",
        "DB_PASSWORD": "your_password",
        "DB_DATABASE": "ssb"
      }
    }
  }
}

⚠️ Important:

  • Replace "/path/to/your/doris-mcp-server" with the absolute path to your local project directory.
  • Fill in your actual Doris FE host, username, password, and database name.

Step 3: Verify the Integration

Once saved, go back to the Settings panel. If everything is configured correctly, youll see a green status dot next to doris-mcp-server, along with available tools like exec_query.

MCP Server


Step 4: Query Your Database

You can now chat with Cursor Agent to run SQL queries against your Doris database.

  1. Open the chat panel using Cmd + K (macOS) or Ctrl + K (Windows/Linux), or click the chat icon in the top-right.
  2. Switch to Agent Mode.
  3. Start asking questions using natural language.

ask


Example 1: List Tables

Prompt: What tables are in the ssb database?

The agent will call the get_db_table_list tool and return the results.

ask


Prompt: What has been the sales trend over the past ten years in the ssb database, and which year had the fastest growth?

The agent will generate an appropriate SQL query, send it to the MCP server, and interpret the results to give you growth trends and highlights.

ask