Skip to content
Merged
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
650 changes: 650 additions & 0 deletions .nexus/guides/python-mcp-servers-implementation.md

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Stage with CPython 3.13 runtime artifacts
FROM python:3.13-slim-bookworm AS python313

# Use an official Node.js runtime as the base image
FROM node:20

Expand Down Expand Up @@ -41,11 +44,29 @@ RUN apt-get update \
libxrender1 \
libxss1 \
libxtst6 \
libbz2-1.0 \
libffi8 \
liblzma5 \
libreadline8 \
libsqlite3-0 \
libssl3 \
zlib1g \
lsb-release \
wget \
xdg-utils \
&& rm -rf /var/lib/apt/lists/*

# Copy Python 3.13 runtime from python image
COPY --from=python313 /usr/local/bin/python3.13 /usr/local/bin/python3.13
COPY --from=python313 /usr/local/lib/python3.13 /usr/local/lib/python3.13
COPY --from=python313 /usr/local/lib/libpython3.13.so* /usr/local/lib/
RUN ln -sf /usr/local/bin/python3.13 /usr/local/bin/python3 \
&& ln -sf /usr/local/bin/python3.13 /usr/local/bin/python \
&& python3.13 -V

# Default Python used by PackageService for python runtime MCP servers
ENV PYTHON_BIN=/usr/local/bin/python3.13

# Set Puppeteer to use installed Chromium
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium

Expand Down
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ The system uses AES-256-GCM encryption for all stored secrets, with a separate e
MONGO_DBNAME=mcp
SECRETS_KEY=your-random-key
SECRETS_DBNAME=secrets
PYTHON_BIN=/usr/bin/python3
PYTHON_VENV_DIR=packages/python
PIP_INDEX_URL=
PIP_EXTRA_INDEX_URL=
```

5. Build the project:
Expand All @@ -99,6 +103,7 @@ The system uses AES-256-GCM encryption for all stored secrets, with a separate e
```bash
docker-compose up -d
```
3. The container image includes Python 3.13 and sets `PYTHON_BIN=/usr/local/bin/python3.13` by default for Python MCP package installs.

### Building the Docker Image

Expand All @@ -107,6 +112,8 @@ docker build -t mcp-api .
docker run -p 8080:8080 --env-file .env mcp-api
```

For Python MCP servers that require Python 3.13+ (for example `klaviyo-mcp-server`), do not override `PYTHON_BIN` to an older interpreter in container deployments.

## API Reference

### Package Management
Expand Down Expand Up @@ -150,7 +157,25 @@ Streamable HTTP install example:
}
```

Python stdio install example:

```json
{
"name": "my-python-mcp",
"serverName": "python-mcp",
"runtime": "python",
"pythonModule": "my_mcp_server",
"pythonArgs": ["--port", "0"],
"enabled": true
}
```

If `transportType` is omitted, the API defaults to `stdio`. For `streamable_http`, `command`, `args`, and `env` are ignored.
For `runtime: "python"`, `pythonModule` is required and `transportType` must be `stdio`.
Python installs always use a virtual environment at `packages/python/<serverName>` (or `PYTHON_VENV_DIR` if configured).
Python upgrades run `pip install --upgrade` inside that same virtual environment.
For Python runtime, `installPath` and `venvPath` are the same directory.
If `pipIndexUrl` or `pipExtraIndexUrl` are provided during install, they are persisted and reused for upgrades and update checks.

#### List Installed Packages

Expand Down
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ services:
- 8080:8080
env_file:
- .env
environment:
- PYTHON_BIN=/usr/local/bin/python3.13
volumes:
- ./packages:/app/packages
logging:
driver: 'json-file'
options:
max-size: 100m
max-file: '2'
max-file: '2'
6 changes: 5 additions & 1 deletion example.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ MONGO_HOST=localhost:27017
MONGO_DBNAME=mcp
SECRETS_KEY=secrets-key-here
SECRETS_DBNAME=secrets
INSTALL_ON_START=@missionsquad/mcp-github|github,@missionsquad/mcp-helper-tools|helper-tools
INSTALL_ON_START=@missionsquad/mcp-github|github,@missionsquad/mcp-helper-tools|helper-tools
PYTHON_BIN=/usr/bin/python3
PYTHON_VENV_DIR=packages/python
PIP_INDEX_URL=
PIP_EXTRA_INDEX_URL=
59 changes: 59 additions & 0 deletions openapi-packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@
"version": "1.0.0",
"enabled": true
}
},
"installPythonMcp": {
"summary": "Python MCP install request",
"value": {
"name": "my-python-mcp",
"serverName": "python-mcp",
"runtime": "python",
"pythonModule": "my_mcp_server",
"pythonArgs": ["--port", "0"],
"enabled": true
}
}
}
}
Expand Down Expand Up @@ -557,6 +568,32 @@
"type": "string",
"description": "Path where the package is installed"
},
"runtime": {
"type": "string",
"enum": ["node", "python"],
"description": "Package runtime."
},
"pythonModule": {
"type": "string",
"description": "Python module executed with -m."
},
"pythonArgs": {
"type": "array",
"items": { "type": "string" },
"description": "Arguments passed to the Python module."
},
"venvPath": {
"type": "string",
"description": "Relative path to the Python virtual environment."
},
"pipIndexUrl": {
"type": "string",
"description": "pip index URL used for installs/upgrades."
},
"pipExtraIndexUrl": {
"type": "string",
"description": "pip extra index URL used for installs/upgrades."
},
"status": {
"type": "string",
"description": "Installation status",
Expand Down Expand Up @@ -661,6 +698,11 @@
"type": "string",
"description": "Name to assign to the server"
},
"runtime": {
"type": "string",
"enum": ["node", "python"],
"description": "Package runtime. Defaults to node if omitted."
},
"transportType": {
"type": "string",
"enum": ["stdio", "streamable_http"],
Expand All @@ -681,6 +723,23 @@
},
"description": "Array of arguments for the command (stdio only, optional)"
},
"pythonModule": {
"type": "string",
"description": "Python module to execute with -m (required for python runtime)."
},
"pythonArgs": {
"type": "array",
"items": { "type": "string" },
"description": "Arguments appended after -m <pythonModule>."
},
"pipIndexUrl": {
"type": "string",
"description": "Optional pip index URL for this install."
},
"pipExtraIndexUrl": {
"type": "string",
"description": "Optional extra pip index URL for this install."
},
"env": {
"type": "object",
"additionalProperties": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@missionsquad/mcp-api",
"version": "1.9.0",
"version": "1.10.0",
"description": "MCP Servers exposed via HTTP API",
"main": "dist/index.js",
"repository": "missionsquad/mcp-api",
Expand Down
8 changes: 6 additions & 2 deletions src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@ export const env = {
const [repo, name] = pkg.split('|')
return { repo, name }
}),
SEARXNG_URL: process.env.SEARXNG_URL
}
SEARXNG_URL: process.env.SEARXNG_URL,
PYTHON_BIN: process.env.PYTHON_BIN,
PYTHON_VENV_DIR: process.env.PYTHON_VENV_DIR || 'packages/python',
PIP_INDEX_URL: process.env.PIP_INDEX_URL,
PIP_EXTRA_INDEX_URL: process.env.PIP_EXTRA_INDEX_URL
}
Loading
Loading