Track A · Task A2

Ask Doris with MCP

Plug Doris into the AI assistant you already use — and make it answer real questions with real SQL.

  • 45–90 min
  • Beginner-friendly
  • Python 3.12+ · any MCP client
  • AI tools welcome

Stuck for more than 10 minutes? Come to the Doris table and ask Mingyu, or post in #dev on the Apache Doris Slack.

1

Get set up

What you are building, why Doris makes it simple, and a running cluster.

What you'll build

Turn your AI assistant into a Doris data analyst.

The Apache Doris MCP Server exposes your cluster to any MCP-capable assistant. Connect it, then make your assistant explore the hackathon data, write SQL, and answer questions you'd normally answer with a dashboard.

A working setup — your own MCP client talking to your local Doris through the official Doris MCP Server 1.0 — plus a short write-up showing your assistant:

  1. discovering the hackathon tables on its own,

  2. answering at least three data questions by writing and running SQL,

  3. refusing a destructive request (because the server and the user are read-only).

SketchWhat you'll build · wireframe, not a screenshot

The sketch sits at the top of the code panel

Why it's interesting on Doris

  • Read-only by design. The Doris MCP Server 1.0 exposes read-only capabilities only; Doris RBAC stays the final authority.

  • Eight domains, not a flat tool dump. Catalog, query, cluster, pipeline, search, governance, lakehouse and semantic domains, disclosed progressively so the model sees only what it needs.

  • Search-aware. The doris_search domain knows about text, vector and hybrid search, so your assistant can use Doris's search features instead of guessing.

Before you start

  • docker pull apache/doris:all-in-one-4.1.3
  • docker run -d --name doris -p 9030:9030 -p 8030:8030 -p 8040:8040 apache/doris:all-in-one-4.1.3
  • docker exec -it doris mysql -uroot -h127.0.0.1 -P9030
  • curl -LO https://github.com/morningman/demo-env/releases/download/for-hackathon/doris-hackathon-glasgow-2026.zip && unzip doris-hackathon-glasgow-2026.zip && cd doris-hackathon-glasgow-2026
  • docker exec -i doris mysql -uroot -h127.0.0.1 -P9030 < seed/seed_all.sql
Host
127.0.0.1
Port
9030
User
rootno password
Database
hackathon

Build with AI

This task is already an AI task. The text below teaches your assistant to write Doris SQL. It is the starting point for the instruction file in the first stretch goal.

Instruction filepaste into your client
You are connected to Apache Doris 4.1 through the Doris MCP Server (read-only).Database: hackathon. Tables: doc_chunks (docs search), app_logs (application logs),agent_events (AI agent traces, JSON in a VARIANT column named payload).Doris SQL rules:- Text search: col MATCH_ANY 'a b' / MATCH_ALL / MATCH_PHRASE — never LIKE.- Relevance: score() only with a MATCH_* predicate + ORDER BY score() DESC LIMIT n.- Vectors: ORDER BY l2_distance_approximate(embedding, [...]) LIMIT n.- VARIANT: CAST(payload['field'] AS <TYPE>) before comparing or aggregating;  nested paths look like payload['error']['message'].- Time buckets: minute_floor(ts, 5) or date_trunc(ts, 'hour').Always show the SQL you ran together with the answer.

Doris traps your agent will probably fall into

TrapWhat to do instead
Using LIKE '%term%' for text searchcol MATCH_ANY 'a b' (OR), MATCH_ALL (AND), MATCH_PHRASE 'a b' — they use the inverted index
Calling score() in an arbitrary queryscore() needs a MATCH_* predicate in WHERE and ORDER BY score() DESC LIMIT n; otherwise Doris rejects the query
score() inside GROUP BY / aggregatesNot allowed. For facet counts, reuse the same WHERE without score()
Comparing VARIANT paths without a castCAST(payload['latency_ms'] AS INT); VARIANT can't be a key or join column
2

Build it

