name: Publish to PyPI
on:
push:
tags:
- 'v*'
env:
PYTHON_VERSION: "3.11"
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Set up Python
run: uv python install ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: uv sync --all-packages --all-extras
- name: Run tests
run: uv run pytest -m "not gpu and not slow" --tb=short
build-shared:
name: Build Shared Packages
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
include:
- package: shared/mcp-common
pkgname: scicomp-mcp-common
artifactname: dist-mcp-common
- package: shared/compute-core
pkgname: scicomp-compute-core
artifactname: dist-compute-core
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Set up Python
run: uv python install ${{ env.PYTHON_VERSION }}
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Update version in pyproject.toml
run: |
cd ${{ matrix.package }}
sed -i 's/version = ".*"/version = "${{ steps.version.outputs.VERSION }}"/' pyproject.toml
- name: Create README for package
run: |
cd ${{ matrix.package }}
if [ ! -f README.md ]; then
echo "# $(basename ${{ matrix.package }})" > README.md
echo "" >> README.md
echo "Part of the Math-Physics-ML MCP system." >> README.md
echo "" >> README.md
echo "See [documentation](https://andylbrummer.github.io/math-mcp/) for details." >> README.md
fi
- name: Build package
run: |
cd ${{ matrix.package }}
uv build --out-dir dist
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifactname }}
path: ${{ matrix.package }}/dist/
publish-shared:
name: Publish Shared to PyPI
needs: build-shared
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/${{ matrix.pkgname }}/
permissions:
id-token: write
strategy:
matrix:
include:
- package: shared/mcp-common
pkgname: scicomp-mcp-common
artifactname: dist-mcp-common
- package: shared/compute-core
pkgname: scicomp-compute-core
artifactname: dist-compute-core
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifactname }}
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
build-servers:
name: Build Server Packages
needs: publish-shared
runs-on: ubuntu-latest
strategy:
matrix:
include:
- package: servers/math-mcp
pkgname: scicomp-math-mcp
artifactname: dist-math-mcp
- package: servers/quantum-mcp
pkgname: scicomp-quantum-mcp
artifactname: dist-quantum-mcp
- package: servers/molecular-mcp
pkgname: scicomp-molecular-mcp
artifactname: dist-molecular-mcp
- package: servers/neural-mcp
pkgname: scicomp-neural-mcp
artifactname: dist-neural-mcp
- package: servers/llm-mcp
pkgname: scicomp-llm-mcp
artifactname: dist-llm-mcp
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Set up Python
run: uv python install ${{ env.PYTHON_VERSION }}
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Update version in pyproject.toml
run: |
cd ${{ matrix.package }}
sed -i 's/version = ".*"/version = "${{ steps.version.outputs.VERSION }}"/' pyproject.toml
# Update shared package versions to match
sed -i 's/scicomp-mcp-common>=0.1.0/scicomp-mcp-common>=${{ steps.version.outputs.VERSION }}/' pyproject.toml
sed -i 's/scicomp-compute-core>=0.1.0/scicomp-compute-core>=${{ steps.version.outputs.VERSION }}/' pyproject.toml
# Remove workspace sources for publishing
sed -i '/^\[tool.uv.sources\]/,/^$/d' pyproject.toml
- name: Create README for package
run: |
cd ${{ matrix.package }}
PACKAGE_NAME=$(basename ${{ matrix.package }})
PYPI_NAME="scicomp-${PACKAGE_NAME}"
if [ ! -f README.md ]; then
echo "# ${PYPI_NAME}" > README.md
echo "" >> README.md
echo "Part of the Math-Physics-ML MCP system." >> README.md
echo "" >> README.md
echo "## Installation" >> README.md
echo "" >> README.md
echo "\`\`\`bash" >> README.md
echo "# Run directly with uvx" >> README.md
echo "uvx ${PYPI_NAME}" >> README.md
echo "" >> README.md
echo "# Or install with pip" >> README.md
echo "pip install ${PYPI_NAME}" >> README.md
echo "\`\`\`" >> README.md
echo "" >> README.md
echo "See [documentation](https://andylbrummer.github.io/math-mcp/api/${PACKAGE_NAME}) for details." >> README.md
fi
- name: Build package
run: |
cd ${{ matrix.package }}
uv build --out-dir dist
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifactname }}
path: ${{ matrix.package }}/dist/
publish-servers:
name: Publish Servers to PyPI
needs: build-servers
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/${{ matrix.pkgname }}/
permissions:
id-token: write
strategy:
matrix:
include:
- package: servers/math-mcp
pkgname: scicomp-math-mcp
artifactname: dist-math-mcp
- package: servers/quantum-mcp
pkgname: scicomp-quantum-mcp
artifactname: dist-quantum-mcp
- package: servers/molecular-mcp
pkgname: scicomp-molecular-mcp
artifactname: dist-molecular-mcp
- package: servers/neural-mcp
pkgname: scicomp-neural-mcp
artifactname: dist-neural-mcp
- package: servers/llm-mcp
pkgname: scicomp-llm-mcp
artifactname: dist-llm-mcp
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifactname }}
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
publish-mcp-registry:
name: Publish to MCP Registry
needs: publish-servers
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # Required for OIDC
strategy:
matrix:
include:
- package: servers/math-mcp
mcpName: io.github.andylbrummer/math-mcp
- package: servers/quantum-mcp
mcpName: io.github.andylbrummer/quantum-mcp
- package: servers/molecular-mcp
mcpName: io.github.andylbrummer/molecular-mcp
- package: servers/neural-mcp
mcpName: io.github.andylbrummer/neural-mcp
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Install mcp-publisher
run: |
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_linux_amd64.tar.gz" | tar xz mcp-publisher
chmod +x mcp-publisher
sudo mv mcp-publisher /usr/local/bin/
- name: Authenticate to MCP Registry
run: mcp-publisher login github-oidc
- name: Update server.json with version
working-directory: ${{ matrix.package }}
run: |
jq --arg v "${{ steps.version.outputs.VERSION }}" '.version = $v | .packages[0].version = $v' server.json > server.tmp
mv server.tmp server.json
- name: Publish to MCP Registry
working-directory: ${{ matrix.package }}
run: mcp-publisher publish
release:
name: Create GitHub Release
needs: [publish-servers, publish-mcp-registry]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: all-dist/
merge-multiple: false
- name: Flatten dist files
run: |
mkdir -p dist
find all-dist -name "*.whl" -exec cp {} dist/ \;
find all-dist -name "*.tar.gz" -exec cp {} dist/ \;
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: dist/*
generate_release_notes: true
body: |
## Math-Physics-ML MCP v${{ steps.version.outputs.VERSION }}
GPU-accelerated MCP servers for computational mathematics, physics simulations, and machine learning.
### Installation
```bash
# Run directly with uvx (no installation required)
uvx scicomp-math-mcp
uvx scicomp-quantum-mcp
uvx scicomp-molecular-mcp
uvx scicomp-neural-mcp
uvx scicomp-llm-mcp
# Or install with pip
pip install scicomp-math-mcp scicomp-quantum-mcp scicomp-molecular-mcp scicomp-neural-mcp scicomp-llm-mcp
# With GPU support
pip install scicomp-math-mcp[gpu] scicomp-quantum-mcp[gpu] scicomp-molecular-mcp[gpu] scicomp-neural-mcp[gpu] scicomp-llm-mcp[gpu]
```
### Documentation
See the [full documentation](https://andylbrummer.github.io/math-mcp/) for:
- [Installation Guide](https://andylbrummer.github.io/math-mcp/getting-started/installation)
- [Configuration](https://andylbrummer.github.io/math-mcp/getting-started/configuration)
- [API Reference](https://andylbrummer.github.io/math-mcp/api/overview)