Use AI Agent and Model Context Protocol with AmazonSES

Applications of AI


Amazon Simple Email Service (Amazon SES) offers a cloud-based email solution that enables businesses to send emails more efficiently and at scale. Its powerful and scalable platform allows organizations from startups to global brands to send massive personalized email communications while maintaining excellent delivery potential and performance.

Amazon SES caters to a wide range of users, from developers and technical marketing experts to business communicators. In addition to providing robust programmatic access via APIs and SMTP protocols, Amazon SES offers a comprehensive web console and intuitive dashboard that can be accessed by users of technical backgrounds. Historically, navigating email workflows and configuring advanced email capabilities in Amazon SES requires specialized knowledge and provides a learning curve for new users. As seen in many other areas, today's AI tools can provide a more intuitive way to manage Amazon SES and get the most out of your email communications. However, we found that these AI tools often produce sometimes inconsistent results as a result of the underlying large-scale language model (LLM) training data.

Recognizing the need for specialized services and AI-friendly Amazon SES solutions, SESV2 MCP server, Sample Model Context Protocol (MCP) for Amazon SES. We integrated the SESV2 MCP server sample with the Amazon SES V2 API to provide more accurate and reliable AI-assisted usage, management, and configuration of Amazon SES.

MCP is an open protocol that allows seamless integration between integrated development environments (IDEs) with AI or AI assistants, enhancing AI capabilities and enabling Amazon SES to be used using natural language. For more information, see Github Repo.

We released a sample SESV2 MCP server on GitHub and invited current and prospective customers to experiment in a non-production environment. You can use it with AI tools to consider how you can send emails using AI in AMAMON SES, check configurations, and check delivery. I'm interested in learning how to use AI tools and SESV2 MCP servers to test email sending on various services or applications. I'm also curious if new customers find it useful when configuring and learning Amazon SES services. No matter how you use it, you are keen to give feedback, comment and contribute through issues in the GitHub project.

Solution overview

You can use the SESV2 MCP server sample using an AI assistant application like Anthropic's Claude Desktop. It can also be integrated into Amazon Q Developers, Amazon Q Command Line, MCP-compatible Agent AI Coding Assistants such as Cline, Cursor, and Windsurf. When used as an AI coding assistant, the SESV2 MCP server sample helps developers add Amazon SES email functionality to applications and services using plain natural language prompts. See Vibe Coding Tips and Tips for AWS recommendations on how to improve your atmosphere coding experience.

After you configure the sample and authenticate with your AWS credentials, you can use natural language with your selected AI tool. For example, an email marketing manager might want to ask Anthropic's Claude Desktop: “Please provide the status of your SES account's verified identity and provide recommendations to improve delivery potential.” Those new to Amazon SES can ask the Amazon Q CLI to “Create a new Amazon SES configuration set up for your Octank.com ID and enable it for bounces and publishing events for complaints.” Similarly, developers of AI-enabled restaurant reservations applications will be saying “We need to send an email confirmation for our customers' online bookings. Can we take a walk along the way to add this feature to our app using our SES account?”

As you can see from these examples, it's helpful to know a little about email and Amazon SES in general with the help of AI tools and examples of SESV2 MCP servers, but you don't have to be an expert in email or Amazon SES. A combination of creativity, AI tools, and the SESV2 MCP server sample allows non-developers to create, test and monitor Amazon SES workflows using natural language.

The sample release of the SESV2 MCP server uses an open source Smithy Java project that is still in development. Therefore, the SESV2 MCP server is considered a sample and is not recommended for use for production purposes. If a stable version is available, we may update this post and the GitHub repository accordingly.

Prerequisites

To follow the example use case, make sure the following prerequisites are set:

  • AWS credentials with appropriate permissions.
  • MCP-compatible LLM clients (such as Anthropic's Claude Desktop, Cline, Amazon Q CLI, Cursor). This post uses the Amazon Q Developer CLI. For installation instructions, see Installing Amazon Q on the command line.
  • Java 21 (or later) runtime (required by Smithy Java).
  • Access to Github.
  • git is installed locally. See Install Git for instructions.

Best Practices for Using MCP

To maximize the benefits of MCP-assisted development while maintaining security and code quality, we recommend following guidelines:

  • Always check the generated code for security impact before deployment
  • Use MCP servers as an accelerator rather than as an alternative to developer judgment and expertise
  • Update your MCP server with the latest AWS security best practices
  • Follow the principle of least privilege when configuring AWS credentials
  • Run the security scan tool with the generated infrastructure code

Configure the AWS CLI

Use the following command to configure the AWS Command Line Interface (AWS CLI) to AMAZON SES account and AWS credentials for the AWS Region:

aws configure

Clone and build a GitHub repository locally

To use macOS or Linux, use the following command to clone and build the GitHub repository:

git clone https://github.com/aws-samples/sample-for-amazon-ses-mcp.git
cd sample-for-amazon-ses-mcp
./build.sh

For Windows, use the following command:

git clone https://github.com/aws-samples/sample-for-amazon-ses-mcp.git
cd sample-for-amazon-ses-mcp
.\build.bat

Copy the absolute path to the .jar file (JAR_PATH_FROM_BUILD_OUTPUT). This is printed at the end of the build script.

//sample-for-amazon-ses-mcp/artifacts/sample-for-amazon-ses-mcp-all.jar

Configure the AI ​​tools you want to use SESv2 MCP Server

Once the build is complete, add it SESv2 MCP Server For AI Tool MCP configuration:

{
  "mcpServers": {
    "sesv2-mcp-server": {
      "command": "java",
      "args": [
        "-jar",
        "JAR_PATH_FROM_BUILD_OUTPUT"
      ]
    }
  }
}

See MCP Configuration for configuration instructions. See the Claude Desktop MCP Configuration Guide for setup instructions.

Once you have built your SESV2 MCP server and configured your AWS credentials, you are ready to interact with Amazon SES. Keep in mind that effective and thoughtful prompts are important for successful AI-assisted development. For more information about vibe coding, see Vibe coding tips and tips.

Examples of use cases

This section provides some guided examples of interacting with Amazon SES using the Amazon Q Developer CLI. Experiment your use cases and share your comments and ideas through issues with GitHub projects. Do not disclose personal, commercially sensitive or confidential information.

Get information, recommendations, and configuration for your Amazon SES account

Open the AI ​​tool. In these examples, you use the MacOS port to start a chat session with the Amazon Q CLI.

q chat

It turns out to be useful to provide some guidance to AI tools.

You're connected to the SESv2 MCP Server and have access to the AWS SESv2 APIs.

Ask the Amazon Q CLI about the SES email identity for your AWS account:

Tell me about the identities in my account, and also if the account is in the SES sandbox?

Amazon Q CLI requests permission to use the SESV2 MCP server (provides the SESV2 API for the Amazon Q CLI ListEmailIdentities and GetAccount) Query your AWS SES account and reply with a detailed summary.

Ask the Amazon Q CLI if there are recommendations related to improving the delivery potential of your Amazon SES account.

Do you have any recommendations to improve email deliverability for my SES account?

Amazon Q CLI uses a SESV2 MCP server (provides the SESV2 API for the CLI ListRecommendations) Query your Amazon SES account and reply with a detailed summary.

Ask the Amazon Q CLI to set up AmazonSES click tracking for one of your domains. I found it helpful to remind the CLI that I have access to additional knowledge of the AWS Services API. We also recommend that you avoid inventing APIs that do not have AI tools.

You also have access to other AWS service APIs via the AWS CLI and your general knowledge, but you may only use known, documented APIs - do not invent or create any APIs or commands.
Set up Amazon SES click tracking with CloudWatch integration for the domain  to monitor email metrics. Use Amazon's default tracking domain (no SSL or https) for the click tracking to ensure immediate functionality without requiring custom domain setup. Include all necessary configuration steps and verify the setup works correctly. Create a test HTML email to  from  with subject "Testing SES click tracking". Create an HTML (with fallback to text) body with links and short descriptions taken from the public AWS webpages for Amazon SES, AWS End User Messaging and Amazon Connect. 

Send an email with your Amazon SES account

Using Amazon SES knowledge from SESV2 MCP server and permissions to use Amazon SES accountsaws configure), AI tools can be used to create and send emails using Amazon SES.

If your Amazon SES account is in the Amazon SES sandbox, you are limited to sending and receiving emails from verified email addresses. It is also limited to 200 messages in 24 hours. For more information about Amazon SES sandboxes, see Production Access Requests (Moving from Amazon SES Sandbox). If you are in the sandbox, you can simply ask “You can check your email address and ask.” . ”

Ask the Amazon Q CLI to send a test email with a sample HTML body.

Send a test email to  from . Set the from email display name to "MCP testing". Make the email subject "Test sending an email via SES MCP". Use the information found on the Amazon SES website to create an HTML message body with a few sentences and bullet points about SES. Provide a text version of the message body in case of fallback.

Please check the email that will receive the response.

You can become creative and ask Amazon Q CLI to create a formatted email template with personalization, using a simple table with email recipients, purchased products, and postcodes.

Use the table below to send each person in the table an html formatted (with fallback) email message. 
-- table --
email,name,product,zipcode
,Alice,an umbrella,98101
,Bob,lots of sunscreen,10001
-- end table --
Use the template below. Create a 5-day weather forecast graphic similar to popular weather app graphics based on estimated weather for their ZIP code.
-- template --
"Hi {{name}}, thanks for buying {{product}}; it looks like you'll need it soon based on the 5-day weather forecast for your local area: <5-day weather forecast graphic>.

As demonstrated, when you have AI tools and SESV2 MCP server samples, you don't need to be a veteran developer to create and test Amazon SES workflows.

Conclusion

The SESV2 MCP Server Sample democratizes the ability to configure, manage and create sophisticated email automation workflows with Amazon SES.

The examples and guidance in this post show how even newcomers can use AI tools such as the Amazon Q CLI to test the configuration, monitoring and sending of emails using Amazon SES using natural language. More technical users, including developers, can use the SESV2 MCP server sample to build and test intelligent email applications using Amazon SES, or to test the construction of Amazon SES to send to their own applications.

I hope you will try out the SESV2 MCP server sample to provide your thoughts and feedback and contribute to your project through issues with GitHub projects.

Additional resources



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *