Content
# mcp-email-docker
An email notification service based on [Model Context Protocol (MCP)](https://github.com/modelcontext/modelcontextprotocol), supporting communication with clients via Streamable HTTP and SSE (Server-Sent Events), and sending notification emails through SMTP services. This project also supports deployment via Docker images. It is suitable for beginners to learn about MCP Server.
---
## Features
- Supports integration with MCP Client to send emails or other notifications via the MCP protocol
- ⭐️ Compatible with both the old SSE and the new Streamable HTTP protocols
- ⭐️ Supports one-click Docker deployment to remote or local environments, communicating via HTTP instead of Stdio
- The Dockerfile uses multi-stage builds and a slim Node.js environment to reduce image packaging size
---
## Directory Structure
```
.
├── package.json # Project dependencies and scripts
├── Dockerfile # Docker image build file
├── .dockerignore # Docker build ignore settings
├── tsconfig.json # TypeScript configuration
├── src/
│ ├── index.ts # Server entry point
│ ├── mcp/
│ │ └── notify.ts # MCP notification service implementation
│ └── tool/
│ └── notify.ts # Email sending utility
└── .env.example # Environment variable example
```
---
## Quick Start
### 1. Install Dependencies
```sh
npm install
```
### 2. Configure Environment Variables
Create a `.env` file in the root directory of the project with the following example content:
```
SMTP_USER=your_email_account
SMTP_PASS=your_email_smtp_authorization_code
SMTP_SERVICE=
SMTP_HOST=
PORT=
```
### 3. Start Local Development
```sh
npm run build
npm start
```
Or run directly with ts-node:
```sh
npx ts-node src/index.ts
```
---
## Docker Deployment
### 1. Build the Image
```sh
docker build -t yourname/mcp-email-docker .
```
### 2. Run the Container
```sh
docker run -p 8080:8080 \
-e SMTP_USER=your_email_account \
-e SMTP_PASS=your_email_smtp_authorization_code \
-e SMTP_SERVICE=QQ \
-e SMTP_HOST=smtp.qq.com \
yourname/mcp-email-docker
```
Or use the `.env` file:
```sh
docker run --env-file .env -p 8080:8080 yourname/mcp-email-docker
```
---
## API Description
- `GET /sse`
Establishes an SSE connection for real-time message pushing.
- `POST /messages?sessionId=xxx`
Client message sending interface, requires `sessionId`.
- `POST /mcp`
Connects to the MCP server via the Streamable HTTP protocol.
---
## MCP Email Notification Parameters
- `method`: Notification method, currently only implemented as `"email"` based on nodemailer
- `to`: Recipient's email address
- `content`: Email content
---
## Dependencies
- [@modelcontextprotocol/sdk](https://www.npmjs.com/package/@modelcontextprotocol/sdk)
- [nodemailer](https://nodemailer.com/about/)
- [zod](https://zod.dev/)
- [dotenv](https://github.com/motdotla/dotenv)
- [express](https://expressjs.com/)
---
## License
MIT
Connection Info
You Might Also Like
everything-claude-code
Complete Claude Code configuration collection - agents, skills, hooks,...
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
firecrawl
Firecrawl MCP Server enables web scraping, crawling, and content extraction.
servers
Model Context Protocol Servers
servers
Model Context Protocol Servers
Time
A Model Context Protocol server for time and timezone conversions.