Jiyoung Yoo has uploaded this change for review. ( http://gerrit.cloudera.org:8080/24816
Change subject: Add tpch-claude-mcp: demo MCP server for natural-language TPC-H queries ...................................................................... Add tpch-claude-mcp: demo MCP server for natural-language TPC-H queries Standalone package, not part of the Impala build: an MCP server exposing one tool, run_tpch_query, so a Claude client can answer natural-language TPC-H questions by writing SQL itself and running it against an Impala cluster over HS2 -- no other integration code needed on the client side. Whether the query runs on Impala's own planner or is routed to GQE is controlled purely by env vars at server startup (ROUTE_TO_GQE, GQE_ENDPOINT); the tool has no other GQE-specific logic, so flipping GQE on once it's reachable is a restart, not a code change. - server.py: the MCP server (mcp.server.mcpserver.MCPServer -- the current SDK's FastMCP-renamed class), connecting via impyla. - setup.sh: one-shot venv + dependency install, prints the exact `claude mcp add` command for wherever it's unpacked. - requirements.txt: pinned mcp==2.2.0/impyla==0.24.0/thrift_sasl==0.4.3. Deliberately no checked-in .venv/: a virtualenv bakes absolute paths into its shebangs at creation time, so one built here would silently break once copied elsewhere. - README.md: setup, the env-var table, a troubleshooting section for the FastMCP/MCPServer rename this was built against, and a "flipping on GQE" section. - SAMPLE_QUESTIONS.md: four natural-language questions verified end-to-end against SF1 tpch data, with their generated SQL and exact expected answers -- a script to fall back on live. - mcp-config-example.json: drop-in .mcp.json block. Testing: - Ran the full setup.sh -> claude mcp add -> ask-a-question path against a live single-node cluster loaded with SF1 tpch data. - Verified the packaged tarball itself (built via `tar czf tpch-claude-mcp.tar.gz tpch-claude-mcp/`, not committed here -- regenerate from this directory when sharing), not just this source tree: extracted it to an unrelated path, ran setup.sh there, and confirmed the resulting server connects and runs a real query. - Confirmed the tool's SELECT-only guard rejects a DELETE, and that a query referencing an unknown column surfaces Impala's own AnalysisException message rather than crashing or hanging. Also make the SF1 assumption in the tool description explicit rather than hardcoded: add TPCH_SCALE_FACTOR (purely descriptive, defaults unset) so the description Claude sees says "scale factor N" when set, or otherwise notes that table/column names and how to write SQL are identical at every scale -- a user asking a question never needs to mention scale either way, only the tool's own self-description needed the caveat. Change-Id: I516f33ceee3827ecdae613db79e40991af74a6fd --- A tpch-claude-mcp/README.md A tpch-claude-mcp/SAMPLE_QUESTIONS.md A tpch-claude-mcp/mcp-config-example.json A tpch-claude-mcp/requirements.txt A tpch-claude-mcp/server.py A tpch-claude-mcp/setup.sh 6 files changed, 379 insertions(+), 0 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/16/24816/2 -- To view, visit http://gerrit.cloudera.org:8080/24816 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I516f33ceee3827ecdae613db79e40991af74a6fd Gerrit-Change-Number: 24816 Gerrit-PatchSet: 2 Gerrit-Owner: Jiyoung Yoo <[email protected]> Gerrit-Reviewer: Abhishek Rawat <[email protected]> Gerrit-Reviewer: Kurt Deschler <[email protected]> Gerrit-Reviewer: Michael Smith <[email protected]>
