diff --git a/.github/workflows/mcpb.yml b/.github/workflows/mcpb.yml new file mode 100644 index 0000000..198f67d --- /dev/null +++ b/.github/workflows/mcpb.yml @@ -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 diff --git a/package.json b/package.json index 7c55960..d3441b7 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,10 @@ "localstack", "aws", "local-development", - "local-testing" + "local-testing", + "mcp", + "mcp-server", + "model-context-protocol", + "ai-agents" ] }