Skip to content

test(smoke): MCP through the frontend's /mcp route - #21353

Merged
nwadams merged 5 commits into
na--quickstart-ai-servicefrom
na--mcp-smoke-tests
Nov 23, 2026
Merged

nwadams merged 5 commits into
na--quickstart-ai-servicefrom
na--mcp-smoke-tests

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--quickstart-ai-service (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
  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 ← this PR
  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

Smoke tests for datahub-ai-service behind the frontend, in whichever GMS
auth mode the stack runs (read from GMS /config):

  • Legacy (initialize first) and modern stateless clients list tools and
    call get_me, acting as the admin with a PAT when auth is on and as the
    system user when it is off.
  • Auth on: no token or a garbage one gets 401 with WWW-Authenticate.
  • Auth off: no token is needed, and a request with a foreign Host and
    Origin (DNS rebinding) gets 403.

A small requests-based JSON-RPC client handles both protocol families and
JSON or SSE responses, so the suite needs no new dependency.

Ran locally against a datahub-dev OSS instance with GMS auth off and on.

Testing

Ran against the datahub-dev OSS instance with GMS auth off (4 pass, 1 skip) and on (4 pass, 1 skip).

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
@cursor

cursor Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

PR Summary

Overview
Adds smoke e2e coverage for MCP at the frontend’s /mcp route: a lightweight requests-based client speaks legacy and 2026-07-28 stateless MCP (JSON or SSE), and tests exercise get_me, PAT auth when GMS auth is on, system-user behavior when it is off, and 403 on DNS-rebinding-style Host/Origin when tokenless.

Quickstart CI/smoke turns on MCP_SERVER_ENABLED=true in run-quickstart.sh so the suite can hit the built-in server.

Server/packaging tweaks for that path: disable_list_changed_capabilities now drops subscriptions/listen and clears subscriptions so stateless replicas don’t advertise unusable subscription behavior; GQL documents ship via a proper datahub_core_mcp_tools.gql package-data entry; the datahub-ai-service image passes the same netrc secret into the local uv pip install of source packages; Gradle quickstart compose generation moves the HOME → ${HOME} substitution slightly earlier in the replace chain.

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

@github-actions github-actions Bot added the smoke_test Contains changes related to smoke tests label Nov 16, 2026
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: p0: the p0 tier (fail-safe)
  • Size: 378 of 378 tests in 5 batches, predicted longest batch ~8 min
  • Tags: none
  • Confidence: LOW (9 changed files)
  • Classifier reasoning: The change adds MCP server and smoke tests for datahub-ai-service with no MCP taxonomy tag, so auth and access checks are the closest fit, and the build.gradle and Dockerfile edits lean toward build but are product-related.
  • Fell back to the fail-safe because: the classifier had low confidence in its tags
Selected scopes (81 files or classes, 378 tests)
  • tests/e2e/assertions/assertions_test.py
  • tests/e2e/assertions/custom_assertions_test.py
  • tests/e2e/audit_events/audit_events_test.py
  • tests/e2e/authorization/test_aspect_write_auth.py
  • tests/e2e/authorization/test_credential_aspect_read_auth.py
  • tests/e2e/authorization/test_query_entity_read_auth.py
  • tests/e2e/cli/dataset_cmd/test_dataset_command.py
  • tests/e2e/cli/delete_cmd/test_timeseries_delete.py
  • tests/e2e/cli/graphql_cmd/test_graphql_cli_smoke.py::TestGraphQLCLIIntegration
  • tests/e2e/cli/ingest_cmd/test_timeseries_rollback.py
  • tests/e2e/cli/migrate_cmd/test_migrate_instance2instance_smoke.py
  • tests/e2e/cli/migrate_cmd/test_migrate_scenarios_smoke.py
  • tests/e2e/cli/search_cmd/test_search_cmd.py::TestSearchBasic
  • tests/e2e/cli/user_cmd/test_user_add.py
  • tests/e2e/cli/user_groups_cmd/test_group_cmd.py
  • tests/e2e/cli/user_groups_cmd/test_user_cmd.py
  • tests/e2e/containers/container_entities_batching_test.py
  • tests/e2e/containers/containers_test.py
  • tests/e2e/database/test_database.py
  • tests/e2e/datapack/test_datapack_smoke.py::TestDatapackCLI
  • tests/e2e/dataproduct/test_dataproduct.py
  • tests/e2e/delete/delete_test.py
  • tests/e2e/deprecation/deprecation_test.py
  • tests/e2e/domains/domains_test.py
  • tests/e2e/entity_graph_cache/test_entity_graph_cache.py::TestContainer
  • tests/e2e/entity_graph_cache/test_entity_graph_cache.py::TestDomain
  • tests/e2e/entity_graph_cache/test_entity_graph_cache.py::TestGlossary
  • tests/e2e/entity_versioning/test_effective_latest_versioning.py::TestEffectiveLatestVersioning
  • tests/e2e/entity_versioning/test_glossary_term_new_version.py
  • tests/e2e/entity_versioning/test_glossary_versioning.py
  • tests/e2e/forms/forms_test.py
  • tests/e2e/frontend/test_static_asset_encodings.py
  • tests/e2e/graph/test_graph_client.py
  • tests/e2e/incidents/health_batch_test.py
  • tests/e2e/incidents/incidents_test.py
  • tests/e2e/institutional_memory/institutional_memory_test.py
  • tests/e2e/knowledge/document_change_history_test.py
  • tests/e2e/knowledge/document_search_filter_test.py
  • tests/e2e/knowledge/test_document_crud.py::TestDocumentCrudAndMutations
  • tests/e2e/library_examples/test_library_examples.py
  • tests/e2e/lineage/test_lineage.py
  • tests/e2e/managed_ingestion/managed_ingestion_test.py
  • tests/e2e/mcp/mcp_test.py
  • tests/e2e/object_storage/test_object_storage.py
  • tests/e2e/openapi/test_openapi.py
  • tests/e2e/openapi/v1/test_tracking.py
  • tests/e2e/openapi/v2/test_timeseries_scroll.py
  • tests/e2e/openapi/v3/test_scroll_entities.py
  • tests/e2e/openapi/v3/test_scroll_lineage.py
  • tests/e2e/openapi/v3/test_scroll_relationships.py
  • tests/e2e/patch/test_datajob_patches.py
  • tests/e2e/patch/test_dataset_patches.py
  • tests/e2e/patch/test_domain_patches.py
  • tests/e2e/policies/test_policies.py
  • tests/e2e/privileges/test_privileges.py
  • tests/e2e/read_only/test_ingestion_list.py
  • tests/e2e/read_only/test_policies.py
  • tests/e2e/read_only/test_search.py
  • tests/e2e/read_only/test_services_up.py
  • tests/e2e/restli/test_restli_batch_ingestion.py
  • tests/e2e/search/test_search_projection.py::TestSearchProjection
  • tests/e2e/semantic/test_current_offset_api.py
  • tests/e2e/service_accounts/test_service_accounts.py
  • tests/e2e/status/test_glossary_lifecycle_stages.py::TestGlossaryTermLifecycleStages
  • tests/e2e/status/test_lifecycle_state.py::TestLifecycleStageAPIs
  • tests/e2e/structured_properties/test_structured_properties.py
  • tests/e2e/tags_and_terms/tags_and_terms_test.py
  • tests/e2e/test_authentication_e2e.py
  • tests/e2e/test_e2e.py
  • tests/e2e/test_kafka_default_sink.py
  • tests/e2e/test_stateful_ingestion.py
  • tests/e2e/test_system_info.py
  • tests/e2e/timeline/timeline_change_history_test.py::TestDatasetTimeline
  • tests/e2e/timeline/timeline_change_history_test.py::TestGlossaryTermTimeline
  • tests/e2e/timeline/timeline_test.py
  • tests/e2e/timeseries/test_dataset_profiles_graphql.py
  • tests/e2e/timeseries/test_stats_summary_graphql.py
  • tests/e2e/tokens/revokable_access_token_test.py
  • tests/e2e/tokens/session_access_token_test.py
  • tests/e2e/trace/test_api_trace.py
  • tests/e2e/views/views_test.py

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

commit 66f9777 · workflow run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6c43062. Configure here.

Comment thread smoke-test/tests/e2e/mcp/mcp_test.py Resolved
Smoke tests for datahub-ai-service behind the frontend, in whichever GMS
auth mode the stack runs (read from GMS /config):

- Legacy (initialize first) and modern stateless clients list tools and
  call get_me, acting as the admin with a PAT when auth is on and as the
  system user when it is off.
- Auth on: no token or a garbage one gets 401 with WWW-Authenticate.
- Auth off: no token is needed, and a request with a foreign Host and
  Origin (DNS rebinding) gets 403.

A small requests-based JSON-RPC client handles both protocol families and
JSON or SSE responses, so the suite needs no new dependency.

Ran locally against a datahub-dev OSS instance with GMS auth off and on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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

smoke_test Contains changes related to smoke tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants