用 Java 实现的邮件发送服务,支持 HTML 和纯文本邮件,服务器参数可配置。
接入配置
选择客户端,复制配置,再按项目文档补齐环境变量。
claude mcp add java --env MAIL_HOST='<MAIL_HOST>' --env MAIL_NAME='<MAIL_NAME>' --env MAIL_PASSWORD='<MAIL_PASSWORD>' -- java -Dspring.ai.mcp.server.stdio=true -Dlogging.pattern.console= -jar C:xxxmail-mcp-0.0.1-SNAPSHOT.jar~/.codex/config.toml
[mcp_servers.java]
command = "java"
args = ["-Dspring.ai.mcp.server.stdio=true", "-Dlogging.pattern.console=", "-jar", "C:xxxmail-mcp-0.0.1-SNAPSHOT.jar"]
env = { MAIL_HOST = "<MAIL_HOST>", MAIL_NAME = "<MAIL_NAME>", MAIL_PASSWORD = "<MAIL_PASSWORD>" }
# codex mcp add java --env MAIL_HOST='<MAIL_HOST>' --env MAIL_NAME='<MAIL_NAME>' --env MAIL_PASSWORD='<MAIL_PASSWORD>' -- java -Dspring.ai.mcp.server.stdio=true -Dlogging.pattern.console= -jar C:xxxmail-mcp-0.0.1-SNAPSHOT.jar~/.cursor/mcp.json
{
"mcpServers": {
"java": {
"command": "java",
"args": [
"-Dspring.ai.mcp.server.stdio=true",
"-Dlogging.pattern.console=",
"-jar",
"C:xxxmail-mcp-0.0.1-SNAPSHOT.jar"
],
"env": {
"MAIL_HOST": "<MAIL_HOST>",
"MAIL_NAME": "<MAIL_NAME>",
"MAIL_PASSWORD": "<MAIL_PASSWORD>"
}
}
}
}.vscode/mcp.json
{
"servers": {
"java": {
"type": "stdio",
"command": "java",
"args": [
"-Dspring.ai.mcp.server.stdio=true",
"-Dlogging.pattern.console=",
"-jar",
"C:xxxmail-mcp-0.0.1-SNAPSHOT.jar"
],
"env": {
"MAIL_HOST": "<MAIL_HOST>",
"MAIL_NAME": "<MAIL_NAME>",
"MAIL_PASSWORD": "<MAIL_PASSWORD>"
}
}
}
}~/.gemini/settings.json
{
"mcpServers": {
"java": {
"command": "java",
"args": [
"-Dspring.ai.mcp.server.stdio=true",
"-Dlogging.pattern.console=",
"-jar",
"C:xxxmail-mcp-0.0.1-SNAPSHOT.jar"
],
"env": {
"MAIL_HOST": "<MAIL_HOST>",
"MAIL_NAME": "<MAIL_NAME>",
"MAIL_PASSWORD": "<MAIL_PASSWORD>"
}
}
}
}claude_desktop_config.json
{
"mcpServers": {
"java": {
"command": "java",
"args": [
"-Dspring.ai.mcp.server.stdio=true",
"-Dlogging.pattern.console=",
"-jar",
"C:xxxmail-mcp-0.0.1-SNAPSHOT.jar"
],
"env": {
"MAIL_HOST": "<MAIL_HOST>",
"MAIL_NAME": "<MAIL_NAME>",
"MAIL_PASSWORD": "<MAIL_PASSWORD>"
}
}
}
}.trae/mcp.json
{
"mcpServers": {
"java": {
"command": "java",
"args": [
"-Dspring.ai.mcp.server.stdio=true",
"-Dlogging.pattern.console=",
"-jar",
"C:xxxmail-mcp-0.0.1-SNAPSHOT.jar"
],
"env": {
"MAIL_HOST": "<MAIL_HOST>",
"MAIL_NAME": "<MAIL_NAME>",
"MAIL_PASSWORD": "<MAIL_PASSWORD>"
}
}
}
}需要的环境变量
MAIL_HOSTMAIL_NAMEMAIL_PASSWORD
把占位值换成你自己的密钥;不要把密钥提交到代码仓库。