π The fast, Pythonic way to build MCP servers and clients.
chore: Automate docs and schema updates via PRs (#1611)
Jeremiah Lowind85243d191a3
diff --git a/.github/workflows/marvin.yml b/.github/workflows/marvin.ymlindex 7b9c6923e..8d26185a9 100644--- a/.github/workflows/marvin.yml+++ b/.github/workflows/marvin.yml@@ -33,12 +33,6 @@ jobs:steps:- uses: actions/checkout@v5- # Set up Python environment- - name: Set up Python- uses: actions/setup-python@v5- with:- python-version: "3.12"-# Install UV package manager- name: Install UVuses: astral-sh/setup-uv@v6@@ -48,7 +42,7 @@ jobs:# Install project dependencies- name: Install dependencies- run: uv sync --dev+ run: uv sync --python 3.12# Install pre-commit hooks automatically- name: Install pre-commit hooksdiff --git a/.github/workflows/update-config-schema.yml b/.github/workflows/update-config-schema.ymlnew file mode 100644index 000000000..7c88947fd--- /dev/null+++ b/.github/workflows/update-config-schema.yml@@ -0,0 +1,93 @@+name: Update FastMCPConfig Schema++# This workflow runs on merges to main to automatically update the config schema+# by creating a PR when changes are needed.++on:+ push:+ branches: ["main"]+ paths:+ - "src/fastmcp/utilities/fastmcp_config/**"+ - "!src/fastmcp/utilities/fastmcp_config/v1/schema.json" # Exclude the local schema file+ workflow_dispatch:++permissions:+ contents: write+ pull-requests: write++jobs:+ update-config-schema:+ timeout-minutes: 5+ runs-on: ubuntu-latest++ steps:+ - uses: actions/checkout@v5++ - name: Generate Marvin App token+ id: marvin-token+ uses: actions/create-github-app-token@v2+ with:+ app-id: ${{ secrets.MARVIN_APP_ID }}+ private-key: ${{ secrets.MARVIN_APP_PRIVATE_KEY }}++ - name: Install uv+ uses: astral-sh/setup-uv@v6+ with:+ enable-cache: true+ cache-dependency-glob: "uv.lock"++ - name: Install dependencies+ run: uv sync --python 3.12++ - name: Generate config schema+ run: |+ echo "π Generating fastmcp.json schema..."+ uv run python -c "+ from fastmcp.utilities.fastmcp_config import generate_schema+ generate_schema('docs/public/schemas/fastmcp.json/latest.json')+ print('β Schema generated successfully')+ "++ # Also update the v1 schema for consistency+ uv run python -c "+ from fastmcp.utilities.fastmcp_config import generate_schema+ generate_schema('docs/public/schemas/fastmcp.json/v1.json')+ print('β v1 schema updated')+ "++ - name: Check for changes+ id: check_changes+ run: |+ if git diff --quiet docs/public/schemas/fastmcp.json/; then+ echo "No changes detected in config schema"+ echo "has_changes=false" >> $GITHUB_OUTPUT+ else+ echo "Changes detected in config schema"+ echo "has_changes=true" >> $GITHUB_OUTPUT+ fi++ - name: Create Pull Request+ if: steps.check_changes.outputs.has_changes == 'true'+ uses: peter-evans/create-pull-request@v7+ with:+ token: ${{ steps.marvin-token.outputs.token }}+ commit-message: "chore: Update fastmcp.json schema"+ title: "chore: Update fastmcp.json schema"+ body: |+ This PR updates the fastmcp.json schema files to match the current source code.++ The schema is automatically generated from `src/fastmcp/utilities/fastmcp_config/` to ensure consistency.++ π€ Generated by Marvin+ branch: marvin/update-config-schema+ delete-branch: true+ author: "marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>"+ committer: "marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>"++ - name: Summary+ run: |+ if [ "${{ steps.check_changes.outputs.has_changes }}" == "true" ]; then+ echo "β Config schema PR created"+ else+ echo "β Config schema is already up to date"+ fidiff --git a/.github/workflows/update-sdk-docs.yml b/.github/workflows/update-sdk-docs.ymlindex 49ae10fe7..a23ff3069 100644--- a/.github/workflows/update-sdk-docs.yml+++ b/.github/workflows/update-sdk-docs.yml@@ -1,8 +1,7 @@name: Update SDK Documentation# This workflow runs on merges to main to automatically update SDK docs-# without blocking PRs. SDK doc generation can fail if another PR merges-# first, so handling it post-merge prevents annoying CI failures for contributors.+# by creating a PR when changes are needed.on:push:@@ -23,8 +22,13 @@ jobs:steps:- uses: actions/checkout@v5++ - name: Generate Marvin App token+ id: marvin-token+ uses: actions/create-github-app-token@v2with:- token: ${{ secrets.GITHUB_TOKEN }}+ app-id: ${{ secrets.MARVIN_APP_ID }}+ private-key: ${{ secrets.MARVIN_APP_PRIVATE_KEY }}- name: Install uvuses: astral-sh/setup-uv@v6@@ -32,13 +36,8 @@ jobs:enable-cache: truecache-dependency-glob: "uv.lock"- - name: Set up Python- uses: actions/setup-python@v5- with:- python-version: "3.12"-- name: Install dependencies- run: uv sync --dev+ run: uv sync --python 3.12- name: Install justuses: extractions/setup-just@v3@@ -59,23 +58,28 @@ jobs:echo "has_changes=true" >> $GITHUB_OUTPUTfi- - name: Commit and push changes+ - name: Create Pull Requestif: steps.check_changes.outputs.has_changes == 'true'- run: |- git config --local user.email "[email protected]"- git config --local user.name "GitHub Action"- git add docs/python-sdk/ docs/docs.json- git commit -m "chore: Update SDK documentation+ uses: peter-evans/create-pull-request@v7+ with:+ token: ${{ steps.marvin-token.outputs.token }}+ commit-message: "chore: Update SDK documentation"+ title: "chore: Update SDK documentation"+ body: |+ This PR updates the auto-generated SDK documentation to reflect the latest source code changes.- π€ Generated with [Claude Code](https://claude.ai/code)+ π Documentation is automatically generated from the source code docstrings and type annotations.- Co-Authored-By: Claude <[email protected]>"- git push+ π€ Generated by Marvin+ branch: marvin/update-sdk-docs+ delete-branch: true+ author: "marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>"+ committer: "marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>"- name: Summaryrun: |if [ "${{ steps.check_changes.outputs.has_changes }}" == "true" ]; then- echo "β SDK documentation updated and committed"+ echo "β SDK documentation PR created"elseecho "β SDK documentation is already up to date"fi