email-mcp

email-mcp

Enables searching contacts, drafting, and sending emails via the Gmail API with explicit user approval required before sending.

Category
Visit Server

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

  1. AI Flow: search_contact -> draft_email -> Wait for User Approval -> send_email.
  2. The AI must NEVER send an email directly without explicit user approval.
  3. draft_email simply prepares the subject and body and does not interact with the Gmail API.
  4. send_email takes 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.

  1. Create an account on Railway.app.
  2. Click New Project -> Deploy from GitHub repo.
  3. Select this repository.
  4. Go to the Variables tab in your Railway project settings and add all the environment variables from your .env file.
  5. 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 (or http://localhost:3000/sse for 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:

  1. Open Postman.
  2. Create a new request to GET http://localhost:3000/sse.
  3. You should see a stream of events. The first event will usually be an endpoint event pointing to /message.
  4. Copy the session ID or note the POST endpoint.
  5. Make a POST http://localhost:3000/message with 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

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured