Java Mcp Server For Smtp Mailing

by RayenMalouche

304 downloads Not rated yet
GitHub

About

A Model Context Protocol (MCP) server (using java sdk 0.11.0) that provides email sending capabilities through SMTP integration. This server acts as a bridge between MCP-compatible AI assistants (like Claude Desktop) and email services.

Explore

- Rich Email Formatting: Support for HTML and plain text emails
- Attachment Support (planned): File attachment capabilities
- Email Templates (planned): Reusable email templates
- Retry Mechanism: Automatic retry on failed email deliveries
- Rate Limiting: Built-in protection against spam and overuse
- Comprehensive Logging: Detailed logs for debugging and monitoring

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Java Mcp Server For Smtp Mailing
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

- Java 21 or higher
- Maven 3.6+
- Gmail account with app-specific password (or other SMTP server credentials)
- MCP Client (Claude Desktop, custom clients, or MCP Inspector for testing)

Edit the SMTP configuration in Application.java:

// SMTP Configuration - Update these values
private static final String SMTP_USERNAME = "[email protected]";
private static final String SMTP_PASSWORD = "your-app-password";
private static final String SMTP_HOST = "smtp.gmail.com";
private static final int SMTP_PORT = 587;
private static final boolean SMTP_TLS_ENABLED = true;
private static final boolean SMTP_SSL_ENABLED = false;

1. Enable 2-factor authentication on your Gmail account
2. Go to Google Account settings > Security > App passwords
3. Generate a new app password for this application
4. Use the generated password in the SMTP_PASSWORD field

Symptoms: Email sending fails with authentication error

Solutions:
- Ensure you're using an app-specific password for Gmail (not your account password)
- Verify 2FA is enabled on your Google account
- Double-check the username and password in Application.java
- Test SMTP credentials with a simple email client

Debug Steps:


java
// Example environment variable usage
private static final String SMTP_USERNAME = System.getenv("SMTP_USERNAME");
private static final String SMTP_PASSWORD = System.getenv("SMTP_PASSWORD");

1. Fork the repository
2. Clone your fork:
bash
git clone https://github.com/yourusername/Java-MCP-Server-For-SMTP-Mailing.git
3. Create a feature branch:
bash
git checkout -b feature/amazing-feature
```
4. Make your changes and test thoroughly
5. Test with all transport protocols
6. Submit a pull request

- Documentation: Check this README and inline code comments
- Examples: See the related projects for integration examples
- Community: Open a GitHub issue for community support
- Enterprise: Consider professional support for production deployments

---

Made with ❤️ for the MCP ecosystem

This server bridges the gap between AI applications and email communication, enabling powerful automation workflows and seamless user notifications.

to

(required): Recipient email address

subject

(required): Email subject line

body

(required): Email body content

cc

(optional): CC email address

bcc

(optional): BCC email address

After setting up Claude Desktop integration, you can test by asking Claude:

"Send an email to [email protected] with the subject 'Meeting Reminder' and body 'Don't forget about our meeting tomorrow at 2 PM.'"

Claude will use the MCP tool to send the email through your configured SMTP server.

Parameters:
- to (required): Recipient email address
- subject (required): Email subject line
- body (required): Email body content
- cc (optional): CC email address
- bcc (optional): BCC email address

Example Usage in MCP Client:

{
"tool": "send-email",
"parameters": {
"to": "[email protected]",
"subject": "Hello from MCP",
"body": "This email was sent via Model Context Protocol!",
"cc": "[email protected]"
}
}

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "java mcp server for smtp mailing": {
            "smtp-email-server": {
                "command": "<JAVA_EXECUTABLE_PATH>",
                "args": [
                    "-jar",
                    "<FULL_PATH_TO_PROJECT>\\target\\RayenMalouche-0.0.1-SNAPSHOT.jar",
                    "--stdio"
                ],
                "env": {
                    "JAVA_HOME": "<JAVA_HOME_PATH>"
                }
            }
        }
    }
}

McpServers

{
    "smtp-email-server": {
        "command": "<JAVA_EXECUTABLE_PATH>",
        "args": [
            "-jar",
            "<FULL_PATH_TO_PROJECT>\\target\\RayenMalouche-0.0.1-SNAPSHOT.jar",
            "--stdio"
        ],
        "env": {
            "JAVA_HOME": "<JAVA_HOME_PATH>"
        }
    }
}

Example: /home/username/Java-MCP-Server-For-SMTP-Mailing


Java Executable Path
Windows:
cmd where java
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.