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.
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:
discovering the
hackathontables on its own,answering at least three data questions by writing and running SQL,
refusing a destructive request (because the server and the user are read-only).
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_searchdomain 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.3docker run -d --name doris -p 9030:9030 -p 8030:8030 -p 8040:8040 apache/doris:all-in-one-4.1.3docker exec -it doris mysql -uroot -h127.0.0.1 -P9030curl -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-2026docker 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.
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
| Trap | What to do instead |
|---|---|
Using LIKE '%term%' for text search | col MATCH_ANY 'a b' (OR), MATCH_ALL (AND), MATCH_PHRASE 'a b' — they use the inverted index |
Calling score() in an arbitrary query | score() needs a MATCH_* predicate in WHERE and ORDER BY score() DESC LIMIT n; otherwise Doris rejects the query |
score() inside GROUP BY / aggregates | Not allowed. For facet counts, reuse the same WHERE without score() |
| Comparing VARIANT paths without a cast | CAST(payload['latency_ms'] AS INT); VARIANT can't be a key or join column |
Build it
5 milestones, M1 → M5. The panel follows the step you are reading.
Create a read-only user
M1 · Read-only usersqlCREATE 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.sqlfrom the starter kit.CheckpointSHOW GRANTS FOR 'mcp_reader'@'%'showsSelect_privoninternal.hackathon, and nothing that writes.Install and register the server
M2 · Installbashpython3 -m venv .venv && . .venv/bin/activate # Python 3.12+pip install doris-mcp-server==1.0.0which doris-mcp-server # note the absolute pathAdd 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" } } }}CheckpointYour client lists the Doris server and its eight
doris_*domains (catalog, cluster, governance, lakehouse, pipeline, query, search, semantic).Let it explore
Ask: "What tables are in the hackathon database, and what is each one for?" Watch which capabilities it calls.
Ask real questions
Pick at least three:
Level Question What it tests 1 How many log lines per service and level are in app_logs?Basic aggregation 2 Show ERROR counts per service in 5-minute buckets between 11:00 and 12:30. Which service spiked first? Time bucketing, reasoning 3 Find 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 toLIKE?)4 Which agent tool has the worst p95 latency, and how often does it fail? VARIANT paths + casts 5 Which Doris docs sections explain pre-filtering for vector search? Search over doc_chunksFor each answer, keep the SQL the assistant ran and check the result yourself.
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., andmcp_readerhas no write privilege either.)
Ship it
Check it off, show it, collect your badge.
Definition of Done
Your checklistSubmit & get your badge
Take part → submit → get your badge.
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.
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.Show it at the Doris table (a 2-minute demo is plenty), or at the show-and-tell around 14:30.
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 3000and connect a second client tohttp://127.0.0.1:3000/mcp.Ask it why a query is slow. Explore the
doris_querydomain (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
| Symptom | Fix |
|---|---|
| Client can't start the server | Use the absolute path from which doris-mcp-server; GUI apps often don't inherit your shell PATH or virtualenv |
pip refuses: Python too old | The 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 capabilities | Your client may not support progressive disclosure: add "MCP_TOOL_EXPOSURE_MODE": "flat" to env |
| Access denied | Check the GRANT in M1 and the DORIS_USER / DORIS_PASSWORD pair |
docker: command not found on macOS | Start 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 images | Remove 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 minutes | Come 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
