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
32 changes: 32 additions & 0 deletions .github/scripts/install-mcp-publisher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Downloads mcp-publisher $MCP_PUBLISHER_VERSION into the working directory and verifies its
# Sigstore bundle against the registry's release workflow before extracting it.
# Needs cosign on PATH. Usage: MCP_PUBLISHER_VERSION=v1.8.15 .github/scripts/install-mcp-publisher.sh
set -euo pipefail

if [ "${1:-}" = "--help" ] || [ "${1:-}" = "-h" ]; then
sed -n '2,4p' "$0" | sed 's/^# \{0,1\}//'
exit 0
fi

: "${MCP_PUBLISHER_VERSION:?set MCP_PUBLISHER_VERSION to a release tag such as v1.8.15}"
case "$MCP_PUBLISHER_VERSION" in
v[0-9]*.[0-9]*.[0-9]*) ;;
*) echo "MCP_PUBLISHER_VERSION must be a release tag (vX.Y.Z), not '$MCP_PUBLISHER_VERSION'" >&2; exit 1 ;;
esac

os="$(uname -s | tr '[:upper:]' '[:lower:]')"
arch="$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')"
archive="mcp-publisher_${os}_${arch}.tar.gz"
base_url="https://github.com/modelcontextprotocol/registry/releases/download/${MCP_PUBLISHER_VERSION}"

curl --fail --location --silent --show-error --output "$archive" "$base_url/$archive"
curl --fail --location --silent --show-error --output "$archive.sigstore.json" "$base_url/$archive.sigstore.json"
cosign verify-blob \
--bundle "$archive.sigstore.json" \
--certificate-identity "https://github.com/modelcontextprotocol/registry/.github/workflows/release.yml@refs/tags/${MCP_PUBLISHER_VERSION}" \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
"$archive"
tar xzf "$archive" mcp-publisher
rm -f "$archive" "$archive.sigstore.json"
./mcp-publisher --version
128 changes: 128 additions & 0 deletions .github/workflows/mcp-registry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: MCP Registry

# Publishes server.json to the official MCP registry (registry.modelcontextprotocol.io) for every
# release tag, so the registry lists the same version as npm. Pull requests that touch the release
# metadata only validate it. Re-run by hand (workflow_dispatch on main) to publish a version that
# is on npm but missing from the registry; a version the registry already has is skipped.

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
pull_request:
branches: [main]
paths:
- "server.json"
- "package.json"
- "manifest.json"
- ".github/workflows/mcp-registry.yml"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: mcp-registry-${{ github.ref }}
cancel-in-progress: false

env:
# Hand-managed pin: Dependabot cannot update a release download. Pick a release at least 7 days
# old (the cooldown in dependabot.yml) and keep it a tag, never `latest`. The download is
# verified against the release workflow's Sigstore signature before it runs.
MCP_PUBLISHER_VERSION: v1.8.15
NPM_PACKAGE: "@localstack/localstack-mcp-server"

jobs:
validate:
runs-on: ubuntu-26.04
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

# package.json is the source of the version; a release bumps all three files together.
- name: Check that the versions agree
env:
REF_TYPE: ${{ github.ref_type }}
REF_NAME: ${{ github.ref_name }}
run: |
set -euo pipefail
pkg=$(jq -r .version package.json)
for v in "$(jq -r .version server.json)" "$(jq -r '.packages[0].version' server.json)" "$(jq -r .version manifest.json)"; do
[ "$v" = "$pkg" ] || { echo "::error::server.json and manifest.json must carry package.json's version $pkg (found $v)"; exit 1; }
done
if [ "$REF_TYPE" = tag ] && [ "$REF_NAME" != "v$pkg" ]; then
echo "::error::tag $REF_NAME does not match package.json version $pkg"; exit 1
fi
echo "version $pkg"

- name: Install cosign
uses: sigstore/cosign-installer@756fe2d284c7292c4e9b62c8a28f1e5629c59532 # v4.1.3

- name: Download and verify mcp-publisher
run: ./.github/scripts/install-mcp-publisher.sh

- name: Validate server.json
run: ./mcp-publisher validate

publish:
needs: validate
if: github.event_name != 'pull_request' && (github.ref_type == 'tag' || github.ref == 'refs/heads/main')
runs-on: ubuntu-26.04
timeout-minutes: 45
permissions:
contents: read
id-token: write # GitHub OIDC proves ownership of the io.github.localstack namespace; no secret
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Skip if the registry already has this version
id: registry
run: |
set -euo pipefail
name=$(jq -r .name server.json); v=$(jq -r .version server.json)
if curl -fsS --get "https://registry.modelcontextprotocol.io/v0/servers" \
--data-urlencode "search=$name" --data-urlencode "version=$v" \
| jq -e --arg n "$name" --arg v "$v" 'any(.servers[]; .server.name == $n and .server.version == $v)' >/dev/null; then
echo "The registry already lists $name $v."
echo "published=true" >> "$GITHUB_OUTPUT"
else
echo "published=false" >> "$GITHUB_OUTPUT"
fi

# The registry checks the npm package (and its mcpName) when it accepts server.json, and
# npm publishing is not part of this workflow, so wait for it.
- name: Wait for the version on npm
if: steps.registry.outputs.published == 'false'
run: |
set -euo pipefail
v=$(jq -r .version server.json); name=$(jq -r .name server.json)
url="https://registry.npmjs.org/${NPM_PACKAGE/\//%2f}/$v"
for _ in $(seq 1 80); do
if meta=$(curl -fsS "$url" 2>/dev/null); then
got=$(echo "$meta" | jq -r '.mcpName // empty')
[ "$got" = "$name" ] || { echo "::error::$NPM_PACKAGE@$v has mcpName '$got', expected '$name'"; exit 1; }
echo "$NPM_PACKAGE@$v is on npm"; exit 0
fi
sleep 30
done
echo "::error::$NPM_PACKAGE@$v did not appear on npm within 40 minutes"; exit 1

- name: Install cosign
if: steps.registry.outputs.published == 'false'
uses: sigstore/cosign-installer@756fe2d284c7292c4e9b62c8a28f1e5629c59532 # v4.1.3

- name: Download and verify mcp-publisher
if: steps.registry.outputs.published == 'false'
run: ./.github/scripts/install-mcp-publisher.sh

- name: Publish to the MCP registry
if: steps.registry.outputs.published == 'false'
run: |
./mcp-publisher login github-oidc
./mcp-publisher publish
11 changes: 10 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,21 @@ arrive as PRs instead of waiting for someone to notice, or is a hand-managed pin
the jobs running the tool tests or the evals use it, and that every workflow runs on the same pinned
Ubuntu.
- **Hand-managed pins** (Node's major line, the runner's Ubuntu release, `zod` up to xmcp's copy,
`@gleanwork/mcp-server-tester` while `patches/` patches it) carry their reason next to them (an `ignore` entry in
`@gleanwork/mcp-server-tester` while `patches/` patches it, `MCP_PUBLISHER_VERSION` in `mcp-registry.yml`) carry their reason next to them (an `ignore` entry in
`dependabot.yml`, or a comment), and `src/core/dependency-pins.test.ts` keeps the ones it can in sync.
- **Fix advisories by upgrading.** `audit-ci --high --skip-dev` gates CI. If no fixed version exists, an allowlist
entry names the advisory, why it does not apply, and when to revisit it.
- **Actions pinned to a commit SHA**, with the version in a comment (`uses: actions/checkout@<sha> # v7`).
Dependabot updates both.

## Releasing

A release bumps `version` in `package.json`, `manifest.json` and `server.json` (both `version` fields) together;
`src/core/release-metadata.test.ts` fails if they differ. After the npm package is published, pushing the `vX.Y.Z`
tag runs `.github/workflows/mcp-registry.yml`, which waits for the version on npm and publishes `server.json` to the
official MCP registry with GitHub OIDC (no secret). To publish a version the registry missed, run that workflow by
hand on `main`; it skips versions the registry already lists.

## Docker image size

