Skip to content

tools/mcp: pin mcp<2 to fix unit CI collection - #2026

Merged
Fridah-nv merged 1 commit into
mainfrom
fridah/fix-mcp-ci-pin
Jul 29, 2026
Merged

tools/mcp: pin mcp<2 to fix unit CI collection#2026
Fridah-nv merged 1 commit into
mainfrom
fridah/fix-mcp-ci-pin

Conversation

@Fridah-nv

@Fridah-nv Fridah-nv commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Type of change: Bug fix (CI)

mcp==2.0.0 was released and removed the mcp.server.fastmcp module (the 2.0 SDK replaces it with mcp.server.mcpserver). tools/mcp/pyproject.toml declared an unpinned mcp>=1.0, so CI now resolves mcp==2.0.0, and tools/mcp/modelopt_mcp/server.py's from mcp.server.fastmcp import FastMCP fails at import:

ModuleNotFoundError: No module named 'mcp.server.fastmcp'
ERROR collecting tools/mcp/tests/test_bridge.py

This breaks the mcp unit job — and thus the unit-pr-required-check gate — on every PR whose diff touches pyproject.toml, noxfile.py, or .github/workflows/unit_tests.yml (the changed-files paths that trigger the mcp job).

This PR pins mcp>=1.0,<2, keeping the 1.x line that still ships mcp.server.fastmcp. Migrating the server to the mcp 2.0 API (mcp.server.mcpserver) is a larger change tracked separately.

Usage

# N/A - dependency pin only

Testing

  • uv pip install -e tools/mcp now resolves an mcp 1.x wheel, so from mcp.server.fastmcp import FastMCP imports and tools/mcp/tests/test_bridge.py collects again.

Before your PR is "Ready for review"

  • Is this change backward compatible?: ✅
  • If you copied code from any other sources or added a new PIP dependency, did you follow guidance in CONTRIBUTING.md: N/A — tightens an existing dependency's upper bound.
  • Did you write any new necessary tests?: N/A — restores collection of the existing tools/mcp tests.
  • Did you update Changelog?: N/A — CI/build fix, nothing user-facing in the wheel.
  • Did you get Claude approval on this PR?: ❌

Additional Information

Unblocks the unit-pr-required-check gate for in-flight PRs (surfaced on #2000). Follow-up: migrate modelopt_mcp/server.py to the mcp 2.0 API and relax the pin.

Summary by CodeRabbit

  • Bug Fixes
    • Prevented compatibility issues by limiting the MCP package to supported version 1.x releases.

mcp 2.0.0 dropped the mcp.server.fastmcp module, so the unpinned
`mcp>=1.0` now resolves to 2.0.0 and modelopt_mcp/server.py's
`from mcp.server.fastmcp import FastMCP` fails at import, breaking the
`mcp` unit job (and the unit-pr-required-check gate) on every PR that
touches pyproject.toml or the workflow. Pin to the 1.x line that still
ships fastmcp; migrating to the mcp 2.0 API is a separate change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Fridah-nv <201670829+Fridah-nv@users.noreply.github.com>
@Fridah-nv
Fridah-nv requested a review from a team as a code owner July 28, 2026 20:42
@Fridah-nv
Fridah-nv requested a review from kevalmorabia97 July 28, 2026 20:42
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

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: b7552311-43c0-49ae-80f8-6eb1562268e6

📥 Commits

Reviewing files that changed from the base of the PR and between 87c9f8c and 027d916.

📒 Files selected for processing (1)
  • tools/mcp/pyproject.toml

📝 Walkthrough

Walkthrough

The MCP dependency constraint changes from mcp>=1.0 to mcp>=1.0,<2, with a comment documenting the mcp.server.fastmcp compatibility issue.

Changes

MCP compatibility

Layer / File(s) Summary
Constrain MCP dependency
tools/mcp/pyproject.toml
Limits MCP to versions below 2.0 and documents the removed mcp.server.fastmcp module.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested reviewers: kevalmorabia97, chenhanyu

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: pinning mcp below 2 to restore CI/test collection.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Anti-Patterns ✅ Passed PR only tightens mcp version in tools/mcp/pyproject.toml; no modelopt/examples Python changes or new insecure patterns were added.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fridah/fix-mcp-ci-pin

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

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.83%. Comparing base (33d05b0) to head (027d916).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2026   +/-   ##
=======================================
  Coverage   66.83%   66.83%           
=======================================
  Files         519      519           
  Lines       58916    58916           
=======================================
  Hits        39376    39376           
  Misses      19540    19540           
Flag Coverage Δ
unit 54.89% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Fridah-nv
Fridah-nv merged commit a3ac475 into main Jul 29, 2026
46 checks passed
@Fridah-nv
Fridah-nv deleted the fridah/fix-mcp-ci-pin branch July 29, 2026 04:34
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-29 04:34 UTC

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants