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
Copy link
Copy Markdown

@kiwigitops kiwigitops commented May 28, 2026

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
    • Improved workflow registration so workflows without explicit aliases are correctly identified using their type as a fallback.
  • Tests
    • Added tests to verify correct behavior for workflows lacking aliases across both FastMCP and MCP plugin implementations.

Review Change Stack

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

copy-pr-bot Bot commented May 28, 2026

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
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

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: a1eef481-a28c-4924-aba7-02b8ef713ee4

📥 Commits

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

📒 Files selected for processing (4)
  • packages/nvidia_nat_fastmcp/src/nat/plugins/fastmcp/server/front_end_plugin_worker.py
  • packages/nvidia_nat_fastmcp/tests/test_fastmcp.py
  • 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
🚧 Files skipped from review as they are similar to previous changes (4)
  • 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

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 title clearly summarizes the main change: adding support for function workflows in MCP front ends, and directly addresses the bug being fixed.
Linked Issues check ✅ Passed The PR successfully addresses issue #1991 by implementing fallback to workflow type when workflow_alias is absent in function-style configs, with appropriate test coverage added.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the workflow alias handling in MCP and FastMCP front ends, with corresponding tests for the specific langgraph_wrapper case.

✏️ 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.

Signed-off-by: kiwigitops <kiwisclubco@gmail.com>
@kiwigitops kiwigitops force-pushed the fix-mcp-function-workflow-alias branch from 88cd5dd to 95c38c6 Compare May 28, 2026 16:38
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

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.

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