Skip to main content
Glama
pavankrishna813

email-mcp

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.

-
license - not tested
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pavankrishna813/email-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server