Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Dockerise the MCP Run Python server (#1837)#2090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
rohit133 wants to merge2 commits intopydantic:main
base:main
Choose a base branch
Loading
fromrohit133:dockerize-mcp-run-python

Conversation

rohit133
Copy link

Summary

This adds Docker support for the MCP Run Python server and sets up automated Docker image publishing via GitHub Actions.

Changes

Dockerfile:
  • Adds a Dockerfile to run the MCP Run Python server using the official Deno image.
  • Default command runs the server in SSE mode on port 3101, suitable for MCP client integration.

GitHub Actions Workflow:

  • Adds docker-publish.yml to build and publish the Docker image to Docker Hub (or another registry) on push to main.
  • Requires DOCKERHUB_USERNAME and DOCKERHUB_TOKEN secrets to be set in the repository.

Test Client:

  • Adds test_mcp_client.py to verify the server is running and can execute Python code via the MCP protocol.

How to test

  1. Build and run the Docker image:
docker build -t mcp-run-python ./mcp-run-pythondocker run -d -p 3101:3101 mcp-run-python
  1. Run the test client:
python3 mcp-run-python/test_mcp_client.py

You should see:

<status>success</status><output>   hello world</output>

@rohit133rohit133 changed the titleDockerise the MCP Run Python server (#1837)Dockerise the MCP Run Python server (#1837)[https://github.com/pydantic/pydantic-ai/issues/1837]Jun 27, 2025
@rohit133rohit133 changed the titleDockerise the MCP Run Python server (#1837)[https://github.com/pydantic/pydantic-ai/issues/1837]Dockerise the MCP Run Python server (#1837)Jun 27, 2025
@Kludex
Copy link
Member

I think we can publish the images on github instead of dockerhub.

@rohit133
Copy link
Author

I think we can publish the images on github instead of dockerhub.

I have updated it to publish the images on GitHub.

Copy link

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

Adds Docker support and CI workflow for the MCP Run Python server and introduces an integration test client.

  • Introduces a Dockerfile to containerize the MCP Run Python server using the official Deno image.
  • Adds a GitHub Actions workflow to build and publish the Docker image on push to main.
  • Adds an integration test client (test_mcp_client.py) to verify the server functionality.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

FileDescription
mcp-run-python/test_mcp_client.pyAdds a simple client script to verify server SSE endpoint behavior
mcp-run-python/deno.jsonUpdatesnodeModulesDir configuration value
mcp-run-python/DockerfileNew Dockerfile for building and running the server container
.github/workflows/docker-publish.ymlWorkflow to build and push the Docker image
Comments suppressed due to low confidence (3)

.github/workflows/docker-publish.yml:19

  • The workflow logs in to GitHub Container Registry but tags the image for Docker Hub. Replace this step with a Docker Hub login usingdocker/login-action and theDOCKERHUB_USERNAME andDOCKERHUB_TOKEN secrets.
      - name: Login to GitHub Container Registry

.github/workflows/docker-publish.yml:30

  • The tagyourdockerhubuser/mcp-run-python:latest is a placeholder. Update this to use your actual Docker Hub namespace or use a matrix/secret to avoid manual edits.
          tags: yourdockerhubuser/mcp-run-python:latest

mcp-run-python/test_mcp_client.py:14

  • The test client only prints the output instead of asserting the expected values. Consider adding assertions (e.g., usingassert content.text == 'hello world') so failures are detected automatically.
                print(content.text)

EXPOSE 3101

# Default command: run MCP Run Python server in SSE mode with health check endpoint
CMD ["run", "-N", "-R=node_modules", "-W=node_modules", "--node-modules-dir=auto", "jsr:@pydantic/mcp-run-python", "sse", "--port=3101"]
Copy link
Preview

CopilotAIJul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The Deno server needs explicit network permissions to serve requests. Add--allow-net=0.0.0.0:3101 (or--allow-net) to the run command so the container can accept incoming connections.

Suggested change
CMD ["run", "-N", "-R=node_modules", "-W=node_modules", "--node-modules-dir=auto", "jsr:@pydantic/mcp-run-python", "sse", "--port=3101"]
CMD ["run", "--allow-net=0.0.0.0:3101", "-N", "-R=node_modules", "-W=node_modules", "--node-modules-dir=auto", "jsr:@pydantic/mcp-run-python", "sse", "--port=3101"]

Copilot uses AI. Check for mistakes.

WORKDIR /app

# Copy all files into the container
COPY . .
Copy link
Preview

CopilotAIJul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

[nitpick] Copying the entire context can bloat the image. Consider adding a.dockerignore to exclude unnecessary files (e.g., tests, local configs) and reduce build time and image size.

Copilot uses AI. Check for mistakes.

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

Copilot code reviewCopilotCopilot left review comments

Assignees

@KludexKludex

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@rohit133@Kludex

[8]ページ先頭

©2009-2025 Movatter.jp