Every user of the image downloads it, often in CI on every run, so its size is part of the startup time. Keep it
Expand Down Expand Up @@ -356,6 +364,7 @@ row once it ships.
| Filter the IAM policy summary by trace (or time range), so a run's policies don't mix with earlier requests | Not implemented: the summary is global and can only be cleared. | `get-auto-derived-iam-policies` |
| Say on the App Inspector events page when IAM events are hidden by the license (as spans do with `iam_errors_suppressed`) | Not implemented: the events routes return an empty list, so a tool has to probe one span. | `list-iam-denials`, `explain-iam` |
| Compare suggested policies with deployed ones: permissions to add and permissions granted but unused, per ARN | Not implemented. | IAM job 3 |
| Document the resource listing (`GET /_localstack/resources`, NDJSON, optional `services`, or `account` with `region`) in the OpenAPI spec | LocalStack removed `GET /_localstack/pods/state/metamodel`, which `inspect` used, and names this listing as its replacement. lstk's `status` command depends on it; neither the spec nor the docs name it. Its response is described in `src/lib/localstack/state-inspect.logic.ts`. | `localstack-state-management` `inspect` (allowed under the rule 4 exception) |
| Document App Inspector's status route (`GET`/`PUT /_localstack/appinspector/status`) in its OpenAPI spec | Not in `/_localstack/appinspector/v1/openapi.yaml`. lstk's `inspect` command uses it too. | `get-status`, `set-status` (allowed under the rule 4 exception) |
| Presentation fields for IAM: a display name, the services and the action count per policy summary entry; the principal kind (ARN, service, account) on suggestion hints; the statements a decision names, resolved | Not implemented. Until it ships, show the ARN, the type and the policy JSON, name statement positions without resolving them, and word hints for any kind of caller. | `explain-iam`, `get-auto-derived-iam-policies` |
| List one run's denials: a trace filter on the events routes (events carry no trace id) | Not implemented. Until then, `list-iam-denials` lists all traces and offers `newer_than` for new denials only. | `list-iam-denials` |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ This server provides your AI with dedicated tools for managing your LocalStack e
| [`localstack-iam-policy-analyzer`](./src/tools/localstack-iam-policy-analyzer.ts) | Handles IAM policy management and violation remediation; `localstack-app-inspector` is recommended for IAM | - Set IAM enforcement levels including `enforced`, `soft`, and `disabled` modes<br/>- Search logs for permission-related violations<br/>- Generate IAM policies automatically from detected access failures<br/>- Every response recommends the matching `localstack-app-inspector` action (`get-iam-mode`, `set-iam-mode`, `list-iam-denials`, `explain-iam`, `get-auto-derived-iam-policies`)<br/>- Requires a valid LocalStack Auth Token |
| [`localstack-chaos-injector`](./src/tools/localstack-chaos-injector.ts) | Injects and manages chaos experiment faults for system resilience testing | - Inject, add, remove, and clear service fault rules<br/>- Configure network latency effects<br/>- Comprehensive fault targeting by service, region, and operation<br/>- Built-in workflow guidance for chaos experiments<br/>- Requires a valid LocalStack Auth Token |
| [`localstack-cloud-pods`](./src/tools/localstack-cloud-pods.ts) | Manages remote LocalStack Cloud Pods for development workflows | - Save current state as a Cloud Pod<br/>- Load previously saved Cloud Pods instantly<br/>- Delete Cloud Pods from remote cloud-backed storage<br/>- Use this for managed remote state snapshots, not local export/import files<br/>- Requires a valid LocalStack Auth Token |
| [`localstack-state-management`](./src/tools/localstack-state-management.ts) | Manages local file-based LocalStack state export/import workflows | - Export LocalStack state to a local file on disk through the LocalStack State REST API<br/>- Import LocalStack state from a local file<br/>- Inspect current LocalStack state as JSON metamodel data<br/>- Reset all state or only selected services<br/>- Supports service-level granularity for export, reset, and inspect<br/>- Use this for local disk workflows; use Cloud Pods for remote cloud-backed snapshots<br/>- Requires a valid LocalStack Auth Token |
| [`localstack-state-management`](./src/tools/localstack-state-management.ts) | Manages local file-based LocalStack state export/import workflows | - Export LocalStack state to a local file on disk through the LocalStack State REST API<br/>- Import LocalStack state from a local file<br/>- Inspect: list the resources deployed in the running LocalStack (type, ID, region, account)<br/>- Reset all state or only selected services<br/>- Supports service-level granularity for export, reset, and inspect<br/>- Use this for local disk workflows; use Cloud Pods for remote cloud-backed snapshots<br/>- Requires a valid LocalStack Auth Token |
| [`localstack-extensions`](./src/tools/localstack-extensions.ts) | Installs, uninstalls, lists, and discovers LocalStack Extensions | - Manage installed extensions (`list`, `install`, `uninstall`) inside the running container<br/>- Browse the LocalStack Extensions marketplace (`available`)<br/>- Requires a valid LocalStack Auth Token |
| [`localstack-ephemeral-instances`](./src/tools/localstack-ephemeral-instances.ts) | Manages cloud-hosted LocalStack Ephemeral Instances | - Create temporary cloud-hosted LocalStack instances and get an endpoint URL<br/>- List available ephemeral instances, fetch logs, and delete instances<br/>- Supports lifetime, extension preload, Cloud Pod preload, and custom env vars on create<br/>- Requires a valid LocalStack Auth Token |
| [`localstack-aws-client`](./src/tools/localstack-aws-client.ts) | Runs AWS CLI commands against LocalStack for AWS | - Executes commands with the official AWS CLI v2 through `lstk aws`, so it requires `lstk` and `aws` in your system path<br/>- Keeps every request on LocalStack: the CLI runs without your `~/.aws` and behind a local proxy that refuses other hosts<br/>- Reads and writes local files only inside `LOCALSTACK_AWS_WORKDIR`<br/>- Sanitizes commands to block shell chaining<br/>- Auto-detects LocalStack coverage errors and links to docs |
Expand Down
40 changes: 40 additions & 0 deletions src/core/release-metadata.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import fs from "fs";
import path from "path";

