Skip to content

fix: support function workflows in mcp front ends#1993

Open
kiwigitops wants to merge 1 commit into
NVIDIA:developfrom
kiwigitops:fix-mcp-function-workflow-alias
Open

fix: support function workflows in mcp front ends#1993
kiwigitops wants to merge 1 commit into
NVIDIA:developfrom
kiwigitops:fix-mcp-function-workflow-alias

Conversation

@kiwigitops

@kiwigitops kiwigitops commented May 28, 2026

Copy link
Copy Markdown

Summary

  • avoid reading workflow_alias directly on function-style workflow configs
  • fall back to the workflow type for MCP and FastMCP when a workflow config does not define an alias
  • add regressions for function-style workflow configs such as langgraph_wrapper

Fixes #1991.

Testing

  • ruff check packages/nvidia_nat_mcp/src/nat/plugins/mcp/server/front_end_plugin_worker.py packages/nvidia_nat_fastmcp/src/nat/plugins/fastmcp/server/front_end_plugin_worker.py packages/nvidia_nat_mcp/tests/server/test_mcp_front_end_plugin.py packages/nvidia_nat_fastmcp/tests/test_fastmcp.py
  • yapf --diff --style ./pyproject.toml packages/nvidia_nat_mcp/src/nat/plugins/mcp/server/front_end_plugin_worker.py packages/nvidia_nat_fastmcp/src/nat/plugins/fastmcp/server/front_end_plugin_worker.py packages/nvidia_nat_mcp/tests/server/test_mcp_front_end_plugin.py packages/nvidia_nat_fastmcp/tests/test_fastmcp.py
  • python -m compileall -q packages/nvidia_nat_mcp/src/nat/plugins/mcp/server/front_end_plugin_worker.py packages/nvidia_nat_fastmcp/src/nat/plugins/fastmcp/server/front_end_plugin_worker.py packages/nvidia_nat_mcp/tests/server/test_mcp_front_end_plugin.py packages/nvidia_nat_fastmcp/tests/test_fastmcp.py
  • git diff --check

Summary by CodeRabbit

  • Bug Fixes
    • Fixed workflow discovery/registration to use workflow_alias when provided, and fall back to the workflow type when no alias is set.
  • Tests
    • Added coverage to confirm both FastMCP and MCP front-end plugin workers return the workflow mapping keyed by type when aliases are absent.

@kiwigitops kiwigitops requested a review from a team as a code owner May 28, 2026 02:01
@copy-pr-bot

copy-pr-bot Bot commented May 28, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e0999f3c-f177-40a5-a102-d9abd83d1d20

📥 Commits

Reviewing files that changed from the base of the PR and between 95c38c6 and c969924.

📒 Files selected for processing (1)
  • packages/nvidia_nat_fastmcp/src/nat/plugins/fastmcp/server/front_end_plugin_worker.py
💤 Files with no reviewable changes (1)
  • packages/nvidia_nat_fastmcp/src/nat/plugins/fastmcp/server/front_end_plugin_worker.py

Walkthrough

Both FastMCP and MCP worker implementations now safely handle workflow configurations that lack a workflow_alias attribute. The fix replaces unsafe nested attribute access with getattr() for safe fallback and registers workflows under either their alias (if present) or their type. Corresponding tests verify the fallback behavior when no alias is defined.

Changes

Workflow Alias Fallback Registration

Layer / File(s) Summary
FastMCP workflow registration refactor
packages/nvidia_nat_fastmcp/src/nat/plugins/fastmcp/server/front_end_plugin_worker.py, packages/nvidia_nat_fastmcp/tests/test_fastmcp.py
_get_all_functions() now uses getattr(workflow_config, "workflow_alias", None) to safely access the alias attribute, conditionally registering the workflow under the alias key or falling back to workflow_config.type. New test test_fastmcp_function_workflow_config_without_alias_uses_type() verifies the fallback behavior.
MCP workflow registration refactor
packages/nvidia_nat_mcp/src/nat/plugins/mcp/server/front_end_plugin_worker.py, packages/nvidia_nat_mcp/tests/server/test_mcp_front_end_plugin.py
_get_all_functions() now uses getattr(workflow_config, "workflow_alias", None) to safely access the alias attribute, conditionally registering the workflow under the alias key or falling back to workflow_config.type. New test test_function_workflow_config_without_alias_uses_type() verifies the fallback behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title is concise, descriptive, uses imperative mood, and clearly summarizes the main change to support function workflows in MCP front ends.
Linked Issues check ✅ Passed The PR successfully addresses issue #1991 by implementing safe access to workflow_alias via getattr with fallback to workflow type, adding regression tests, and resolving the AttributeError for function-style workflow configs.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the function workflow alias handling in both MCP and FastMCP front end workers with corresponding regression tests.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@kiwigitops kiwigitops force-pushed the fix-mcp-function-workflow-alias branch from 88cd5dd to 95c38c6 Compare May 28, 2026 16:38
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

Actionable comments posted: 0

@kiwigitops

Copy link
Copy Markdown
Author

Could a maintainer add the appropriate label for this bug fix? The only failing status is Label Checker, and I do not have permission to label the PR from the fork.

Signed-off-by: kiwigitops <kiwisclubco@gmail.com>
@kiwigitops kiwigitops force-pushed the fix-mcp-function-workflow-alias branch from 95c38c6 to c969924 Compare June 18, 2026 11:36
@kiwigitops

Copy link
Copy Markdown
Author

Quick follow-up on this. Label Checker is still the only failing status I can see, and I still cannot add the label from the fork. Could a maintainer add the right bug/fix label when they have a chance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nat start mcp crashes when the workflow type is langgraph_wrapper

1 participant