feat(ai-service): enforce the MCP settings and serve the tool catalog
Stack. Part of the series that adds a built-in MCP server to DataHub Core. Based on na--mcp-docs-and-smoke (#21589); review only its own commits.
Stack so far:
1–22. Merged to master as #21332.
23–34. #21435, the read tools.
35–46. #21501, the write tools (PRs 36–46 merged into it).
47–55. #21587, MCP settings: model, API and UI.
56–60. #21588, telemetry, metrics, usage events and the stdio server.
61–64. #21589, docs, release notes and smoke tests.
65–68. #21590, settings enforcement and the tool catalog. ← this PR
69–70. #21591, the home page module.
71–74. #21623, the ingestion tools.
What this does
Makes datahub-ai-service follow the MCP settings page, and serves the tool catalog the settings UI reads. It combines what would have been stack PRs 65–68, one commit each.
- Settings policy: reads and caches
mcpSettings. - Enforcement on
/mcp: the master switch, the default server's switch, its instructions and its tool selection. - Tool catalog: served at
/catalog/toolson the service. - Frontend proxy: the frontend proxies the catalog at
/ai/catalog/toolswith the session's auth.
Testing
- Python:
datahub-ai-servicelint and tests: 164. - Java:
AiServiceControllerTest.
Checklist
- The PR conforms to DataHub's Contributing Guideline (particularly PR Title Format)
- Tests for the changes have been added/updated (if applicable)
- Docs related to the changes have been added/updated (if applicable)
- For any breaking change/potential downtime/deprecation/big changes an entry has been made in Breaking Changes. Not applicable: off by default.
🤖 Generated with Claude Code
Summary by cubic
Makes the DataHub AI service enforce the MCP settings page on /mcp, and serves the tool catalog the settings page's tool picker needs.
/mcpnow answers 404 while MCP is off in settings and 503 when the settings can't be read, instead of always serving defaults.- Settings are read from GMS with the caller's token, validated, cached for 60 seconds, and shared by every caller; a GMS older than the settings API keeps the old defaults.
- The Default server's tool selection filters both the tool list and direct calls, its instruction size and custom instructions apply per request, and
TOOLS_IS_MUTATION_ENABLED=falseon the service always wins over the selection. GET /catalog/toolson the service lists every selectable tool the connected GMS can run; the frontend serves it to signed-in users at/ai/catalog/tools./healthreports the settings state (unknown,enabled,disabled,unavailable) without the settings themselves.
Migration
- Deploy the frontend and service together: the tool picker on the settings page needs the new
/ai/catalog/toolsroute.