Repository navigation
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
Open
Vishal Habib (vishalhabib99) wants to merge 2 commits into
Vishal Habib (vishalhabib99) wants to merge 2 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 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
FastMCPimport and constructor withMCPServer. - 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).
Author
|
Good catch from the Copilot review: |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Describe your changes
Since #2750 (Oct 26),
mcp/uv.lockpins mcp 2.3.0. mcp 2.x removedmcp.server.fastmcp, so the install inmcp/README.md(uv sync, thenuv run ... python -m olive_mcp) now fails on import:This PR moves
server.pyto the 2.x name:from mcp.server.mcpserver import MCPServerandMCPServer(name=..., instructions=...).@mcp.tool(),@mcp.prompt(name=..., description=...)andmcp.run()keep the same API, sotools.pyand__init__.pyare unchanged.mcp/pyproject.tomlnow requiresmcp[cli]>=2.0(MCPServerdoes not exist in 1.x, so an environment that already had mcp 1.x would keep it and fail at import).uv.lockchanges only its matchingrequires-distline; locked versions from #2750 are unchanged anduv lock --checkpasses.Checked (mcp 2.3.0, the locked version)
server.pyimporttools/listlist[dict]ModuleNotFoundErrorChecked with a standalone server built the same way as
server.py(same constructor arguments, a tool and an@mcp.prompt(name=, description=)returninglist[dict]), driven through the mcp 2.3.0 in-memoryClient.Checklist before requesting a review
mcp/package has no tests directory.)lintrunner -auv sync(mcp 2.x).