tidy(docs): fix erroneous paths in docs/guides/publishing/github-actions.md (#455)
Tidy docs & lint. Solves https://github.com/modelcontextprotocol/registry/issues/454
This commit is contained in:
parent
35d2bd50c4
commit
c6b8359e23
1 changed files with 42 additions and 40 deletions
|
|
@ -5,6 +5,7 @@ Set up automated MCP server publishing using GitHub Actions.
|
||||||
## What You'll Learn
|
## What You'll Learn
|
||||||
|
|
||||||
By the end of this tutorial, you'll have:
|
By the end of this tutorial, you'll have:
|
||||||
|
|
||||||
- A GitHub Actions workflow that automatically publishes your server
|
- A GitHub Actions workflow that automatically publishes your server
|
||||||
- Understanding of GitHub OIDC authentication
|
- Understanding of GitHub OIDC authentication
|
||||||
- Knowledge of best practices for automated publishing
|
- Knowledge of best practices for automated publishing
|
||||||
|
|
@ -28,52 +29,52 @@ name: Publish to MCP Registry
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags: ['v*'] # Triggers on version tags like v1.0.0
|
tags: ["v*"] # Triggers on version tags like v1.0.0
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write # Required for OIDC authentication
|
id-token: write # Required for OIDC authentication
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js # Adjust for your language
|
- name: Setup Node.js # Adjust for your language
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: "20"
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: npm test
|
run: npm test
|
||||||
|
|
||||||
- name: Build package
|
- name: Build package
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
- name: Publish to npm
|
- name: Publish to npm
|
||||||
run: npm publish
|
run: npm publish
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
- name: Install MCP Publisher
|
- name: Install MCP Publisher
|
||||||
run: |
|
run: |
|
||||||
# Build publisher from source (requires Go)
|
# Build publisher from source (requires Go)
|
||||||
git clone https://github.com/modelcontextprotocol/registry publisher-repo
|
git clone https://github.com/modelcontextprotocol/registry publisher-repo
|
||||||
cd publisher-repo
|
cd publisher-repo
|
||||||
make publisher
|
make publisher
|
||||||
cp cmd/publisher/bin/mcp-publisher ../mcp-publisher
|
cp bin/mcp-publisher ../mcp-publisher
|
||||||
cd ..
|
cd ..
|
||||||
chmod +x mcp-publisher
|
chmod +x mcp-publisher
|
||||||
|
|
||||||
- name: Login to MCP Registry
|
- name: Login to MCP Registry
|
||||||
run: ./mcp-publisher login github-oidc
|
run: ./mcp-publisher login github-oidc
|
||||||
|
|
||||||
- name: Publish to MCP Registry
|
- name: Publish to MCP Registry
|
||||||
run: ./mcp-publisher publish
|
run: ./mcp-publisher publish
|
||||||
```
|
```
|
||||||
|
|
@ -97,8 +98,9 @@ git push origin v1.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
The workflow will:
|
The workflow will:
|
||||||
|
|
||||||
1. Run tests
|
1. Run tests
|
||||||
2. Build your package
|
2. Build your package
|
||||||
3. Publish to npm
|
3. Publish to npm
|
||||||
4. Automatically authenticate with the MCP Registry
|
4. Automatically authenticate with the MCP Registry
|
||||||
5. Publish updated server.json
|
5. Publish updated server.json
|
||||||
|
|
@ -112,7 +114,8 @@ The workflow will:
|
||||||
run: mcp-publisher login github-oidc
|
run: mcp-publisher login github-oidc
|
||||||
```
|
```
|
||||||
|
|
||||||
**Advantages:**
|
**Advantages:**
|
||||||
|
|
||||||
- No secrets to manage
|
- No secrets to manage
|
||||||
- Automatically scoped to your repository
|
- Automatically scoped to your repository
|
||||||
- Most secure option
|
- Most secure option
|
||||||
|
|
@ -150,7 +153,7 @@ name: Publish Python MCP Server
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags: ['v*']
|
tags: ["v*"]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
|
|
@ -158,32 +161,32 @@ jobs:
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: "3.11"
|
||||||
|
|
||||||
- name: Install Poetry
|
- name: Install Poetry
|
||||||
run: pipx install poetry
|
run: pipx install poetry
|
||||||
|
|
||||||
- name: Build package
|
- name: Build package
|
||||||
run: poetry build
|
run: poetry build
|
||||||
|
|
||||||
- name: Publish to PyPI
|
- name: Publish to PyPI
|
||||||
run: poetry publish
|
run: poetry publish
|
||||||
env:
|
env:
|
||||||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
|
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
|
||||||
|
|
||||||
- name: Install MCP Publisher
|
- name: Install MCP Publisher
|
||||||
run: |
|
run: |
|
||||||
git clone https://github.com/modelcontextprotocol/registry publisher-repo
|
git clone https://github.com/modelcontextprotocol/registry publisher-repo
|
||||||
cd publisher-repo && make publisher && cd ..
|
cd publisher-repo && make publisher && cd ..
|
||||||
cp publisher-repo/cmd/publisher/bin/mcp-publisher mcp-publisher
|
cp publisher-repo/bin/mcp-publisher mcp-publisher
|
||||||
|
|
||||||
- name: Publish to MCP Registry
|
- name: Publish to MCP Registry
|
||||||
run: |
|
run: |
|
||||||
./mcp-publisher login github-oidc
|
./mcp-publisher login github-oidc
|
||||||
|
|
@ -197,7 +200,7 @@ name: Publish Docker MCP Server
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags: ['v*']
|
tags: ["v*"]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
|
|
@ -205,23 +208,23 @@ jobs:
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Docker Buildx
|
- name: Setup Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Extract version
|
- name: Extract version
|
||||||
id: version
|
id: version
|
||||||
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
|
|
@ -230,20 +233,19 @@ jobs:
|
||||||
tags: yourname/your-server:${{ steps.version.outputs.version }}
|
tags: yourname/your-server:${{ steps.version.outputs.version }}
|
||||||
labels: |
|
labels: |
|
||||||
io.modelcontextprotocol.server.name=io.github.yourname/your-server
|
io.modelcontextprotocol.server.name=io.github.yourname/your-server
|
||||||
|
|
||||||
- name: Install MCP Publisher
|
- name: Install MCP Publisher
|
||||||
run: |
|
run: |
|
||||||
git clone https://github.com/modelcontextprotocol/registry publisher-repo
|
git clone https://github.com/modelcontextprotocol/registry publisher-repo
|
||||||
cd publisher-repo && make publisher && cd ..
|
cd publisher-repo && make publisher && cd ..
|
||||||
cp publisher-repo/cmd/publisher/bin/mcp-publisher mcp-publisher
|
cp publisher-repo/bin/mcp-publisher mcp-publisher
|
||||||
|
|
||||||
- name: Publish to MCP Registry
|
- name: Publish to MCP Registry
|
||||||
run: |
|
run: |
|
||||||
./mcp-publisher login github-oidc
|
./mcp-publisher login github-oidc
|
||||||
./mcp-publisher publish
|
./mcp-publisher publish
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Best Practices
|
## Best Practices
|
||||||
|
|
||||||
### 1. Version Alignment
|
### 1. Version Alignment
|
||||||
|
|
@ -272,7 +274,6 @@ Only publish to registry after package publishing succeeds:
|
||||||
run: ./mcp-publisher publish
|
run: ./mcp-publisher publish
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
**"Publisher binary not found"** - Ensure you download the correct binary for your CI platform (linux/mac/windows).
|
**"Publisher binary not found"** - Ensure you download the correct binary for your CI platform (linux/mac/windows).
|
||||||
|
|
@ -286,6 +287,7 @@ Only publish to registry after package publishing succeeds:
|
||||||
## What You've Accomplished
|
## What You've Accomplished
|
||||||
|
|
||||||
You now have automated MCP server publishing that:
|
You now have automated MCP server publishing that:
|
||||||
|
|
||||||
- Triggers on version tags
|
- Triggers on version tags
|
||||||
- Runs tests before publishing
|
- Runs tests before publishing
|
||||||
- Publishes to package registry first
|
- Publishes to package registry first
|
||||||
|
|
@ -293,4 +295,4 @@ You now have automated MCP server publishing that:
|
||||||
- Handles authentication securely
|
- Handles authentication securely
|
||||||
- Provides failure notifications
|
- Provides failure notifications
|
||||||
|
|
||||||
Your MCP server publishing is now fully automated - just tag a release and everything happens automatically!
|
Your MCP server publishing is now fully automated - just tag a release and everything happens automatically!
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue