AWS S3 Tables MCP Server

0.0.22 · active · verified Tue Apr 14

The `awslabs-s3-tables-mcp-server` is an AWS Labs Model Context Protocol (MCP) server that enables AI assistants to interact with Amazon S3 Tables using natural language. It simplifies the management of S3-based tables by providing capabilities to create and query tables, generate tables directly from CSV files uploaded to S3, and access metadata through the S3 Metadata Table. The current version is 0.0.22, and it is part of the broader AWS Model Context Protocol ecosystem, with updates typically aligned with AWS service enhancements and MCP specification changes.

Warnings

Install

Quickstart

The `awslabs-s3-tables-mcp-server` operates as a server that AI clients connect to, rather than being directly imported for application development. The quickstart demonstrates how to initiate the server process using `uvx`, a common method for running MCP servers. Ensure AWS credentials are configured in your environment or `~/.aws/credentials` as the server will use them. The server will run indefinitely, typically interacting with AI clients via standard I/O (stdio). This example starts the server and then terminates it after capturing some initial output for demonstration purposes.

import subprocess
import os
import json

# NOTE: Ensure AWS credentials are configured (e.g., via `aws configure` or environment variables).
# The server will pick them up from the environment.
# For example:
# os.environ['AWS_ACCESS_KEY_ID'] = os.environ.get('AWS_ACCESS_KEY_ID', 'YOUR_ACCESS_KEY')
# os.environ['AWS_SECRET_ACCESS_KEY'] = os.environ.get('AWS_SECRET_ACCESS_KEY', 'YOUR_SECRET_KEY')
# os.environ['AWS_REGION'] = os.environ.get('AWS_REGION', 'us-east-1')

# 1. Define a minimal mcp_config.json content.
# This configuration tells an MCP client how to start the S3 Tables MCP server.
# In a real scenario, this file would be loaded by an AI client.
# For demonstration, we simulate running the command directly.

mcp_config_content = {
    "mcpServers": {
        "awslabs.s3-tables-mcp-server": {
            "command": "uvx awslabs.s3-tables-mcp-server --profile default --region us-east-1",
            "description": "MCP Server for Amazon S3 Tables",
            "schemas": ["file://~/.config/mcp/awslabs.s3-tables-mcp-server.json"]
        }
    }
}

# 2. To run the server directly, you would typically execute a command.
# This example shows how an AI client might configure and run it.
# For local testing, ensure 'uv' is installed (`pip install uv`).

print("Attempting to run awslabs.s3-tables-mcp-server...")
print("This server typically runs in a long-lived process and interacts with AI clients via stdio.")
print("Press Ctrl+C to stop the server if it starts successfully.")

# Example of how an MCP client would launch the server process
try:
    # The actual command might vary based on your AWS profile and region.
    # Using --allow-write is generally not recommended for quickstart without understanding implications.
    command_to_run = [
        "uvx",
        "awslabs.s3-tables-mcp-server",
        "--profile", os.environ.get('AWS_PROFILE', 'default'), # Use 'default' or actual profile
        "--region", os.environ.get('AWS_REGION', 'us-east-1'), # Use 'us-east-1' or actual region
        # Add --allow-write if you intend to enable write operations, but be cautious!
        # "--allow-write"
    ]
    
    # Starting the server in a non-blocking way for demonstration.
    # In a real setup, this would be managed by the AI client application.
    process = subprocess.Popen(command_to_run, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
    
    print("Server process started (PID: {})".format(process.pid))
    print("Output (first few lines, server runs indefinitely):")
    
    # Read some output to confirm it's running, then terminate for quickstart.
    # In a real scenario, the process would continue running and communicate via stdio.
    for _ in range(5):
        line = process.stdout.readline()
        if line:
            print(line.strip())
        else:
            break

    # For a quickstart, we often don't want a blocking server.
    # You would typically interact with this server via an AI client (e.g., Kiro, Cline).
    # For this example, we'll terminate it after a short period.
    print("\n--- Server started. Terminating quickstart process. ---")
    print("To interact, connect an AI client configured with this server.")
    process.terminate()
    process.wait(timeout=5)

except FileNotFoundError:
    print("Error: 'uvx' command not found. Please ensure 'uv' is installed and in your PATH.")
except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →