home / mcp / doris mcp server

Doris MCP Server

Apache Doris MCP Server

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "apache-doris-mcp-server": {
      "url": "http://<host>:<port>/mcp",
      "headers": {
        "DORIS_HOST": "<host>",
        "DORIS_PORT": "9030",
        "DORIS_USER": "root",
        "DORIS_PASSWORD": "your_password",
        "ENABLE_TOKEN_AUTH": "true",
        "ENABLE_HTTP_TOKEN_MANAGEMENT": "true",
        "TOKEN_MANAGEMENT_ADMIN_TOKEN": "<secure_token>",
        "TOKEN_MANAGEMENT_ALLOWED_IPS": "127.0.0.1,::1"
      }
    }
  }
}

Doris MCP Server provides a structured, secure backend that exposes a set of tools to interact with Doris databases via a standardized MCP interface. It supports streamable HTTP for scalable client communications and a stdio mode for direct, process-driven integration, making it suitable for production-grade workflows, automation, and multi-tenant setups with token-bound configuration and enterprise security features.

How to use

You connect to Doris MCP Server with a compatible MCP client using one of the supported transport modes. In HTTP mode, your client communicates over a RESTful-like endpoint that streams responses and supports tool invocations to run SQL, fetch metadata, and perform governance tasks. In stdio mode, your client interacts through standard input/output, which is ideal for tight integrations such as Cursor or other local tooling.

Key usage patterns include initializing the MCP session, discovering available tools, and invoking a tool by name with its required arguments. You can run SQL queries, retrieve table schemas, list databases and catalogs, and access a suite of analytics and governance tools. The server supports catalog federation, so you can query internal Doris catalogs as well as external sources in a unified way.

To verify that the service is reachable, you can health-check the HTTP endpoint and perform a basic tool call flow from your MCP client. The Streamable HTTP endpoint is the primary MCP interface and is designed to handle both streaming and non-streaming interactions efficiently.

How to install

Prerequisites you need before installing are Python 3.12+ and access to a Doris database (host, port, user, password, and target database). You will also typically run the MCP server in a terminal or via Docker in production.

Step-by-step installation and startup flow: - Install the MCP server package for Python environments - Configure environment variables or command line arguments for your Doris connection and security settings - Start the server in HTTP transport mode for production use or in stdio mode for local development and Cursor integrations

Concrete commands you can use to begin (HTTP mode): - Install the MCP server package - Start the server with HTTP transport and database connection parameters - Optional: start in stdio mode for local development or testing

Additional sections

Configuration and security in v0.6.0 introduce token-based authentication, token-bound database configuration, hot reloading of tokens, and multi-worker scalability. You can enable a secure web-based token management dashboard that allows token creation, revocation, statistics, and audit trails, all secured to localhost by default.

The server offers a diverse suite of MCP tools, including query execution, metadata extraction, data governance, and ADBC (Arrow Flight SQL) capabilities for high-performance data transfer. It also provides robust SQL security validation, data masking, and RBAC to ensure safe access control across catalogs and databases.

If you plan to deploy with Cursor in Streamable HTTP mode, configure Cursor to point to the serverโ€™s /mcp endpoint and ensure the server is started with the appropriate transport. For development in stdio mode, you can run the server directly and connect via the Cursor integration points. These options allow you to choose between local development ergonomics and production-grade multi-user access.

Security and token management

Security in this server is designed to support token-based authentication, optional JWT and OAuth, hot-reload of token configurations, and token-bound database connections. You can manage tokens via a local dashboard or by editing a tokens.json file, with automatic persistence and audit logging.

Token binding allows each token to carry its own database connection parameters, enabling secure multi-tenant access. The hot reload mechanism watches the token file and applies changes with immediate validation and rollback if errors occur, ensuring zero-downtime updates.

Examples and troubleshooting

Common issues include connection timeouts, at_eof errors, and MCP library compatibility. Solutions cover increasing timeouts, verifying network connectivity, and using recommended MCP versions. Enhanced logging with level-based files helps diagnose problems quickly.

For production-grade deployments, enable the HTTP token management interface on localhost, enforce admin authentication, and restrict access to trusted IPs. Regularly review audit logs and ensure tokens are rotated according to your security policy.

Notes and compatibility

The server supports both Streamable HTTP and Stdio modes, with explicit configuration options shown in code examples. When configuring multiple MCP endpoints, prefer the HTTP endpoint for production and the Stdio mode for development and Cursor integration.

Available tools

exec_query

Execute SQL query and return results.

get_table_schema

Get detailed table structure information.

get_db_table_list

Get list of all table names in specified database.

get_db_list

Get list of all database names.

get_table_comment

Get table comment information.

get_table_column_comments

Get comment information for all columns in table.

get_table_indexes

Get index information for specified table.

get_recent_audit_logs

Get audit log records for recent period.

get_catalog_list

Get list of all catalog names.

get_sql_explain

Get SQL execution plan with configurable content truncation and file export for LLM analysis.

get_sql_profile

Get SQL execution profile with content management and file export for LLM optimization workflows.

get_table_data_size

Get table data size information via FE HTTP API.

get_monitoring_metrics_info

Get Doris monitoring metrics definitions and descriptions.

get_monitoring_metrics_data

Get actual Doris monitoring metrics data from nodes with flexible BE discovery.

get_realtime_memory_stats

Get real-time memory statistics via BE Memory Tracker with auto/manual BE discovery.

get_historical_memory_stats

Get historical memory statistics via BE Bvar interface.

analyze_data_quality

Comprehensive data quality analysis.

trace_column_lineage

End-to-end column lineage tracking.

monitor_data_freshness

Real-time data staleness monitoring.

analyze_data_access_patterns

User behavior analysis and security anomaly detection.

analyze_data_flow_dependencies

Data flow impact analysis and dependency mapping.

analyze_slow_queries_topn

Performance bottleneck identification with top-N slow query analysis.

analyze_resource_growth_curves

Capacity planning with resource growth analysis.

exec_adbc_query

High-performance SQL execution using ADBC Arrow Flight SQL.

get_adbc_connection_info

ADBC connection diagnostics and status monitoring.