- Notifications
You must be signed in to change notification settings - Fork1k
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
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
I think we can publish the images on github instead of dockerhub. |
I have updated it to publish the images on GitHub. |
There was a problem hiding this 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.
File | Description |
---|---|
mcp-run-python/test_mcp_client.py | Adds a simple client script to verify server SSE endpoint behavior |
mcp-run-python/deno.json | UpdatesnodeModulesDir configuration value |
mcp-run-python/Dockerfile | New Dockerfile for building and running the server container |
.github/workflows/docker-publish.yml | Workflow 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 using
docker/login-action
and theDOCKERHUB_USERNAME
andDOCKERHUB_TOKEN
secrets.
- name: Login to GitHub Container Registry
.github/workflows/docker-publish.yml:30
- The tag
yourdockerhubuser/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., using
assert 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"] |
There was a problem hiding this comment.
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.
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 . . |
There was a problem hiding this comment.
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.
Summary
This adds Docker support for the MCP Run Python server and sets up automated Docker image publishing via GitHub Actions.
Changes
Dockerfile:
GitHub Actions Workflow:
Test Client:
How to test
You should see: