email-mcp
Enables searching contacts, drafting, and sending emails via the Gmail API with explicit user approval required before sending.
README
Email MCP Server
A production-ready Model Context Protocol (MCP) server built with Node.js, Express, and the official MCP SDK (@modelcontextprotocol/sdk). It supports SSE transport (compatible with Zaby) and exposes tools to search contacts, draft emails, and send emails using the Gmail API.
Workflow & Business Logic
- AI Flow:
search_contact->draft_email-> Wait for User Approval ->send_email. - The AI must NEVER send an email directly without explicit user approval.
draft_emailsimply prepares the subject and body and does not interact with the Gmail API.send_emailtakes the drafted subject and body and sends it via the Gmail API.
Requirements
- Node.js (v18 or higher)
- A Google Cloud Project with the Gmail API enabled
- OAuth 2.0 Credentials (Client ID, Client Secret, Refresh Token)
1. Installing Node
Make sure Node.js is installed. You can download it from nodejs.org.
2. Installing Dependencies
Clone this repository (or copy the files) and run:
npm install
3. Creating .env
Create a .env file in the root directory by copying the .env.example:
cp .env.example .env
Fill in your Google credentials:
PORT=3000
GMAIL_CLIENT_ID=your_client_id
GMAIL_CLIENT_SECRET=your_client_secret
GMAIL_REDIRECT_URI=http://localhost:3000/oauth2callback
GMAIL_REFRESH_TOKEN=your_refresh_token
Note: You can get a refresh token using Google's OAuth2 Playground or by implementing a small auth script.
4. Running Locally
Start the development server with auto-reload:
npm run dev
Or start it normally:
npm start
The server will run on http://localhost:3000.
5. Deploying to Railway
This repository contains a railway.json for seamless deployment.
- Create an account on Railway.app.
- Click New Project -> Deploy from GitHub repo.
- Select this repository.
- Go to the Variables tab in your Railway project settings and add all the environment variables from your
.envfile. - Railway will automatically build and deploy your app. Wait for it to finish and note the public URL provided by Railway.
6. Connecting the endpoint to Zaby
Once deployed (or running locally), configure Zaby to use your MCP server.
- Type: SSE
- URL:
https://<your-railway-url>.up.railway.app/sse(orhttp://localhost:3000/ssefor local)
Zaby will automatically connect, list the tools, and make them available to the LLM.
7. Testing using Postman
To test the SSE connection manually:
- Open Postman.
- Create a new request to
GET http://localhost:3000/sse. - You should see a stream of events. The first event will usually be an
endpointevent pointing to/message. - Copy the session ID or note the POST endpoint.
- Make a
POST http://localhost:3000/messagewith a JSON-RPC request to call a tool, e.g.,{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "hello", "arguments": {} } }
8. Testing using the MCP Inspector
You can use the official MCP Inspector to test the server.
npx @modelcontextprotocol/inspector node src/index.js
Note: Since the server uses SSE, you might need an inspector that specifically supports connecting via SSE if you want to test the transport layer, but the inspector can also just run the node script using stdio if configured, though this server is hardcoded to Express SSE. For SSE testing, point the inspector to http://localhost:3000/sse.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.