Skip to content

fix(run/mcp-server): pin uv image, update to Python 3.14 & fastmcp 4.2.6, cast PORT to int - #15000

Open
wietsevenema wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
wietsevenema:fix/run-mcp-server-deps
Open

wietsevenema wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
wietsevenema:fix/run-mcp-server-deps

Conversation

@wietsevenema

Copy link
Copy Markdown

Description

Updates the Cloud Run remote MCP server sample (run/mcp-server/) to keep its dependencies current, pinned, and aligned with the Dockerfile and tutorial:

  • Pin uv in Dockerfile: Replace ghcr.io/astral-sh/uv:latest with ghcr.io/astral-sh/uv:0.13.10.
  • Update Python requirement to >=3.14: Align pyproject.toml and README.md with FROM python:3.14-slim (moving off EOL Python 3.10).
  • Bump fastmcp to 4.2.6: Update fastmcp (and its required opentelemetry-*==1.45.2 dependency) in pyproject.toml and regenerate uv.lock.
  • Cast PORT to int in server.py: Pass port=int(os.getenv("PORT", 8080)) so uvicorn logs cleanly on startup without a %d format TypeError.

Testing

  • Deployed run/mcp-server/ from source to Cloud Run (--no-allow-unauthenticated).
  • Verified clean container build (python:3.14-slim, uv:0.13.10, fastmcp==4.2.6) and startup logs (Uvicorn running on http://0.0.0.0:8080, no logging errors).
  • Verified live add and subtract tool calls via gcloud run services proxy and uv run test_server.py.

@wietsevenema
wietsevenema requested review from a team as code owners November 27, 2026 12:39
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@product-auto-label product-auto-label Bot added api: run Issues related to the Cloud Run API. samples Issues that are directly related to samples. labels Nov 27, 2026
@wietsevenema
wietsevenema force-pushed the fix/run-mcp-server-deps branch from e5ceac0 to 3565169 Compare November 27, 2026 15:22
@wietsevenema
wietsevenema requested a review from iennae November 28, 2026 10:08
@wietsevenema

Copy link
Copy Markdown
Author

Hi @iennae, could you please take a look at this PR when you have a moment? It pins the uv image, updates the sample to Python 3.14 and fastmcp==4.2.6 to match the tutorial, and casts PORT to int to fix uvicorn's startup logging error. Thanks!

…2.6, cast PORT to int

- Pin uv in Dockerfile to ghcr.io/astral-sh/uv:0.13.10 instead of :latest.
- Update pyproject.toml and README.md from EOL Python 3.10 to >=3.14 (matching FROM python:3.14-slim).
- Bump fastmcp to 4.2.6 (and required opentelemetry-* to 1.45.2) and regenerate uv.lock.
- Cast PORT to int in server.py (int(os.getenv('PORT', 8080))) to fix uvicorn's %d startup logging TypeError.
@wietsevenema
wietsevenema force-pushed the fix/run-mcp-server-deps branch from 3565169 to 3c736f3 Compare December 2, 2026 09:04
@iennae

iennae commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

can you fix the linting?

@wietsevenema

Copy link
Copy Markdown
Author

Done in e01795a! Formatted run/mcp-server/server.py with black and added # flake8: noqa (with an explanatory comment) above the region tags so E402/I100/I201 don't fail while keeping both embedded doc snippets free of inline # noqa comments. Verified locally with black --check and flake8.

@snippet-bot

snippet-bot Bot commented Dec 2, 2026

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

Comment thread run/mcp-server/server.py
# limitations under the License.

# Ignore flake8 for this file because setup_opentelemetry() must run above the
# nested [START cloudrun_mcpserver] region tag (causing E402/I100/I201 on the

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.

I suspect the snippet-bot check is failing because this particular comment houses the region tag's initialization. [START cloudrun_mcpserver]

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.

yes; and it's going to actually cause a problem because region tags are comments. @wietsevenema you need to remove the region tag from this spot.

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

Labels

api: run Issues related to the Cloud Run API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants