Skip to content

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish Docker image

on:
push:
branches: [main]
paths:
- 'mcp-run-python/**'
- '.github/workflows/docker-publish.yml'

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./mcp-run-python
push: true
tags: yourdockerhubuser/mcp-run-python:latest
14 changes: 14 additions & 0 deletions mcp-run-python/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Use official Deno image as base
FROM denoland/deno:alpine-2.3.7

# Set working directory
WORKDIR /app

# Copy all files into the container
COPY . .

# Expose port for SSE mode (optional, only needed for SSE)
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"]
5 changes: 2 additions & 3 deletions mcp-run-python/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@pydantic/mcp-run-python",
"version": "0.0.15",
"license": "MIT",
"nodeModulesDir": "auto",
"nodeModulesDir": true,
"exports": {
".": "./src/main.ts"
},
Expand All @@ -16,7 +16,6 @@
"@modelcontextprotocol/sdk": "npm:@modelcontextprotocol/sdk@^1.8.0",
"@std/cli": "jsr:@std/cli@^1.0.15",
"@std/path": "jsr:@std/path@^1.0.8",
// do NOT upgrade above this version until there is a workaround for https://github.com/pyodide/pyodide/pull/5621
"pyodide": "npm:pyodide@0.27.6",
"zod": "npm:zod@^3.24.2"
},
Expand All @@ -29,7 +28,7 @@
"publish": {
"include": [
"src/*.ts",
"src/prepareEnvCode.ts", // required to override gitignore
"src/prepareEnvCode.ts",
"README.md",
"deno.json"
]
Expand Down
Loading