Skip to content

Olive MCP server: use MCPServer so it starts with the locked mcp 2.3.0 - #2781

Open
Vishal Habib (vishalhabib99) wants to merge 2 commits into
microsoft:mainfrom
vishalhabib99:fix/mcp-server-mcp2
Open

Vishal Habib (vishalhabib99) wants to merge 2 commits into
microsoft:mainfrom
vishalhabib99:fix/mcp-server-mcp2

Conversation

@vishalhabib99

@vishalhabib99 Vishal Habib (vishalhabib99) commented Nov 2, 2026 •

Copy link
Copy Markdown

Describe your changes

Since #2750 (Oct 26), mcp/uv.lock pins mcp 2.3.0. mcp 2.x removed mcp.server.fastmcp, so the install in mcp/README.md (uv sync, then uv run ... python -m olive_mcp) now fails on import:

ModuleNotFoundError: No module named 'mcp.server.fastmcp'. This is mcp 2.x, where FastMCP was renamed to MCPServer (from mcp.server.mcpserver import MCPServer) ...

This PR moves server.py to the 2.x name: from mcp.server.mcpserver import MCPServer and MCPServer(name=..., instructions=...). @mcp.tool(), @mcp.prompt(name=..., description=...) and mcp.run() keep the same API, so tools.py and __init__.py are unchanged. mcp/pyproject.toml now requires mcp[cli]>=2.0 (MCPServer does not exist in 1.x, so an environment that already had mcp 1.x would keep it and fail at import). uv.lock changes only its matching requires-dist line; locked versions from #2750 are unchanged and uv lock --check passes.

Checked (mcp 2.3.0, the locked version)

server.py import tools/list prompt returning list[dict] tool call
main ModuleNotFoundError - - -
this branch OK OK OK OK

Checked with a standalone server built the same way as server.py (same constructor arguments, a tool and an @mcp.prompt(name=, description=) returning list[dict]), driven through the mcp 2.3.0 in-memory Client.

Checklist before requesting a review

  • Add unit tests for this change. (The mcp/ package has no tests directory.)
  • Make sure all tests can pass.
  • Update documents if necessary. (No doc change needed.)
  • Lint and apply fixes to your code by running lintrunner -a
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes. Olive MCP server starts again after uv sync (mcp 2.x).

Copilot AI balanced review requested due to automatic review settings November 2, 2026 15:09
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

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.

🟡 Changes recommended

The new import requires MCP 2.x, but the unconstrained dependency can retain MCP 1.x and cause server startup to fail with ModuleNotFoundError.

1 open issue
What changed in this PR

Updates Olive’s MCP server to use the MCP 2.x API, addressing the startup import failure introduced by the MCP 2.3.0 lockfile update in #2750.

Changes:

  • Replaces the FastMCP import and constructor with MCPServer.
  • Leaves tool registration, prompts, the entry point, and the lockfile unchanged.
File Description
mcp/​src/​olive_mcp/​server.py Uses MCPServer to initialize the server with the MCP 2.x API.

Review effort: Balanced

# Licensed under the MIT License.
# --------------------------------------------------------------------------
from mcp.server.fastmcp import FastMCP
from mcp.server.mcpserver import MCPServer
MCPServer (mcp.server.mcpserver) only exists in mcp 2.x; an environment that
already has mcp 1.x would otherwise keep it and fail at import. uv.lock changes
only its requires-dist line (locked mcp is already 2.3.0).
@vishalhabib99

Copy link
Copy Markdown
Author

Good catch from the Copilot review: mcp/pyproject.toml now requires mcp[cli]>=2.0 (173bf5a), since mcp.server.mcpserver only exists in 2.x (checked: imports on 2.0.0, ModuleNotFoundError on 1.30.0). uv.lock changes only its requires-dist line, and uv lock --check passes. I updated the description to match.

This branch has not been deployed

No deployments
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.

2 participants