Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

sample-building-mcp-servers-with-rust

MCP.Pizza Chef: aws-samples

This project offers sample MCP servers implemented in Rust, designed to extend AI assistants like Amazon Q with practical capabilities. It includes servers for arithmetic calculations, Amazon RDS and S3 management, and PostgreSQL database querying. These servers enable seamless integration of cloud services and databases into AI workflows, leveraging Rust's performance and safety.

Use This MCP server To

Perform basic arithmetic operations via AI assistant Manage Amazon RDS instances through MCP server Interact with Amazon S3 buckets and objects Execute queries on PostgreSQL databases Extend AI assistants with custom Rust MCP servers Integrate cloud database operations into AI workflows

README

MCP Sample

A Rust 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

Prerequisites

  • Rust and Cargo
  • AWS credentials configured for RDS and S3 operations
  • An MCP-compatible AI assistant (like Amazon Q)

Installation

Clone the repository and build the project:

git clone <repository-url>
cd mcp-sample
cargo build

Usage

Build the executable files for each server:

# Build the calculator server
cargo build --release --bin calculator_server

# Build the RDS server
cargo build --release --bin rds_server

# Build the S3 server
cargo build --release --bin s3_server

# Build the PostgreSQL server
cargo build --release --bin postgresql_server

After building, you can run each server independently:

# Run the calculator server
./target/release/calculator_server

# Run the RDS server
./target/release/rds_server

# Run the S3 server
./target/release/s3_server

# Run the PostgreSQL server (requires a connection string)
./target/release/postgresql_server "postgresql://username:password@hostname:port/database"

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:

{
  "mcpServers": {
    "calculator": {
      "command": "/path/to/mcp-sample-servers-rust/target/release/calculator_server",
      "args": []
    },
    "s3": {
      "command": "/path/to/mcp-sample-servers-rust/target/release/s3_server",
      "args": []
    },
    "rds": {
      "command": "/path/to/mcp-sample-servers-rust/target/release/rds_server",
      "args": []
    },
    "postgres": {
      "command": "/path/to/mcp-sample-servers-rust/target/release/postgresql_server",
      "args": ["postgresql://username:password@hostname:port/database"]
    }
  }
}

Replace /path/to/mcp-sample-servers-rust/ with the actual path to your built binaries. 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 and subtraction.

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.

Dependencies

  • rmcp: Rust implementation of the Model Context Protocol
  • AWS SDK for Rust (aws-sdk-s3, aws-sdk-rds, aws-config)
  • Tokio for async runtime
  • Serde for serialization/deserialization
  • tokio-postgres for PostgreSQL database connectivity

sample-building-mcp-servers-with-rust FAQ

How do I build the sample MCP servers?
Clone the repository and use Cargo to build each server with commands like 'cargo build --release --bin calculator_server'.
What prerequisites are needed to run these MCP servers?
You need Rust and Cargo installed, AWS credentials configured for RDS and S3, and an MCP-compatible AI assistant like Amazon Q.
Can these MCP servers be used with AI assistants other than Amazon Q?
Yes, they are compatible with any MCP-compliant AI assistant.
What functionalities do the sample MCP servers provide?
They include a calculator for arithmetic, RDS and S3 servers for AWS resource management, and a PostgreSQL server for database queries.
How do these servers enhance AI assistant capabilities?
By exposing cloud and database operations as structured, callable services within the MCP framework.
Is it necessary to have AWS credentials to use the RDS and S3 servers?
Yes, valid AWS credentials are required to interact with Amazon RDS and S3 services.
Are there any security considerations when using these MCP servers?
Yes, ensure AWS credentials are securely managed and access is scoped appropriately to prevent unauthorized operations.
Can I extend or customize these sample servers?
Yes, since they are implemented in Rust, you can modify or add new MCP servers to fit your needs.