Skip to content

Commit 40d365e

Browse files
committed
docs: simplify GitHub Actions publishing guide
- Streamline installation with single-line curl command - Remove unnecessary chmod and directory operations - Condense authentication methods into compact sections - Simplify language-specific examples - Add AI assistant prompt tip to publish-server.md - Update action versions and make tests/builds optional This makes the guide more succinct and easier to follow while maintaining all essential information. :house: Remote-Dev: homespace
1 parent f32ecf0 commit 40d365e

File tree

2 files changed

+59
-171
lines changed

2 files changed

+59
-171
lines changed

docs/guides/publishing/github-actions.md

Lines changed: 53 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,14 @@ By the end of this tutorial, you'll have:
1212

1313
## Prerequisites
1414

15-
- Already published your server manually (complete [Publishing Tutorial](publish-server.md) first)
15+
- Understand general publishing requirements like package verification (see the [publishing guide](publish-server.md))
1616
- GitHub repository with your MCP server code
17-
- Basic understanding of CI/CD concepts
18-
- 20-30 minutes
1917

2018
## GitHub Actions Setup
2119

2220
### Step 1: Create Workflow File
2321

24-
Create `.github/workflows/publish-mcp.yml` in your repository:
22+
Create `.github/workflows/publish-mcp.yml`. Here's an example for NPM-based packages, but the MCP registry publishing steps are the same for all package types:
2523

2624
```yaml
2725
name: Publish to MCP Registry
@@ -39,22 +37,21 @@ jobs:
3937

4038
steps:
4139
- name: Checkout code
42-
uses: actions/checkout@v4
40+
uses: actions/checkout@v5
4341

4442
- name: Setup Node.js # Adjust for your language
45-
uses: actions/setup-node@v4
43+
uses: actions/setup-node@v5
4644
with:
47-
node-version: '20'
48-
registry-url: 'https://registry.npmjs.org'
45+
node-version: 'lts/*'
4946

5047
- name: Install dependencies
5148
run: npm ci
5249

5350
- name: Run tests
54-
run: npm test
51+
run: npm run test --if-present
5552

5653
- name: Build package
57-
run: npm run build
54+
run: npm run build --if-present
5855

5956
- name: Publish to npm
6057
run: npm publish
@@ -63,13 +60,7 @@ jobs:
6360

6461
- name: Install MCP Publisher
6562
run: |
66-
# Build publisher from source (requires Go)
67-
git clone https://github.com/modelcontextprotocol/registry publisher-repo
68-
cd publisher-repo
69-
make publisher
70-
cp cmd/publisher/bin/mcp-publisher ../mcp-publisher
71-
cd ..
72-
chmod +x mcp-publisher
63+
curl -L "https://github.com/modelcontextprotocol/registry/releases/download/v1.0.0/mcp-publisher_1.0.0_linux_amd64.tar.gz" | tar xz mcp-publisher
7364
7465
- name: Login to MCP Registry
7566
run: ./mcp-publisher login github-oidc
@@ -80,12 +71,9 @@ jobs:
8071
8172
### Step 2: Configure Secrets
8273
83-
For npm publishing, add your NPM token to repository secrets:
74+
You don't need any secrets for publishing to the MCP Registry using GitHub OIDC.
8475
85-
1. Go to repository Settings → Secrets and variables → Actions
86-
2. Add `NPM_TOKEN` with your npm access token
87-
88-
**Note:** GitHub OIDC authentication requires no additional secrets for MCP Registry publishing.
76+
However you might need to add secrets for your package registry. For example the workflow above needs a `NPM_TOKEN` (which you can add in Settings → Secrets and variables → Actions).
8977

9078
### Step 3: Tag and Release
9179

@@ -96,28 +84,17 @@ git tag v1.0.0
9684
git push origin v1.0.0
9785
```
9886

99-
The workflow will:
100-
1. Run tests
101-
2. Build your package
102-
3. Publish to npm
103-
4. Automatically authenticate with the MCP Registry
104-
5. Publish updated server.json
87+
The workflow runs tests, builds your package, publishes to npm, and publishes to the MCP Registry.
10588

106-
## Authentication Methods by CI Platform
89+
## Authentication Methods
10790

108-
### GitHub Actions - OIDC (Recommended)
91+
### GitHub Actions OIDC (Recommended)
10992

11093
```yaml
11194
- name: Login to MCP Registry
11295
run: mcp-publisher login github-oidc
11396
```
114-
115-
**Advantages:**
116-
- No secrets to manage
117-
- Automatically scoped to your repository
118-
- Most secure option
119-
120-
### GitHub Actions - Personal Access Token
97+
### GitHub Personal Access Token
12198

12299
```yaml
123100
- name: Login to MCP Registry
@@ -128,7 +105,7 @@ The workflow will:
128105

129106
Add `MCP_GITHUB_TOKEN` secret with a GitHub PAT that has repo access.
130107

131-
### DNS Authentication (Any CI)
108+
### DNS Authentication
132109

133110
For custom domain namespaces (`com.yourcompany/*`):
134111

@@ -143,154 +120,59 @@ Add your Ed25519 private key as `MCP_PRIVATE_KEY` secret.
143120

144121
## Language-Specific Examples
145122

146-
### Python Project
123+
### Python Example
147124

148125
```yaml
149-
name: Publish Python MCP Server
126+
- name: Setup Python
127+
uses: actions/setup-python@v4
128+
with:
129+
python-version: '3.11'
150130
151-
on:
152-
push:
153-
tags: ['v*']
154-
155-
jobs:
156-
publish:
157-
runs-on: ubuntu-latest
158-
permissions:
159-
id-token: write
160-
contents: read
161-
162-
steps:
163-
- uses: actions/checkout@v4
164-
165-
- name: Setup Python
166-
uses: actions/setup-python@v4
167-
with:
168-
python-version: '3.11'
169-
170-
- name: Install Poetry
171-
run: pipx install poetry
172-
173-
- name: Build package
174-
run: poetry build
175-
176-
- name: Publish to PyPI
177-
run: poetry publish
178-
env:
179-
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
180-
181-
- name: Install MCP Publisher
182-
run: |
183-
git clone https://github.com/modelcontextprotocol/registry publisher-repo
184-
cd publisher-repo && make publisher && cd ..
185-
cp publisher-repo/cmd/publisher/bin/mcp-publisher mcp-publisher
186-
187-
- name: Publish to MCP Registry
188-
run: |
189-
./mcp-publisher login github-oidc
190-
./mcp-publisher publish
191-
```
192-
193-
### Docker Project
194-
195-
```yaml
196-
name: Publish Docker MCP Server
131+
- name: Build and publish to PyPI
132+
run: |
133+
pipx install poetry
134+
poetry build
135+
poetry publish
136+
env:
137+
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
197138
198-
on:
199-
push:
200-
tags: ['v*']
139+
- name: Install MCP Publisher
140+
run: curl -L "https://github.com/modelcontextprotocol/registry/releases/download/v1.0.0/mcp-publisher_1.0.0_linux_amd64.tar.gz" | tar xz mcp-publisher
201141
202-
jobs:
203-
publish:
204-
runs-on: ubuntu-latest
205-
permissions:
206-
id-token: write
207-
contents: read
208-
209-
steps:
210-
- uses: actions/checkout@v4
211-
212-
- name: Setup Docker Buildx
213-
uses: docker/setup-buildx-action@v3
214-
215-
- name: Login to Docker Hub
216-
uses: docker/login-action@v3
217-
with:
218-
username: ${{ secrets.DOCKER_USERNAME }}
219-
password: ${{ secrets.DOCKER_PASSWORD }}
220-
221-
- name: Extract version
222-
id: version
223-
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
224-
225-
- name: Build and push
226-
uses: docker/build-push-action@v5
227-
with:
228-
context: .
229-
push: true
230-
tags: yourname/your-server:${{ steps.version.outputs.version }}
231-
labels: |
232-
io.modelcontextprotocol.server.name=io.github.yourname/your-server
233-
234-
- name: Install MCP Publisher
235-
run: |
236-
git clone https://github.com/modelcontextprotocol/registry publisher-repo
237-
cd publisher-repo && make publisher && cd ..
238-
cp publisher-repo/cmd/publisher/bin/mcp-publisher mcp-publisher
239-
240-
- name: Publish to MCP Registry
241-
run: |
242-
./mcp-publisher login github-oidc
243-
./mcp-publisher publish
142+
- name: Publish to MCP Registry
143+
run: |
144+
./mcp-publisher login github-oidc
145+
./mcp-publisher publish
244146
```
245147

246-
247-
## Best Practices
248-
249-
### 1. Version Alignment
250-
251-
Keep your package version and server.json version in sync:
148+
### Docker Example
252149

253150
```yaml
254-
- name: Update server.json version
255-
run: |
256-
VERSION=${GITHUB_REF#refs/tags/v}
257-
jq --arg version "$VERSION" '.version = $version' server.json > tmp.json
258-
mv tmp.json server.json
151+
- name: Login to Docker Hub
152+
uses: docker/login-action@v3
153+
with:
154+
username: ${{ secrets.DOCKER_USERNAME }}
155+
password: ${{ secrets.DOCKER_PASSWORD }}
156+
157+
- name: Build and push
158+
uses: docker/build-push-action@v5
159+
with:
160+
push: true
161+
tags: yourname/server:${{ github.ref_name }}
162+
labels: io.modelcontextprotocol.server.name=io.github.yourname/server
259163
```
260164

261-
### 2. Conditional Publishing
262165

263-
Only publish to registry after package publishing succeeds:
166+
## Tips
264167

168+
You can keep your package version and server.json version in sync automatically with something like:
265169
```yaml
266-
- name: Publish to npm
267-
run: npm publish
268-
id: npm-publish
269-
270-
- name: Publish to MCP Registry
271-
if: steps.npm-publish.outcome == 'success'
272-
run: ./mcp-publisher publish
170+
- run: |
171+
VERSION=${GITHUB_REF#refs/tags/v}
172+
jq --arg v "$VERSION" '.version = $v' server.json > tmp && mv tmp server.json
273173
```
274174

275175

276176
## Troubleshooting
277-
278-
**"Publisher binary not found"** - Ensure you download the correct binary for your CI platform (linux/mac/windows).
279-
280-
**"Authentication failed"** - For GitHub OIDC, verify `id-token: write` permission is set. For other methods, check secret configuration.
281-
282-
**"Package validation failed"** - Ensure your package was published successfully before MCP Registry publishing runs.
283-
284-
**"Version already exists"** - Each server.json version must be unique. Consider using build numbers: `1.0.0-build.123`.
285-
286-
## What You've Accomplished
287-
288-
You now have automated MCP server publishing that:
289-
- Triggers on version tags
290-
- Runs tests before publishing
291-
- Publishes to package registry first
292-
- Automatically publishes to MCP Registry
293-
- Handles authentication securely
294-
- Provides failure notifications
295-
296-
Your MCP server publishing is now fully automated - just tag a release and everything happens automatically!
177+
- **"Authentication failed"**: Ensure `id-token: write` permission is set for OIDC, or check secrets
178+
- **"Package validation failed"**: Verify your package published to your registry (NPM, PyPi etc.) successfully first, and that you have done the necessary validation steps in the [Publishing Tutorial](publish-server.md)

docs/guides/publishing/publish-server.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
Complete guide to publishing an MCP server to the registry.
44

5+
> [!TIP]
6+
> Using an agentic AI coding assistant? Just use this prompt:
7+
> ```
8+
> Read https://raw.githubusercontent.com/modelcontextprotocol/registry/refs/heads/main/docs/guides/publishing/publish-server.md and https://raw.githubusercontent.com/modelcontextprotocol/registry/refs/heads/main/docs/guides/publishing/github-actions.md. Evaluate the best way to publish this server to the registry (prefer automated CI flows over manual flows where possible), and implement that. If possible, validate the server.json against the $schema before telling the user you are done, using a proper json schema library or tool available on the user's machine. If you get stuck, guide the user through the parts of the publishing process they need to do (e.g. logging into the publisher CLI if doing manual pubishing).
9+
> ```
10+
511
## What You'll Learn
612
713
By the end of this tutorial, you'll have:

0 commit comments

Comments
 (0)