gmail-mcp-server

Model Context Protocol (MCP) server for Gmail

GitHub Stars

59

User Rating

Not Rated

Favorites

0

Views

24

Forks

32

Issues

3

Installation
Difficulty
Intermediate
Estimated Time
10-20 minutes
Requirements
Python 3.6以上
Gmail APIの有効化

Installation

Installation

Prerequisites

Please specify required software and versions:
Python: 3.6 or higher
Gmail API: Enabled

Installation Steps

1. Clone Repository

bash
git clone https://github.com/jasonsum/gmail-mcp-server
cd gmail-mcp-server

2. Install Dependencies

bash
pip install -r requirements.txt

3. Gmail API Setup

Set up the Gmail API and obtain the OAuth client ID. Refer to the README for steps.

4. Start Server

bash
python server.py --creds-file-path /path/to/your/client_creds.json --token-path /path/to/your/app_tokens.json

Troubleshooting

Common Issues

Issue: Server won't start Solution: Check Python version and reinstall dependencies. Issue: Authentication error occurs Solution: Recheck OAuth settings and ensure the correct file paths are specified.

Configuration

Configuration

Basic Configuration

Gmail API Setup

You need to specify the OAuth client ID JSON file. Start the server as follows:
bash
python server.py --creds-file-path /path/to/your/client_creds.json --token-path /path/to/your/app_tokens.json

Advanced Configuration

Security Settings

Store OAuth keys in a secure location with appropriate access permissions.
Manage the token file path securely.

Performance Tuning

Adjust timeout and retry settings as needed.

Examples

Examples

Basic Usage

Example for Sending Email

python
import requests

response = requests.post('http://localhost:5000/send-email', json={
    'recipient_id': 'example@example.com',
    'subject': 'Test Email',
    'message': 'This is a test email.'
})
print(response.json())

Retrieving Unread Emails

python
response = requests.get('http://localhost:5000/get-unread-emails')
print(response.json())

Use Cases

Using the send-email tool to send an email to a specific recipient.
Utilizing the trash-email tool to delete unwanted emails from the inbox.
Retrieving a list of unread emails to prioritize important messages.
Reading a specific email and replying after confirming its content.
Opening an email in a browser to review detailed content.

Additional Resources