And this is the direct URL to the console:
https://lightsail.aws.amazon.com/ls/webapp/home/containers
AWS CLI
The AWS CLI provides a command line tool to directly access AWS services from your current environment. Full details on the CLI are available here:
Install Docker, AWS CLI, and the Lightsail Control plugin for containers
Lightsail Control Plugin
The Lightsail Plugin allows the AWS CLI tools to interact with Lightsail. The full GitHub repo is available here:
GitHub - aws/lightsailctl: Amazon Lightsail CLI Extensions
Where do I start?
The strategy for starting MCP development is a incremental step by step approach.
First, the basic development environment is setup with the required system variables, and a working Gemini CLI configuration.
Then, a minimal Hello World Style Python MCP Server is built with HTTP transport. This server is validated with Gemini CLI in the local environment.
This setup validates the connection from Gemini CLI to the local process via MCP. The MCP client (Gemini CLI) and the Python MCP server both run in the same local environment.
Next- the MCP server is wrapped in a container with docker and deployed to Amazon Lightsail. This remote deployment is validated with Gemini CLI running as a MCP client.
Setup the Basic Environment
At this point you should have a working Python interpreter and a working Gemini CLI installation. The next step is to clone the GitHub samples repository with support scripts:
cd ~
git clone https://github.com/xbill9/gemini-cli-aws
Then run init.sh from the cloned directory.
The script will attempt to determine your shell environment and set the correct variables:
cd gemini-cli-aws
source init.sh
If your session times out or you need to re-authenticate- you can run the set_env.sh script to reset your environment variables:
cd gemini-cli-aws
source set_env.sh
Variables like PROJECT_ID need to be setup for use in the various build scripts- so the set_env script can be used to reset the environment if you time-out.
Hello World with HTTP Transport
One of the key features that the standard MCP libraries provide is abstracting various transport methods.
The high level MCP tool implementation is the same no matter what low level transport channel/method that the MCP Client uses to connect to a MCP Server.
The simplest transport that the SDK supports is the stdio (stdio/stdout) transport — which connects a locally running process. Both the MCP client and MCP Server must be running in the same environment.
The HTTP transport allows the MCP client and server to run in the same environment or distributed over the Internet.
The connection over HTTP will look similar to this:
mcp.run(
transport="http",
host="0.0.0.0",
port=port,
)
Running the Python Code
First- switch the directory with the Python MCP sample code:
cd ~/gemini-cli-aws/mcp-lightsail-python-aws
Refresh the AWS credentials:
xbill@penguin:~/gemini-cli-aws/mcp-lightsail-python-aws$ aws login --remote
xbill@penguin:~/gemini-cli-aws/mcp-lightsail-python-aws$ source save-aws-creds.sh
Exporting AWS credentials...
Successfully saved credentials to .aws_creds
The Makefile will now automatically use these for deployments.
Run the deploy version on the local system:
xbill@penguin:~/gemini-cli-aws/mcp-lightsail-python-aws$ make deploy
Building the Docker image...
[+] Building 1.3s (10/10) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
You can validate the final result by checking the messages:
Image"mcp-server-image"registered.Refertothisimageas":mcp-lightsail-python-aws.mcp-server-image.3"indeployments.CreatinganewdeploymentforLightsailContainerService...{"containerService":{"containerServiceName":"mcp-lightsail-python-aws","arn":"arn:aws:lightsail:us-east-1:106059658660:ContainerService/d6fd2d6e-6648-4b0e-8b64-de3bbf0deb14","createdAt":"2026-03-13T14:32:47-04:00","location":{"availabilityZone":"all","regionName":"us-east-1"},
Once the container is deployed:
xbill@penguin:~/gemini-cli-aws/mcp-lightsail-python-aws$make status
Checking AWS Lightsail service status for mcp-lightsail-python-aws...
--------------------------------------------
| GetContainerServices |
+-------------+--------+-----------+-------+
| Deployment | Power | State | URL |
+-------------+--------+-----------+-------+
| ACTIVE | nano | RUNNING | None |
+-------------+--------+-----------+-------+
You can then get the endpoint:
xbill@penguin:~/gemini-cli-aws/mcp-lightsail-python-aws$make endpoint
https://mcp-lightsail-python-aws.6wpv8vensby5c.us-east-1.cs.amazonlightsail.com/
Gemini CLI settings.json
Once you have the deployed endpoint — update the Gemini CLI MCP settings:
{"mcpServers":{"aws-lightsail-python":{"httpUrl":"https://mcp-lightsail-python-aws.6wpv8vensby5c.us-east-1.cs.amazonlightsail.com/mcp"}}}
Remote MCP Server Testing
Restart Gemini CLI and check for the new MCP tools:
xbill@penguin:~/gemini-cli-aws/mcp-lightsail-python-aws$gemini
▝▜▄ Gemini CLI v0.33.1
▝▜▄
▗▟▀ Logged in with Google /auth
▝▀ Gemini Code Assist Standard /upgrade
? for shortcuts
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
shift+tab to accept edits
3 GEMINI.md files | 2 MCP servers
>/mcp list
Configured MCP servers:
🟢 aws-lightsail-python - Ready (1 tool)
Tools:
- mcp_aws-lightsail-python_greet
Then the remote MCP tool in Lightsail can be called:
>greet Hello Lightsail!
✦ I will call the greet tool with the message "Hello Lightsail!".
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Action Required │
│ │
│ ? greet (aws-lightsail-python MCP Server) {"param":"Hello Lightsail!"} │
│ │
│ ... first 4 lines hidden (Ctrl+O to show) ... │
│ (press Ctrl+O to expand MCP tool details) │
│ Allow execution of MCP tool "greet" from server "aws-lightsail-python"? │
│ │
│ 1. Allow once │
│ 2. Allow tool for this session │
│ 3. Allow all server tools for this session │
│ ●くろまる 4. Allow tool for all future sessions │
│ 5. No, suggest changes (esc) │
│ │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ greet (aws-lightsail-python MCP Server) {"param":"Hello Lightsail!"} │
│ │
│ Hello Lightsail! │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ The greet tool returned: "Hello Lightsail!"
Gemini CLI can also summarize the deployment:
> summarize the AWS lightsail deployment
✦ I will summarize the AWS Lightsail deployment by analyzing the Makefile and project documentation.
AWS Lightsail Deployment Summary
The project is a Python-based MCP server designed to run as a containerized service on Amazon Lightsail.
1. Deployment Infrastructure
* Service Type: Amazon Lightsail Container Service.
* Transport: The server is configured to use HTTP transport, listening on port 8080.
* Containerization: Uses a Dockerfile for building the application image.
2. Deployment Workflow
The deployment is managed via a Makefile with a three-stage automated pipeline:
1. Build (make docker-build): Packages the Python MCP server into a Docker image.
2. Push (make push-lightsail): Uploads the local Docker image to the Lightsail Container Service registry using
the lightsailctl plugin.
3. Deploy (make create-deployment): Activates the pushed image as the live version of the service.
3. Monitoring & Management
* make status: Provides a combined view of Git status and the current AWS Lightsail service state.
* make lightsail-status: Directly queries AWS to check if the container service is "Ready," "Updating," or
"Disabled."
* save-aws-creds.sh: A helper script used to manage AWS credentials specifically for the Makefile's deployment
tasks.
4. Prerequisites
Deployment requires the AWS CLI with the lightsailctl plugin installed, Docker for image creation, and valid AWS
credentials configured for the target environment.
Summary
The strategy for using Python for MCP development with Gemini CLI on Amazon Lightsail was validated with a incremental step by step approach.
A minimal HTTP transport MCP Server was started from Python source code and validated with Gemini CLI running as a MCP client in the same local environment.
This MCP server was then wrapped in a Docker container and deployed to Amazon Lightsail. The local copy of Gemini CLI was used as a MCP client to validate the connection.
This approach can be extended to more complex deployments using other MCP transports and Cloud based options.