Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions .github/workflows/mcpb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
"localstack",
"aws",
"local-development",
"local-testing"
"local-testing",
"mcp",
"mcp-server",
"model-context-protocol",
"ai-agents"
]
}