Skip to content

feat(mcp): keep the MCP server off until MCP_SERVER_ENABLED is set - #21349

Merged
nwadams merged 9 commits into
na--ai-service-imagefrom
na--mcp-server-flag
Nov 23, 2026
Merged

nwadams merged 9 commits into
na--ai-service-imagefrom
na--mcp-server-flag

Conversation

@nwadams

@nwadams nwadams commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Stack. This is one PR in a series that adds a built-in MCP server to DataHub Core. It is based on na--ai-service-image (the previous PR in the stack); review only its own commit. This PR changes GMS, the frontend, Docker or CI, not only the new Python packages. Everything user-facing is behind a GMS feature flag, MCP_SERVER_ENABLED, off by default (added in #21349).

Stack so far:

  1. feat(mcp): add DataHub's built-in MCP server, off by default #21332
  2. feat(mcp): read GMS version and deployment from /config #21333
  3. feat(ai): scaffold the datahub-ai-service with /health #21334
  4. feat(ai): serve MCP at /mcp with caller-scoped DataHub clients #21335
  5. build(ai): add PyPI release scripts for datahub-core-mcp-tools and datahub-ai-service #21336
  6. feat(mcp): filter tools by the connected GMS version #21337
  7. feat(mcp): compile GraphQL for the exact GMS version with #[since] markers #21338
  8. test(mcp): validate packaged GraphQL against pinned GMS schemas #21339
  9. feat(mcp): tool groups and tool-aware server instructions #21340
  10. feat(mcp): deliver tool cancellation safely and report progress on slow tools #21341
  11. feat(mcp): shared limits, truncation, list coercion and ToolError mapping #21342
  12. feat(mcp): ReadBackend and ResultPolicy retrieval seams #21343
  13. feat(ai): bound GMS requests and never replay one GMS may have run #21344
  14. feat(gms): report whether authentication is enabled in /config #21345
  15. feat(ai): follow GMS's auth mode on /mcp #21346
  16. feat(ai): refuse DNS-rebinding requests to /mcp while GMS auth is off #21347
  17. feat(ai): datahub-ai-service docker image and locked dependencies #21348
  18. feat(mcp): keep the MCP server off until MCP_SERVER_ENABLED is set #21349 ← this PR
  19. feat(frontend): proxy /mcp to the datahub-ai-service #21350
  20. ci(ai): build the datahub-ai-service image on every relevant PR #21351
  21. feat(docker): run datahub-ai-service in quickstart and datahub-dev #21352
  22. test(smoke): MCP through the frontend's /mcp route #21353
  23. feat(mcp): port the read tools to DataHub Core's MCP server #21435
  24. feat(mcp): port the get_entities tool #21436
  25. feat(mcp): port the list_schema_fields tool #21437
  26. feat(mcp): port the search_documents tool #21438
  27. feat(mcp): port the grep_documents tool #21439
  28. feat(mcp): port the grep_entities tool #21440
  29. feat(mcp): port the get_lineage tool #21441
  30. feat(mcp): port the get_lineage_paths_between tool #21442
  31. feat(mcp): port the get_dataset_queries tool #21443
  32. feat(mcp): port the get_dataset_usage_history tool #21444
  33. feat(mcp): port the get_aspect_history tool #21445
  34. feat(mcp): port the glossary term version read tools #21447
  35. feat(mcp): port the write tools to DataHub Core's MCP server #21501
  36. feat(mcp): add the create_tag tool #21502
  37. feat(mcp): port add_terms and remove_terms #21503
  38. feat(mcp): port create_glossary_term and add_related_terms #21504
  39. feat(mcp): port the create_glossary_term_version tool #21505
  40. feat(mcp): port set_domains and remove_domains #21506
  41. feat(mcp): add the create_domain tool #21507
  42. feat(mcp): port add_owners and remove_owners #21508
  43. feat(mcp): port the update_description tool #21509
  44. feat(mcp): port add_structured_properties and remove_structured_properties #21510
  45. feat(mcp): port the save_document tool #21511
  46. feat(mcp): port the update_document tool #21512

What this does

DataHub's built-in MCP server stays off until it is released. One GMS feature
flag, MCP_SERVER_ENABLED (featureFlags.mcpServerEnabled), default false,
controls both the backend and the UI:

  • GMS reports it in /config as mcpServer.enabled, next to
    authentication.enabled, and in the app config's feature flags.
  • datahub-ai-service reads it through the 60-second GmsServerInfo cache and
    answers 404 (mcp_disabled) on /mcp while it is off. /health stays up. A GMS
    from before the flag doesn't report it; that pairing is deliberate, so MCP
    stays on there. An unreadable /config gives a 503, like the other checks
    that need GMS.
  • The UI gets mcpServerEnabled in its app config, so later changes can hide
    the MCP settings page and home page module while it is off.

The datahub-ai-service container can still run with the flag off; it serves
only /health until the flag is turned on and GMS restarts.

Testing

Python tests for both packages (the gate: 404 while off, on for a GMS without the flag, 503 when /config can't be read); AppConfigResolverTest and ConfigServletTest. Checked live with the flag off (/mcp 404) and on.

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). The MCP docs come later in the stack.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Breaking Changes. The release notes come later in the stack.

🤖 Generated with Claude Code

@nwadams
nwadams requested a review from lakshay-nasa November 16, 2026 23:30
@github-actions github-actions Bot added product PR or Issue related to the DataHub UI/UX devops PR or Issue related to DataHub backend & deployment labels Nov 16, 2026
@cursor

cursor Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

PR Summary

Overview
Adds a single kill switch (MCP_SERVER_ENABLED / featureFlags.mcpServerEnabled, default false) that coordinates the built-in MCP server across GMS, the UI, and datahub-ai-service.

GMS now exposes the flag in /config as mcpServer.enabled and surfaces mcpServerEnabled through GraphQL appConfig (schema, resolver, React query/defaults). The UI can hide MCP settings and the Connect AI Tools module until the flag is on.

datahub-ai-service wraps /mcp with McpFeatureGate: when GMS reports the flag off, MCP requests get 404 (mcp_disabled); unreadable /config yields 503; if an older GMS omits the field, MCP stays enabled for backward compatibility. GmsServerInfo parses mcpServer.enabled from /config.

Tests cover the resolver, GMS config servlet, feature gate behavior, and config parsing; the new flag is registered in the properties classification test.

Reviewed by Cursor Bugbot for commit edd5c90. Bugbot is set up for automated code reviews on this repo. Configure here.

This was referenced Nov 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Smart test selection

pytest smoke tests

Mode: shadow. The selection below is computed but not applied; this PR still runs the default matrix (p0).

  • Selection: smart: tests for the tagged features, plus always-run modules, this PR's changed tests, and the plumbing sample if the PR changes the pytest harness
  • Size: 54 of 817 tests in 1 batch, predicted longest batch ~5 min
  • Tags: feature-dev: feature-flags; feature-user: home-page, settings; technical-layer: graphql, react-frontend, spring-config
  • Confidence: MEDIUM (16 changed files)
  • Classifier reasoning: Adds the mcpServerEnabled feature flag, exposed through GraphQL app config and GMS /config, and gates the AI service's /mcp endpoint; UI settings and home-page exposure is implied by the flag description but not in the changed files.

Medium confidence: a wrong tag means tests are skipped, so check the tags above against what this PR touches.

Selected scopes (6 files or classes, 54 tests)
  • tests/e2e/authorization/test_self_entity_auth.py
  • tests/e2e/dev_tooling/test_dev_tooling.py
  • tests/e2e/frontend/test_static_asset_encodings.py
  • tests/e2e/read_only/test_services_up.py
  • tests/e2e/search/test_search_projection.py::TestSearchProjection
  • tests/e2e/test_e2e.py

Add the run-all-tests:pytest label to run the full pytest suite on this PR.

commit edd5c90 · workflow run

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@meticulous

meticulous Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Meticulous spotted 0 visual differences across 932 screens tested: view results.

Meticulous evaluated ~18 hours of user flows which tested 100% of the executable lines edited in your PR.

Expected differences? Click here. Last updated for commit edd5c90 feat(mcp): keep the MCP server off until MCP_SERVER_ENABLED is set. This comment will update as new commits are pushed.

nwadams and others added 4 commits November 23, 2026 14:53
CI's package check compares find_packages with find_namespace_packages, and the
gql directory had no __init__.py. Make it a package and declare its .gql files
as its own package data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Installing metadata-ingestion and the two packages from source resolves their
build requirements from the configured index. In CI that index needs the netrc
secret, which only the lock install step mounted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FastMCP 4.2.5 serves subscriptions/listen, and on the 2026-07-28 protocol the
SDK advertises listChanged whenever that handler is registered, overriding the
notification options. Drop the handler: the server never sends change
notifications, and an in-process bus can't reach clients on another replica.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
master now adds its own placeholder right after __SYSTEM_CLIENT_SECRET__.
Keeping ours one line further down lets both changes merge without a
conflict. The replacements are independent, so their order doesn't matter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

2 active deployments
datahub-project-web-react (Preview) — 66f97775 Deployed Nov 23, 2026 by github-actions[bot]
Preview — 66f97775 Deployed Nov 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops PR or Issue related to DataHub backend & deployment product PR or Issue related to the DataHub UI/UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants