Skip to content
Get Started for Free
To improve reliability, we’ve moved to a single, authenticated LocalStack for AWS image that requires an auth token. For more details on plans and pricing, see our pricing page.

LocalStack MCP Server

The LocalStack MCP Server is a Model Context Protocol (MCP) server that connects MCP-compatible clients to your LocalStack environment. It enables AI agents to manage the full local cloud development lifecycle: starting containers, deploying infrastructure, analyzing logs, injecting chaos faults, managing state snapshots, and running AWS CLI commands, all through natural language prompts.

Before configuring the MCP server, ensure the following are installed and available on your system PATH:

The LocalStack MCP Server is published on npm as @localstack/localstack-mcp-server. The recommended approach is to let your MCP client run the server via npx, which downloads and caches the package automatically.

Choose your MCP client below for setup instructions.

Click the button below to install the LocalStack MCP Server in Cursor automatically:

Install MCP Server

After installing, open ~/.cursor/mcp.json and add the env block with your Auth Token:

{
"mcpServers": {
"localstack-mcp-server": {
"command": "npx",
"args": ["-y", "@localstack/localstack-mcp-server"],
"env": {
"LOCALSTACK_AUTH_TOKEN": "<YOUR_TOKEN>"
}
}
}
}

Restart Cursor after saving. The server appears in Cursor Settings > MCP once detected.

Connecting to a custom LocalStack endpoint

Section titled “Connecting to a custom LocalStack endpoint”

By default the MCP server connects to http://localhost:4566. If your LocalStack instance runs on a different host or port, set the following environment variables in the env block:

VariableDefaultDescription
LOCALSTACK_HOSTNAMElocalhostHostname of the LocalStack instance
LOCALSTACK_PORT4566Port of the LocalStack instance

You can also pass any LocalStack configuration variable through the env block. These are forwarded to the container when the localstack-management tool starts it.

{
"mcpServers": {
"localstack-mcp-server": {
"command": "npx",
"args": ["-y", "@localstack/localstack-mcp-server"],
"env": {
"LOCALSTACK_AUTH_TOKEN": "<YOUR_TOKEN>",
"LOCALSTACK_HOSTNAME": "my-host",
"LOCALSTACK_PORT": "4566"
}
}
}
}

The MCP server exposes the following tools that your AI agent can call. Each tool runs pre-flight checks (verifying the CLI is available, the container is running, and the Auth Token is present) and returns structured responses.

Manage the LocalStack runtime lifecycle for both the AWS emulator and the Snowflake emulator.

ParameterTypeRequiredDescription
actionstart | stop | restart | statusYesThe operation to perform
serviceaws | snowflakeNoThe stack to manage (default: aws)
envVarsRecord<string, string>NoExtra environment variables passed on start

Example prompts:

  • “Start my LocalStack container.”
  • “What’s the current status of LocalStack?”
  • “Start the Snowflake emulator.”

Deploy or destroy infrastructure on LocalStack using CDK, Terraform, SAM, or CloudFormation.

ParameterTypeRequiredDescription
actiondeploy | destroy | create-stack | delete-stackYesThe deployment operation
projectTypecdk | terraform | sam | autoNoFramework to use (default: auto, detected from project files)
directorystringYes (for deploy/destroy)Path to the project directory
variablesRecord<string, string>NoVariables passed as Terraform -var flags, CDK --context values, or SAM --parameter-overrides
stackNamestringYes (for create-stack/delete-stack)CloudFormation/SAM stack name
templatePathstringNoPath to a CloudFormation/SAM template
s3BucketstringNoS3 bucket for SAM deployments (if omitted, SAM uses --resolve-s3)
resolveS3booleanNoFor SAM deployments, whether to use --resolve-s3 when no s3Bucket is provided
saveParamsbooleanNoFor SAM deployments, whether to persist resolved parameters to samconfig.toml

Example prompts:

  • “Deploy my CDK project in the infra/ directory on LocalStack.”
  • “Destroy the Terraform deployment in ./terraform.”
  • “Deploy my SAM application in ./sam-app.”
  • “Create a CloudFormation stack named my-stack from template.yaml.”

Analyze LocalStack logs to find errors, summarize API activity, or inspect raw output.

ParameterTypeRequiredDescription
analysisTypesummary | errors | requests | logsNoType of analysis (default: summary)
linesnumberNoNumber of log lines to fetch (default: 2000)
servicestringNoFilter by AWS service name
operationstringNoFilter by API operation (used with service in requests mode)
filterstringNoKeyword filter (used with logs mode only)

Example prompts:

  • “Analyze LocalStack logs for any errors.”
  • “Show me the S3 API requests from the last 500 log lines.”
  • “Get the raw LocalStack logs filtered by ‘lambda’.”

Configure IAM enforcement and generate IAM policies from access denials in the logs.

ParameterTypeRequiredDescription
actionset-mode | analyze-policies | get-statusYesThe operation to perform
modeENFORCED | SOFT_MODE | DISABLEDYes (for set-mode)IAM enforcement level

Example prompts:

  • “Enable IAM enforcement in soft mode on LocalStack.”
  • “Analyze the logs for IAM policy violations and generate the required policies.”
  • “What’s the current IAM enforcement status?”

Inject faults and network latency into LocalStack services to test application resilience.

ParameterTypeRequiredDescription
actioninject-faults | add-fault-rule | remove-fault-rule | get-faults | clear-all-faults | inject-latency | get-latency | clear-latencyYesThe chaos operation
rulesArray<FaultRule>Yes (for inject-faults, add-fault-rule, remove-fault-rule)Fault rules to inject/modify
latency_msnumberYes (for inject-latency)Latency in milliseconds to add to all requests

Each fault rule can include:

FieldTypeDescription
servicestringTarget AWS service (e.g., s3, lambda)
regionstringTarget region (e.g., us-east-1)
operationstringTarget API operation (e.g., PutObject)
probabilitynumber (0-1)Probability of the fault triggering
error{ statusCode?: number, code?: string }Error response to return

Example prompts:

  • “Inject a 500 error for all Lambda Invoke calls in us-east-1 with 100% probability.”
  • “Add 2000ms of network latency to all LocalStack requests.”
  • “Clear all chaos faults.”

Save, load, and manage LocalStack state snapshots using Cloud Pods.

ParameterTypeRequiredDescription
actionsave | load | delete | resetYesThe state management operation
pod_namestringYes (for save/load/delete)Name of the Cloud Pod (alphanumeric, dots, hyphens, underscores; max 128 characters)

Example prompts:

  • “Save the current LocalStack state as a Cloud Pod named my-app-state.”
  • “Load the Cloud Pod my-app-state.”
  • “Reset the LocalStack state completely.”

Execute AWS CLI commands inside the running LocalStack container via awslocal.

ParameterTypeRequiredDescription
commandstringYesThe AWS CLI command to run (without the aws or awslocal prefix)

Example prompts:

  • “List all S3 buckets in LocalStack.”
  • “Describe my Lambda functions.”
  • “Query the DynamoDB table users for all items.”

The tool sanitizes input to prevent shell injection (pipes, redirects, and command chaining are blocked). If a command fails due to a service not being emulated, the tool returns a link to the relevant service coverage documentation.

Install, uninstall, list, and discover LocalStack Extensions from the marketplace.

ParameterTypeRequiredDescription
actionlist | install | uninstall | availableYesThe extensions operation
namestringYes (for install/uninstall)Extension package name (e.g., localstack-extension-typedb)
sourcestringNoGit URL to install from (alternative to name)

Example prompts:

  • “List my installed LocalStack extensions.”
  • “Browse the available extensions in the marketplace.”
  • “Install the localstack-extension-typedb extension.”
  • “Uninstall the localstack-extension-stripe extension.”

Manage cloud-hosted Ephemeral Instances for remote LocalStack testing workflows.

ParameterTypeRequiredDescription
actioncreate | list | logs | deleteYesThe ephemeral instance operation
namestringYes (for create/logs/delete)Instance name
lifetimenumberNoLifetime in minutes for the instance (only for create)
extensionstringNoExtension package to preload on the instance (only for create)
cloudPodstringNoCloud Pod name to initialize state from (only for create)
envVarsRecord<string, string>NoExtra environment variables for the instance (only for create)

Example prompts:

  • “Create an ephemeral LocalStack instance named test-env with a 60-minute lifetime.”
  • “List all my ephemeral instances.”
  • “Get the logs from the test-env ephemeral instance.”
  • “Delete the ephemeral instance named test-env.”

Search the LocalStack documentation to find guides, API references, and configuration details.

ParameterTypeRequiredDescription
querystringYesThe search query
limitnumberNoMaximum number of results to return (default: 5, max: 10)

Example prompts:

  • “Search the LocalStack docs for how to configure S3.”
  • “Find the LocalStack documentation on Cloud Pods.”

Execute SQL queries and commands against the LocalStack Snowflake emulator using the Snowflake CLI (snow).

ParameterTypeRequiredDescription
actionexecute | check-connectionYesThe operation to perform
querystringYes (for execute, if file_path not provided)SQL query to execute
file_pathstringYes (for execute, if query not provided)Absolute path to a .sql file to execute
databasestringNoSnowflake database context
schemastringNoSnowflake schema context
warehousestringNoSnowflake warehouse to use
rolestringNoSnowflake role to use

Example prompts:

  • “Check the connection to the LocalStack Snowflake emulator.”
  • “Run SELECT * FROM my_table on the Snowflake emulator.”
  • “Execute the SQL file at /path/to/setup.sql on Snowflake.”

Once your MCP client is configured, verify the setup by opening a conversation with your AI agent.

1. Start LocalStack

“Start my LocalStack container.”

The agent uses the localstack-management tool to start the container and confirms the status.

2. Deploy infrastructure

“Deploy my CDK project in the ./my-app directory.”

The agent detects the framework, runs cdklocal bootstrap and cdklocal deploy, and returns the stack outputs.

3. Verify resources

“List the Lambda functions and DynamoDB tables that were created.”

The agent runs awslocal commands inside the container and returns the results.

4. Analyze logs

“Check the LocalStack logs for any errors.”

The agent fetches recent logs and highlights any errors or warnings.

5. Save state

“Save a Cloud Pod named my-checkpoint.”

The agent persists the current LocalStack state so you can restore it later.

The following environment variables can be set in the env block of your MCP configuration:

VariableDefaultDescription
LOCALSTACK_AUTH_TOKEN (required)NoneYour LocalStack Auth Token. Required for all MCP server tools.
LOCALSTACK_HOSTNAMElocalhostHostname of the LocalStack instance
LOCALSTACK_PORT4566Port of the LocalStack instance
MAIN_CONTAINER_NAMElocalstack-mainName of the LocalStack Docker container
MCP_ANALYTICS_DISABLED0Set to 1 to disable MCP analytics

Any LocalStack configuration variable can also be passed through the env block. These are forwarded to the container when the localstack-management tool starts it.

For example, to enable debug logging and persistence:

{
"mcpServers": {
"localstack-mcp-server": {
"command": "npx",
"args": ["-y", "@localstack/localstack-mcp-server"],
"env": {
"LOCALSTACK_AUTH_TOKEN": "<YOUR_TOKEN>",
"DEBUG": "1",
"PERSISTENCE": "1"
}
}
}
}

Symptoms: The localstack-management tool reports a timeout after 120 seconds.

Solutions:

  • Ensure Docker is running on your machine.
  • Verify the LocalStack CLI is installed and on your PATH by running localstack --version.
  • Check Docker resource limits. LocalStack needs at least 2 GB of memory.
  • If you are using a custom LOCALSTACK_HOSTNAME, ensure the host is reachable.

Symptoms: The server does not appear in your client’s MCP server list.

Solutions:

  • Verify Node.js (v22+) is installed by running node --version.
  • Run npx -y @localstack/localstack-mcp-server manually in a terminal to check for errors.
  • Ensure the JSON in your MCP configuration file is valid (no trailing commas, correct key names).
  • Restart your MCP client after saving configuration changes.

Symptoms: Any tool call fails with an “Auth Token Required” error.

Solutions:

  • Confirm your LOCALSTACK_AUTH_TOKEN is set in the env block of your MCP configuration.
  • Verify the token is valid by running localstack auth show-token.
  • Ensure there are no extra spaces or quotes around the token value in your configuration file.
Was this page helpful?