Repository navigation
115 lines (101 loc) · 4.32 KB
/
Copy pathmcpb.yml
File metadata and controls
115 lines (101 loc) · 4.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Claude Desktop extension
# Builds the Claude Desktop extension (.mcpb) from manifest.json and attaches it to the GitHub
# release, so Claude Desktop users can install the server with one click. Pull requests that touch
# the manifest or this workflow only build and validate the bundle. Run it by hand with a tag
# (workflow_dispatch) to attach a bundle to a release that is missing one.
on:
release:
types: [published]
pull_request:
branches: [main]
paths:
- "manifest.json"
- "icon.png"
- ".github/workflows/mcpb.yml"
workflow_dispatch:
inputs:
tag:
description: "Release tag to build and attach the bundle to (for example v0.8.0)"
required: true
permissions:
contents: read
concurrency:
group: mcpb-${{ github.event.release.tag_name || inputs.tag || github.ref }}
cancel-in-progress: false
env:
MCPB_VERSION: "2.1.2"
jobs:
build:
runs-on: ubuntu-26.04
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.release.tag_name || inputs.tag || github.ref }}
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22.x
package-manager-cache: false # release builds must not restore a cache a PR could have written
- name: Check that the tag matches manifest.json
if: github.event_name != 'pull_request'
env:
TAG: ${{ github.event.release.tag_name || inputs.tag }}
run: |
set -euo pipefail
v=$(jq -r .version manifest.json)
[ "$TAG" = "v$v" ] || { echo "::error::tag $TAG does not match manifest.json version $v"; exit 1; }
- name: Build
run: |
yarn install --frozen-lockfile
yarn build
# Pack from a staging directory with only what the extension runs: the build output and
# production dependencies, not the source tree, tests or dev dependencies.
- name: Validate and pack the bundle
run: |
set -euo pipefail
v=$(jq -r .version manifest.json)
mkdir stage
cp -r manifest.json icon.png package.json yarn.lock LICENSE README.md dist stage/
(cd stage && yarn install --production --frozen-lockfile --ignore-scripts --non-interactive)
npx -y "@anthropic-ai/mcpb@${MCPB_VERSION}" validate stage/manifest.json
npx -y "@anthropic-ai/mcpb@${MCPB_VERSION}" pack stage "localstack-mcp-server-${v}.mcpb"
echo "MCPB_FILE=localstack-mcp-server-${v}.mcpb" >> "$GITHUB_ENV"
- name: Smoke-test the bundle
run: |
set -euo pipefail
mkdir smoke && unzip -q "$MCPB_FILE" -d smoke
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"ci","version":"1"}}}' \
'{"jsonrpc":"2.0","method":"notifications/initialized"}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/list"}' \
| (cd smoke && timeout 20 node dist/cli.js || true) > smoke.out
tools=$(grep '"id":2' smoke.out | jq '.result.tools | length')
echo "tools/list returned $tools tools"
[ "${tools:-0}" -gt 0 ] || { echo "::error::the packed server did not list any tools"; cat smoke.out; exit 1; }
- name: Upload the bundle as a workflow artifact
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: mcpb
path: ${{ env.MCPB_FILE }}
if-no-files-found: error
attach:
needs: build
if: github.event_name != 'pull_request'
runs-on: ubuntu-26.04
timeout-minutes: 5
permissions:
contents: write # upload the .mcpb to the release
steps:
- name: Download the bundle
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: mcpb
- name: Attach the bundle to the release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
TAG: ${{ github.event.release.tag_name || inputs.tag }}
run: gh release upload "$TAG" localstack-mcp-server-*.mcpb --clobber