Skip to content

feat(mcp): allow skipping MCP host-tool registration in non-MCP processes - #43840

Closed
eschutho wants to merge 1 commit into
apache:masterfrom
eschutho:fix/gate-mcp-host-tools-off-workers
Closed

feat(mcp): allow skipping MCP host-tool registration in non-MCP processes#43840
eschutho wants to merge 1 commit into
apache:masterfrom
eschutho:fix/gate-mcp-host-tools-off-workers

Conversation

@eschutho

@eschutho eschutho commented Sep 4, 2026

Copy link
Copy Markdown
Member

SUMMARY

SupersetAppInitializer.init_core_dependencies() calls initialize_core_mcp_dependencies() in every process that builds the app — including Celery workers, which never serve MCP. That function imports the MCP service app to register all host tools, which carries a real per-process memory cost. In high-concurrency prefork worker pools, that can OOM the pool on boot.

This adds a CORE_MCP_HOST_TOOLS_ENABLED config flag (default True, so no behavior change) and gates the call on it, so a deployment can disable host-tool registration in processes that don't serve MCP (e.g. Celery workers). This follows the "make MCP optional at startup" direction of #38534.

TESTING INSTRUCTIONS

Set CORE_MCP_HOST_TOOLS_ENABLED = False in superset_config.py; confirm the app starts and the MCP service app imported - host tools registered log no longer appears. With the default (True), behavior is unchanged and MCP-serving processes work as before.

ADDITIONAL INFORMATION

  • Has associated issue
  • Required feature flags: n/a (plain config default, True)
  • Changes UI
  • Includes DB Migration
  • Introduces new feature or API — a new config option

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

@bito-code-review

bito-code-review Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #bf55fb

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: abe11b3..abe11b3
    • superset/config.py
    • superset/initialization/__init__.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - Manually triggers a full AI Review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@netlify

netlify Bot commented Sep 4, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit abe11b3
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a9a0da50d320d0008aeadc4
😎 Deploy Preview https://deploy-preview-43840--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread superset/config.py Outdated
# - deprecated: Will be removed in a future major release

DEFAULT_FEATURE_FLAGS: dict[str, bool] = {
DEFAULT_# Whether this process registers the MCP host tools at startup. Only processes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: The bare DEFAULT_ expression is evaluated while importing the default configuration, raising NameError and preventing every Superset process from starting. [import error]

Assessment: 🔴 Critical · 🔁 Occurrence: Often

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset/config.py
**Line:** 542:542
**Comment:**
	*Import Error: The bare `DEFAULT_` expression is evaluated while importing the default configuration, raising `NameError` and preventing every Superset process from starting.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

# (the web app and the standalone MCP service). Deployments can disable
# this in processes that never serve MCP -- e.g. Celery workers -- to
# avoid importing the MCP stack where it is unused.
if self.config.get("CORE_MCP_HOST_TOOLS_ENABLED", True):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: When this flag is false, MCP decorators remain abstract and raise NotImplementedError, so extensions defining MCP tools or prompts fail during eager import and are skipped. [incomplete implementation]

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset/initialization/__init__.py
**Line:** 565:565
**Comment:**
	*Incomplete Implementation: When this flag is false, MCP decorators remain abstract and raise `NotImplementedError`, so extensions defining MCP tools or prompts fail during eager import and are skipped.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

…sses

init_core_dependencies() calls initialize_core_mcp_dependencies() in every process
that builds the app, including Celery workers that never serve MCP. Importing the MCP
service app to register host tools has a real per-process memory cost that can OOM
high-concurrency prefork worker pools on boot.

Add a CORE_MCP_HOST_TOOLS_ENABLED config flag (default True, no behavior change) and
gate the call on it, so deployments can turn host-tool registration off for processes
that do not serve MCP. Follows the make-MCP-optional-at-startup direction of apache#38534.

Signed-off-by: Elizabeth Thompson <elizabeth@preset.io>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@eschutho eschutho closed this Sep 4, 2026
@eschutho
eschutho force-pushed the fix/gate-mcp-host-tools-off-workers branch from abe11b3 to 40f04c3 Compare September 4, 2026 00:21
@github-actions github-actions Bot added doc Namespace | Anything related to documentation embedded plugins dependencies:npm github_actions Pull requests that update GitHub Actions code packages dependencies:python risk:ci-script PR modifies scripts that execute in CI (supply chain risk) labels Sep 4, 2026
@eschutho
eschutho deleted the fix/gate-mcp-host-tools-off-workers branch September 4, 2026 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies:npm dependencies:python doc Namespace | Anything related to documentation embedded github_actions Pull requests that update GitHub Actions code packages plugins risk:ci-script PR modifies scripts that execute in CI (supply chain risk) size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant