Skip to main content
Glama
README.md
# MCP Gmail Server

A server that uses model context protocol[https://modelcontextprotocol.io/] to read and create drafts of emails from Gmail.

## Project setup

### Create Oauth client and add secrets:

**Create a Google Cloud Project**
1. Go to **[https://console.cloud.google.com/](https://console.cloud.google.com/)**
2. In the top-left, open the project dropdown and click **New Project**
3. Give your project a name (e.g., *Gmail API Demo*)
4. Click **Create**
Your project is now created; make sure it’s selected in the project dropdown.

**Enable the Gmail API**
1. Go to the **API Library**:
   [https://console.cloud.google.com/apis/library](https://console.cloud.google.com/apis/library)
2. Search for **Gmail API**
3. Click it → **Enable**

**Configure OAuth 2.0 Credentials**
1. Navigate to:
   **APIs & Services → Credentials**
2. You’ll be prompted to configure the **OAuth Consent Screen** (if first time creating OAuth credentials)
3. Choose **External** if users outside your Google Workspace will use it
4. Fill in details
5. Add test users (email addresses allowed to authorize during development)
6. Save the configuration

1. Click **Create Credentials** → **OAuth client ID**
2. Choose the application type: **Desktop app** (for testing/dev)
3. Name it
4. Click **Create**

You will now receive:
* **Client ID**
* **Client Secret**
Download them as JSON for use in your code.

Save the JSON as
"client_secret_oauth_gcp.json" in the root of this project. 
(note this should be stored securely and not commited to github.)

### Install and run app

Install uv:
https://docs.astral.sh/uv/getting-started/installation/

Install dependencies with uv:
```uv sync```

Start server:
```uv run -m src.mcp_server_gmail```

### Claude desktop

Install Claude Desktop

Set `claude_desktop_config.json` file to:
```
{
  "mcpServers": {
    "gmail": {
      "command": "/Users/myname/Documents/Coding/fac-mcp-gmail-server/.venv/bin/python",
      "args": [
        "-m",
        "mcp_server_gmail"
      ],
      "env": {
        "PYTHONPATH": "/Users/myname/Documents/Coding/fac-mcp-gmail-server/src"
      },
      "cwd": "/Users/myname/Documents/Coding/fac-mcp-gmail-server"
    }
  }
}
```
Ensuring the directory paths are replaced appropriately with your local directory paths.

### Test (manual)

Go to claude desktop

Try the following:
"Get last 3 unread emails"
"Create draft emails for these" 

See `/docs/working_examples`, for examples screenshots of the mcp server

## Features
- Gmail Oauth set up
- MCP server for read and drafting emails on gmail

TDQS

B3.1/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have clearly distinct purposes: one retrieves unread emails, the other creates draft replies. No overlap or ambiguity.

Naming Consistency5/5

Both tools follow the verb_noun pattern with snake_case, consistent and predictable naming.

Tool Count2/5

With only 2 tools for a Gmail server, the surface is too thin. A typical Gmail integration would require many more operations.

Completeness1/5

The tool set is severely incomplete for email management: missing send, search, archive, delete, label management, and other essential operations.

Maintenance

ActivityInactive
ResponsivenessNo issues