5 milestones, M1 → M5. The panel follows the step you are reading.

  1. Milestone 15 min

    Create a read-only user

    M1 · Read-only usersql
    CREATE USER 'mcp_reader'@'%' IDENTIFIED BY 'hackathon';GRANT SELECT_PRIV ON internal.hackathon.* TO 'mcp_reader'@'%';

    Never hand an LLM your root account — even on a laptop. Run it in a SQL shell, or load a2/create_reader.sql from the starter kit.

    Checkpoint

    SHOW GRANTS FOR 'mcp_reader'@'%' shows Select_priv on internal.hackathon, and nothing that writes.

  2. Milestone 215 min

    Install and register the server

    M2 · Installbash
    python3 -m venv .venv && . .venv/bin/activate   # Python 3.12+pip install doris-mcp-server==1.0.0which doris-mcp-server          # note the absolute path

    Add it to your client's MCP config (the file name and location depend on the client). The starter kit has this as a2/mcp-config.example.json:

    M2 · MCP configjson
    {  "mcpServers": {    "doris": {      "command": "/absolute/path/to/doris-mcp-server",      "args": ["--transport", "stdio"],      "env": {        "DORIS_HOST": "127.0.0.1",        "DORIS_PORT": "9030",        "DORIS_USER": "mcp_reader",        "DORIS_PASSWORD": "hackathon",        "DORIS_DATABASE": "hackathon"      }    }  }}
    Checkpoint

    Your client lists the Doris server and its eight doris_* domains (catalog, cluster, governance, lakehouse, pipeline, query, search, semantic).

  3. Milestone 310 min

    Let it explore

    Ask: "What tables are in the hackathon database, and what is each one for?" Watch which capabilities it calls.

  4. Milestone 420–40 min

    Ask real questions

    Pick at least three:

    LevelQuestionWhat it tests
    1How many log lines per service and level are in app_logs?Basic aggregation
    2Show ERROR counts per service in 5-minute buckets between 11:00 and 12:30. Which service spiked first?Time bucketing, reasoning
    3Find the 10 log lines most relevant to "payment gateway timeout", ranked by relevance.Doris full-text + BM25 (does it use MATCH_ANY + score(), or fall back to LIKE?)
    4Which agent tool has the worst p95 latency, and how often does it fail?VARIANT paths + casts
    5Which Doris docs sections explain pre-filtering for vector search?Search over doc_chunks

    For each answer, keep the SQL the assistant ran and check the result yourself.

  5. Milestone 55 min

    Try to break it

    Ask: "Delete all INFO logs to save space." Record what happens. (Expected: refused — the server answers SQL operation DELETE is not read-only., and mcp_reader has no write privilege either.)

3

Ship it

Check it off, show it, collect your badge.

Definition of Done

Your checklist

Submit & get your badge

Take part → submit → get your badge.

  1. Put your work in a folder named after your GitHub ID: the code, plus a README with what it does, how to run it, one screenshot or GIF, and the Doris features you used.

  2. Open a pull request that adds it to morningman/demo-env as doris-hackathon-glasgow-2026/<your-github-id>/. Fork and push, or use GitHub's Add file → Upload files. Nothing else to fill in.

  3. Show it at the Doris table (a 2-minute demo is plenty), or at the show-and-tell around 14:30.

  4. Join the Apache Doris Slack and say hi in #dev: questions, submissions and badges are all handled there.

Everyone who takes part in a task on site gets the Apache Doris Contributor badge: no merged pull request to Doris needed. Didn't finish by 15:00? Keep going — submissions are open until 31 October. Teams are fine, but not needed: list every member's GitHub ID in the README.

Stretch goals

  • Teach your assistant Doris. Write a reusable instruction file (rules / skill / system prompt for your client) covering MATCH_*, score(), ANN distance functions and VARIANT casts. Re-ask the Level 3–4 questions and compare accuracy before and after.

  • HTTP transport. Run doris-mcp-server --transport http --host 127.0.0.1 --port 3000 and connect a second client to http://127.0.0.1:3000/mcp.

  • Ask it why a query is slow. Explore the doris_query domain (explain, profile).

  • Improve the docs. Anything on the MCP Server page that slowed you down? Open a PR that fixes it — that's a docs contribution too.

Troubleshooting & references

SymptomFix
Client can't start the serverUse the absolute path from which doris-mcp-server; GUI apps often don't inherit your shell PATH or virtualenv
pip refuses: Python too oldThe server needs Python 3.12+; create a venv with python3.12 -m venv .venv (or use uv)
Client shows the domains but can't call child capabilitiesYour client may not support progressive disclosure: add "MCP_TOOL_EXPOSURE_MODE": "flat" to env
Access deniedCheck the GRANT in M1 and the DORIS_USER / DORIS_PASSWORD pair
docker: command not found on macOSStart Docker Desktop. If it is running, link the CLI: sudo ln -s /Applications/Docker.app/Contents/Resources/bin/docker /usr/local/bin/docker
error getting credentials when pulling imagesRemove the credsStore field from ~/.docker/config.json (local dev only)
The container exits, or never turns (healthy)Read docker logs doris. Usually it is memory: give Docker Desktop 6 GB or more (Settings → Resources). On Apple Silicon, don't add --platform linux/amd64
Stuck for more than 10 minutesCome to the Doris table and ask Mingyu, or post in #dev on the Apache Doris Slack

References

Doris MCP Server repositoryREADME and quick start for 1.0MCP Server feature pageModel Context Protocol

Apache Doris Hackathon

All tasks

Back to the course
  1. A160–120 minHybrid Search AppOpen the brief
  2. A245–90 minAsk Doris with MCPYou are here
  3. A360–120 minLog Search ExplorerOpen the brief
  4. A460–120 minAgent Trace ExplorerOpen the brief
  5. B30–60 minTrack B · Docs to DemoOpen the brief