// The MCP registry (server.json), the Claude Desktop extension (manifest.json) and npm
// (package.json) must describe the same release. .github/workflows/mcp-registry.yml publishes
// server.json on every release tag and fails if these disagree; this catches it on the PR.

const ROOT = path.resolve(__dirname, "../..");
const json = (file: string) => JSON.parse(fs.readFileSync(path.join(ROOT, file), "utf8"));

describe("release metadata", () => {
const pkg = json("package.json");
const server = json("server.json");
const manifest = json("manifest.json");

it("carries package.json's version in server.json and manifest.json", () => {
expect({
server: server.version,
serverPackage: server.packages[0].version,
manifest: manifest.version,
}).toEqual({ server: pkg.version, serverPackage: pkg.version, manifest: pkg.version });
});

it("names the npm package the registry verifies", () => {
expect(server.name).toBe(pkg.mcpName);
expect(server.packages[0]).toMatchObject({
registryType: "npm",
identifier: pkg.name,
transport: { type: "stdio" },
});
});

it("uses the registry's current schema and its description limit", () => {
expect(server.$schema).toBe(
"https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json"
);
expect(server.description.length).toBeLessThanOrEqual(100);
expect(server.repository.url).toBe(pkg.repository.url);
});
});
22 changes: 9 additions & 13 deletions src/lib/localstack/localstack.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
LOCALSTACK_BASE_URL,
} from "../../core/config";
import { httpClient, HttpError } from "../../core/http-client";
import { type DeployedResource, parseResourcesNdjson, resourcesQuery } from "./state-inspect.logic";

export type ApiResult<T> =
{ success: true; data: T } | { success: false; message: string; statusCode?: number };
Expand Down Expand Up @@ -286,23 +287,18 @@ export class StateManagementApiClient {
return { success: true, data: undefined };
}

async inspectState(): Promise<ApiResult<unknown>> {
/** Deployed resources, from `GET /_localstack/resources` (see state-inspect.logic.ts) */
async inspectState(services: string[] = []): Promise<ApiResult<DeployedResource[]>> {
const result = await this.requestResponse(`/_localstack/resources${resourcesQuery(services)}`, {
method: "GET",
});
if (!result.success) return result;
try {
const data = await httpClient.request<unknown>("/_localstack/pods/state/metamodel", {
method: "GET",
});
return { success: true, data };
return { success: true, data: parseResourcesNdjson(await result.data.text()) };
} catch (error) {
if (error instanceof HttpError) {
return {
success: false,
message: error.body || error.message,
statusCode: error.status,
};
}
return {
success: false,
message: `Failed to communicate with LocalStack State Management API: ${error instanceof Error ? error.message : "Unknown error"}`,
message: `LocalStack returned an unexpected resource listing: ${error instanceof Error ? error.message : "Unknown error"}`,
};
}
}
Expand Down
Loading