Java -For-SMTP-Mailing
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.
claude mcp add --transport stdio rayenmalouche-java-mcp-server-for-smtp-mailing java -jar <FULL_PATH_TO_PROJECT>/target/RayenMalouche-0.0.1-SNAPSHOT.jar --sse \ --env JAVA_HOME="<JAVA_HOME_PATH>"
How to use
This MCP server provides email sending capabilities via SMTP using a Java-based MCP server that can communicate over STDIO, Server-Sent Events (SSE), and a Streamable HTTP transport. It exposes a send-email tool for MCP clients and also offers REST endpoints for testing and health checks. You can connect MCP clients such as Claude Desktop or MCP Inspector to the server through the supported transports or use the REST API to validate email sending flows. The SMTP configuration targets Gmail by default, but the setup supports other SMTP providers by adjusting the SMTP host, port, and TLS settings in the Java configuration. The included REST endpoints enable quick health checks and basic email sending tests, helpful for automation and testing workflows.
How to install
Prerequisites:
- Java 21+ JDK
- Maven 3.6+
- Access to an SMTP server (e.g., Gmail with app-specific password) or another SMTP provider
Installation steps:
- Clone the repository
git clone https://github.com/RayenMalouche/Java-MCP-Server-For-SMTP-Mailing.git
cd Java-MCP-Server-For-SMTP-Mailing
- Configure email settings Edit the SMTP configuration in the application source or properties as shown in the README, for example:
// SMTP Configuration - Update these values
private static final String SMTP_USERNAME = "your-email@gmail.com";
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;
- Build the project
mvn clean compile
mvn clean package -DskipTests # builds the jar without tests
# or to run tests
#mvn clean package
- Run the server (example for STDIO transport)
java -jar target/RayenMalouche-0.0.1-SNAPSHOT.jar --stdio
- Verify transports
- For SSE:
java -jar target/RayenMalouche-0.0.1-SNAPSHOT.jar --sse
- For Streamable HTTP:
java -jar target/RayenMalouche-0.0.1-SNAPSHOT.jar --streamable-http
- Optional: integrate with MCP clients using the provided configuration examples in the README (Claude Desktop/MCP Inspector) by specifying the Java path and the built jar path.
Additional notes
Tips and considerations:
- Ensure your SMTP credentials are secured; use app passwords or environment variables where possible.
- If you enable TLS, confirm the SMTP host and port match your provider's requirements (e.g., Gmail: smtp.gmail.com:587 with TLS).
- The MCP CLI/Inspector can test all three transports; use the appropriate command to validate connectivity.
- The server supports health checks via REST endpoints; monitor endpoints under /health or similar paths described in the API reference.
- If you encounter port conflicts, configure the SSE or HTTP transports to listen on different ports where applicable.
- When deploying in CI, consider injecting SMTP credentials via environment variables and avoiding hard-coded secrets.
Related MCP Servers
remote
Remote MCP Server that securely connects Enterprise context with your LLM, IDE, or agent platform of choice.
awesome-remote s
A curated list of Hosted & Managed Model Context Protocol (MCP) Servers accessible via a simple URL endpoint.
ContextPods
Model Context Protocol management suite/factory. An MCP that can generate and manage other local MCPs in multiple languages. Uses the official SDKs for code gen.
arch
Arch Linux MCP (Model Context Protocol)
mcp-meme-sticky
Create AI generated memes using MCP Meme Sticky. Can converted generated memes into stickers for Telegram or WhatsApp (WA coming soon). ✨ no APIs required ✨.
SchemaCrawler-AI
Free database schema discovery and comprehension tool