- Home
- MCP servers
- Building MCP Servers With Amazon Q CLI And Python
Building MCP Servers With Amazon Q CLI And Python
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"cyanmage-building-mcp-servers-with-amazon-q-cli-and-python": {
"command": "python",
"args": [
"src/calculator_server.py"
],
"env": {
"AWS_ACCESS_KEY_ID": "AKIA...",
"AWS_SECRET_ACCESS_KEY": "secret"
}
}
}
}You can run a set of Python MCP servers that extend your AI assistant with practical capabilities like performing calculations, interacting with RDS and S3, and querying PostgreSQL. These MCP servers are designed to be easy to run locally and to integrate with an MCP-compatible client to extend your assistant’s reach.
How to use
Use an MCP-compatible client to connect to each local server. You start each server as a separate process and reference it from your MCP client configuration so your assistant can request the corresponding capability when needed.
Each server exposes a distinct capability: Calculator for arithmetic, RDS for listing and managing Amazon RDS instances, S3 for bucket and object management, and PostgreSQL for connecting to databases and running read-only queries. Your MCP client will send requests to these servers, and the servers will return results to the client.
How to install
Prerequisites you need before installing and running the servers are as follows.
- Python 3.12+
- FastMCP library
- uvx (recommended Python package manager for FastMCP)
- AWS credentials configured for RDS and S3 operations
- An MCP-compatible AI assistant (for example Amazon Q)
Clone the sample MCP servers project and install dependencies. Use the commands below to clone the repository and install dependencies with uv for speed and reliability.
git clone <repository-url>
cd sample-building-mcp-servers-with-python
Run the servers
Run each server independently from its own process.
# Run the calculator server
python src/calculator_server.py
# Run the RDS server
python src/rds_server.py
# Run the S3 server
python src/s3_server.py
# Run the PostgreSQL server (requires a connection string)
python src/postgresql_server.py "postgresql://username:password@hostname:port/database"
Integration with Amazon Q CLI
To connect these MCP servers with Amazon Q CLI or another MCP client, add the following configuration to your MCP client configuration file.
{
"mcpServers": {
"calculator": {
"command": "python /path/to/sample-building-mcp-servers-with-python/src/calculator_server.py",
"args": []
},
"s3": {
"command": "python /path/to/sample-building-mcp-servers-with-python/src/s3_server.py",
"args": []
},
"rds": {
"command": "python /path/to/sample-building-mcp-servers-with-python/src/rds_server.py",
"args": []
},
"postgres": {
"command": "python /path/to/sample-building-mcp-servers-with-python/src/postgresql_server.py",
"args": ["postgresql://username:password@hostname:port/database"]
}
}
}
Server descriptions
Calculator Server provides basic arithmetic operations such as addition, subtraction, multiplication, and division.
RDS Server lists and manages Amazon RDS instances in specified regions.
S3 Server manages S3 buckets and objects, including listing buckets by region.
PostgreSQL Server connects to PostgreSQL databases and executes read-only queries, lists tables, and provides schema information.
Available tools
sum
Calculates the sum of two numbers using the Calculator Server
list_rds
Lists available Amazon RDS instances in configured regions using the RDS Server
list_s3_buckets
Lists S3 buckets and objects by region using the S3 Server
postgres_read_only_query
Executes read-only queries against a PostgreSQL database and returns results