Skip to content

BUG | MCP can't find localStack container, expects a constant name #10

@Benjamin-sh-ckpnt

Description

@Benjamin-sh-ckpnt

I've started working with localStack this week, after setting it up in a docker-compose file.
all the containers get a prefix name.

when I tried using the mcp, it couldn't find the running container.
after digging a bit and asking chat, it seems the issue is that the expected container name is hardcoded to be "localstack-main", and once I set the container name to that, the mcp had no issues.

file in question: src/lib/docker/docker.client.ts

  async findLocalStackContainer(): Promise<string> {
    const running = (await (this.docker.listContainers as any)({
      filters: { status: ["running"] },
    })) as Array<{ Id: string; Names?: string[] }>;

    const match = (running || []).find((c) =>
      (c.Names || []).some((n) => {
        const name = (n || "").startsWith("/") ? n.slice(1) : n;
        return name === "localstack-main";
      })
    );

    if (match) return match.Id as string;

    throw new Error("Could not find a running LocalStack container named 'localstack-main'.");
  }

this should be a configurable option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions