aws / aws/aws-toolkit-vscode

Amazon Q MCP containers remain running after VS Code close despite `--rm` flag

Open
#7,894 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
2k
Forks
807
Avg merge
10h 12m
Merged PRs (30d)
7

Description

## Describe the bug
When using Amazon Q in VS Code with Managed Compute Plane (MCP) integration (servers: AWS Documentation, Terraform, Atlassian), the extension starts a Docker container every time VS Code is opened.
In `default.json`, each MCP configuration already includes the `--rm` flag in the `docker run` command, e.g.:

```json
"aws_documentation": {
"command": "docker",
"disabled": false,
"timeout": 60000,
"args": [
"run",
"--rm",
"--interactive",
"--env", "FASTMCP_LOG_LEVEL=ERROR",
"--env", "AWS_DOCUMENTATION_PARTITION=aws",
"--init",
"mcp/aws-documentation:latest"
]
}
```

However, these containers are **never stopped** when closing VS Code, meaning the `--rm` flag is never triggered.
As a result, multiple duplicate containers accumulate and remain running indefinitely.

## To Reproduce
1. Configure MCP servers (AWS Documentation, Terraform, Atlassian) in Amazon Q extension for VS Code.

2. Open VS Code — a container `amazon-q-mcp-*` starts running.

3. Close VS Code.

4. Run:

```bash
docker ps -a
```

The container is still running.

5. Repeat steps 2–4 — multiple duplicates appear.

## Expected behavior
If `--rm` is used, containers should stop when the corresponding VS Code session ends, so they are removed automatically.
If stopping them automatically is not possible, the extension should at least offer a cleanup option.

## Environment
**OS:** macOS 15.6 (Apple Silicon M3)

**VS Code version:** 1.103.1

**AWS Toolkit for VS Code version:** 3.71.0

**Amazon Q version:** 1.89.0

**Docker Desktop version:** 4.43.2 (199162)

## Additional context
The issue is not the lack of `--rm`, but that containers are never stopped.
This leads to unnecessary CPU and memory usage over time, and requires manual cleanup of multiple lingering containers.

Contributor guide

Open the contributing guide

Research direction

Start with the MCP configurations in default.json and reproduce the lifecycle by opening and closing VS Code, then inspect docker ps -a before and after shutdown. Trace how the AWS Documentation, Terraform, and Atlassian MCP containers are launched and handled when the session ends. Done means containers stop and are removed on close, or a cleanup option is available.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, docker, typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.