S3 MCP Server

S3 MCP servers enable AI models to interact with Amazon S3 object storage, providing capabilities for file operations, metadata management, and versioning in a secure and scalable environment.

GitHub starsnpm versionnpm downloads

Overview

The MCP S3 Server enables AI models to interact directly with Amazon S3 object storage through the Model Context Protocol (MCP). It provides a standardized interface for AI to perform storage operations while maintaining security and scalability.

Official Sample:

Developed by AWS Samples

Key Features

📦

Object Storage Operations

Upload, download, and delete objects with ease

🗄️

Bucket Management

List and manage S3 buckets

🏷️

Metadata Handling

Manage object metadata for better organization

🛡️

Security & Scalability

Leverage S3's robust security and scalable infrastructure

Available Tools

Quick Reference

ToolPurposeCategory
ListBucketsList all S3 bucketsDiscovery
ListObjectsV2List objects within a bucketDiscovery
GetObjectRetrieve an object from S3Read
PutObjectUpload an object to S3Write
DeleteObjectDelete an object from S3Write

Detailed Usage

ListBuckets

Returns a list of all buckets owned by the authenticated sender of the request.

use_mcp_tool({
  server_name: "s3",
  tool_name: "ListBuckets",
  arguments: {}
});
ListObjectsV2

Returns some or all (up to 1,000) of the objects in a bucket with each request.

use_mcp_tool({
  server_name: "s3",
  tool_name: "ListObjectsV2",
  arguments: {
    Bucket: "your-bucket-name",
    Prefix: "optional-prefix/"
  }
});
GetObject

Retrieves an object from Amazon S3. Specify the full key name for the object.

use_mcp_tool({
  server_name: "s3",
  tool_name: "GetObject",
  arguments: {
    Bucket: "your-bucket-name",
    Key: "path/to/your/object.txt"
  }
});
PutObject

Uploads an object to a specified S3 bucket.

use_mcp_tool({
  server_name: "s3",
  tool_name: "PutObject",
  arguments: {
    Bucket: "your-bucket-name",
    Key: "path/to/new/object.txt",
    Body: "Content of the object"
  }
});
DeleteObject

Deletes an object from a specified S3 bucket.

use_mcp_tool({
  server_name: "s3",
  tool_name: "DeleteObject",
  arguments: {
    Bucket: "your-bucket-name",
    Key: "path/to/object/to/delete.txt"
  }
});

Installation

{
  "mcpServers": {
    "s3": {
      "command": "npx",
      "args": [
        "-y",
        "aws-s3-mcp",
        "--stdio"
      ],
      "env": {
        "AWS_REGION": "your-aws-region",
        "AWS_ACCESS_KEY_ID": "your-access-key-id",
        "AWS_SECRET_ACCESS_KEY": "your-secret-access-key",
        "S3_BUCKETS": "bucket1,bucket2"
      }
    }
  }
}

Configuration:

Replace your-aws-region, your-access-key-id, your-secret-access-key, and bucket1,bucket2 with your actual AWS credentials and desired S3 buckets.

Common Use Cases

1. Storing and Retrieving User-Generated Content

Store images, videos, and documents uploaded by users.

// Upload a user profile picture
use_mcp_tool({
  server_name: "s3",
  tool_name: "PutObject",
  arguments: {
    Bucket: "user-content-bucket",
    Key: "users/user123/profile.jpg",
    Body: "base64-encoded-image-data"
  }
});

// Retrieve a user document
use_mcp_tool({
  server_name: "s3",
  tool_name: "GetObject",
  arguments: {
    Bucket: "user-content-bucket",
    Key: "users/user123/document.pdf"
  }
});

2. Data Archiving and Backup

Automate backups of critical application data to S3.

// Upload a database backup file
use_mcp_tool({
  server_name: "s3",
  tool_name: "PutObject",
  arguments: {
    Bucket: "backup-archive-bucket",
    Key: "database/daily-backup-2023-10-27.sql",
    Body: "database-dump-content"
  }
});

3. Hosting Static Websites

Serve static website assets directly from S3.

// Upload an HTML file for a static website
use_mcp_tool({
  server_name: "s3",
  tool_name: "PutObject",
  arguments: {
    Bucket: "my-static-website",
    Key: "index.html",
    Body: "<html><body><h1>Hello S3!</h1></body></html>",
    ContentType: "text/html"
  }
});