Lists and manages Amazon RDS instances in specified regions, allowing interaction with database resources.
Manages S3 buckets and objects, including listing buckets by region, enabling file storage and retrieval operations.
Connects to PostgreSQL databases and executes read-only queries, lists tables, and provides schema information.
MCP Sample
A Python implementation of Model Context Protocol (MCP) servers for extending AI assistant capabilities.
Overview
This project provides sample MCP servers that can be used with Amazon Q or other MCP-compatible AI assistants. The servers implement various functionalities:
- Calculator Server: Performs basic arithmetic operations
- RDS Server: Interacts with Amazon RDS instances
- S3 Server: Manages Amazon S3 buckets and objects
- PostgreSQL Server: Connects to PostgreSQL databases and executes queries
These servers demonstrate how to build MCP servers in Python using the FastMCP framework, which provides a high-level, Pythonic interface for implementing the Model Context Protocol.
Prerequisites
- Python 3.12+
- FastMCP library
- uv (recommended Python package manager for FastMCP)
- AWS credentials configured for RDS and S3 operations (for the respective servers)
- An MCP-compatible AI assistant (like Amazon Q)
Installation
Clone the repository and install the dependencies:
We recommend using uv to install dependencies as it's faster and more reliable than pip:
Alternatively, you can use pip:
Usage
Run each server independently:
Integration with Amazon Q CLI
To integrate these MCP servers with Amazon Q CLI or other MCP-compatible clients, add a configuration like this to your .amazon-q.json
file:
Replace /path/to/sample-building-mcp-servers-with-python/
with the actual path to your project. Once configured, Amazon Q will be able to use these servers to extend its capabilities.
Server Descriptions
Calculator Server
Provides basic arithmetic operations like 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.
Understanding the Code
Each server follows a similar pattern:
- Create a FastMCP instance
- Define tools using the
@mcp.tool()
decorator - Run the server with
mcp.run()
For example, the Calculator Server looks like this:
Dependencies
- FastMCP: Python implementation of the Model Context Protocol
- boto3: AWS SDK for Python (for S3 and RDS servers)
- asyncpg: PostgreSQL client library (for PostgreSQL server)
- pydantic: Data validation and settings management
Learning More
To learn more about the Model Context Protocol and FastMCP:
- Model Context Protocol
- FastMCP Documentation
- Amazon Q Documentation
- uv Documentation - Recommended Python package manager for FastMCP
Acknowledgments
This project was inspired by sample-building-mcp-servers-with-rust, which provides a similar implementation of MCP servers using Rust. We thank the authors for their work and inspiration.
This server cannot be installed
A collection of Python-based Model Context Protocol servers that extend AI assistant capabilities with tools for calculations, AWS services (S3 and RDS), and PostgreSQL database operations.
Related MCP Servers
- -securityFlicense-qualityA Model Context Protocol server that enables AI assistants like Claude to perform Python development tasks through file operations, code analysis, project management, and safe code execution.Last updated -5Python
- -securityAlicense-qualityA streamlined foundation for building Model Context Protocol servers in Python, designed to make AI-assisted development of MCP tools easier and more efficient.Last updated -15PythonMIT License
- -securityFlicense-qualityA comprehensive Model Context Protocol server implementation that enables AI assistants to interact with file systems, databases, GitHub repositories, web resources, and system tools while maintaining security and control.Last updated -161TypeScript
- -securityFlicense-qualityA Model Context Protocol server that provides AI assistants with secure, read-only access to PostgreSQL databases while offering comprehensive tools for schema exploration, query validation, and performance optimization.Last updated -Python