Google Calendar Gmail MCP

Google Calendar Gmail MCP

An MCP server that enables AI assistants to interact with Google Calendar and Gmail, allowing users to manage events, send emails, and organize their inbox through natural language.

Category
访问服务器

README

Google Calendar & Gmail MCP Server

🤖 An MCP (Model Context Protocol) server that gives AI assistants like Kiro direct access to your Google Calendar and Gmail.

Ask your AI to check your schedule, create events, send emails, manage your inbox - all through natural conversation.

✨ Features

Calendar Features

  • 📅 List Events - View events for today, tomorrow, this week, or custom ranges
  • ➕ Create Events - Add new calendar events with attendees and optional email invites
  • 🗑️ Delete Events - Remove events by ID
  • 🔍 Search Events - Find events by keyword
  • 🕐 Find Free Slots - Discover available time slots

Gmail Features

  • 📧 Send Emails - Send emails with HTML support, CC, BCC
  • 📬 List Emails - Browse inbox, sent, drafts with filters
  • 🔍 Search Emails - Advanced email search by sender, subject, date
  • 📖 Read Emails - View full email content
  • ✅ Mark Emails - Mark as read/unread
  • 🗑️ Delete Emails - Trash or permanently delete
  • 💬 Reply to Emails - Reply in email threads
  • 📝 Create Drafts - Save email drafts
  • 🏷️ Manage Labels - Organize emails with labels

🚀 Quick Start

1. Clone the Repository

git clone https://github.com/AaKa5204/Google-Calender-MCP.git
cd Google-Calender-MCP

2. Install Dependencies

# Create virtual environment (recommended)
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install required packages
pip install -r requirements.txt

3. Get Google API Credentials

Step-by-step:

  1. Go to Google Cloud Console
  2. Create a new project (or select existing)
  3. Enable APIs:
    • Go to "APIs & Services" → "Enable APIs and Services"
    • Search and enable Google Calendar API
    • Search and enable Gmail API
  4. Create OAuth credentials:
    • Go to "APIs & Services" → "Credentials"
    • Click "Create Credentials" → "OAuth client ID"
    • Choose "Desktop app" as application type
    • Download the JSON file
  5. Save credentials:
    mkdir -p ~/.google-calendar-mcp
    cp ~/Downloads/client_secret_*.json ~/.google-calendar-mcp/credentials.json
    

See SETUP.md for detailed instructions with screenshots.

4. Configure Kiro IDE

Add to your .kiro/settings/mcp.json:

{
  "mcpServers": {
    "google-calendar": {
      "command": "python",
      "args": ["-m", "calendar_mcp.server"],
      "cwd": "/absolute/path/to/Google-Calender-MCP",
      "disabled": false
    }
  }
}

Important: Replace /absolute/path/to/Google-Calender-MCP with your actual project path.

5. Restart MCP Server

  1. Open Command Palette in Kiro (Cmd+Shift+P / Ctrl+Shift+P)
  2. Search for "MCP"
  3. Select "Reconnect MCP Server"

6. Authenticate

On first use, a browser window will open asking you to:

  1. Sign in to your Google account
  2. Grant Calendar and Gmail permissions
  3. That's it! The token is saved for future use.

🎯 Usage Examples

Calendar Examples

List Today's Events:

You: "What's on my calendar today?"

Create an Event:

You: "Schedule a team meeting tomorrow at 2 PM for 1 hour"

Create Event with Invite:

You: "Create a meeting with john@example.com at 3 PM today and send them an invite"

Find Free Time:

You: "When am I free for a 30-minute meeting this week?"

Gmail Examples

Send an Email:

You: "Send an email to jane@example.com with subject 'Project Update' and tell her the project is on track"

Check Inbox:

You: "What's in my inbox?"

Search Emails:

You: "Find emails from john@example.com about the budget"

Read an Email:

You: "Read the email with ID abc123xyz"

Reply to Email:

You: "Reply to email abc123xyz and say thanks"

📋 Requirements

  • Python 3.8 or higher
  • Kiro IDE (or any MCP-compatible client)
  • Google account
  • Google Cloud project with Calendar and Gmail APIs enabled

🛠️ Available Tools

Calendar Tools

list_events

List calendar events for a time range.

  • time_range: "today", "tomorrow", "this_week", "next_week", or "custom"
  • max_results: Maximum events to return (default: 10)
  • start_date, end_date: For custom range (optional)

create_event

Create a new calendar event.

  • summary: Event title (required)
  • start_time, end_time: Event times (required)
  • description: Event description (optional)
  • location: Event location (optional)
  • attendees: List of email addresses (optional)
  • send_invites: Send email invitations (default: false)

delete_event

Delete a calendar event.

  • event_id: ID of event to delete (required)

find_free_slots

Find available time slots.

  • duration_minutes: Duration needed (default: 60)
  • days_ahead: Days to search (default: 7)
  • work_hours_only: Only 9 AM - 5 PM (default: true)

search_events

Search for events by keyword.

  • query: Search term (required)
  • max_results: Max results (default: 10)

Gmail Tools

send_email

Send an email via Gmail.

  • to: Recipient email (required)
  • subject: Email subject (required)
  • body: Email body (required)
  • html: Whether body is HTML (default: false)
  • cc, bcc: Additional recipients (optional)

list_emails

List emails from inbox, sent, or drafts.

  • folder: "inbox", "sent", "drafts", "all" (default: inbox)
  • max_results: Maximum emails (default: 10)
  • unread_only: Only unread emails (default: false)

search_emails

Search emails by query.

  • query: Search query (e.g., "from:user@example.com", "subject:meeting")
  • max_results: Max results (default: 10)

read_email

Read full email content.

  • email_id: Email message ID (required)

mark_email

Mark email as read/unread.

  • email_id: Email message ID (required)
  • mark_as: "read" or "unread" (required)

delete_email

Delete or trash an email.

  • email_id: Email message ID (required)
  • permanent: Permanently delete vs trash (default: false)

reply_to_email

Reply to an email.

  • email_id: Email to reply to (required)
  • body: Reply message (required)

create_draft

Create an email draft.

  • to: Recipient (required)
  • subject: Subject (required)
  • body: Body (required)

list_labels

List all Gmail labels/folders.

add_label

Add label to an email.

  • email_id: Email message ID (required)
  • label: Label name (required)

🔧 Troubleshooting

"credentials.json not found"

  • Download OAuth credentials from Google Cloud Console
  • Save to ~/.google-calendar-mcp/credentials.json
  • Make sure the path is correct

"API has not been used in project" or "API is disabled"

  • Go to Google Cloud Console
  • Navigate to "APIs & Services" → "Library"
  • Search and enable both Google Calendar API and Gmail API
  • Wait a few minutes for changes to propagate

"Invalid grant" or "Token expired"

rm ~/.google-calendar-mcp/token.json

Then restart the MCP server and re-authenticate

MCP Server not connecting

  • Check that the cwd path in mcp.json is correct (absolute path)
  • Verify Python is in your PATH
  • Check MCP server logs in Kiro
  • Try reconnecting: Command Palette → "Reconnect MCP Server"

Permission errors

  • Ensure both Calendar and Gmail APIs are enabled in Google Cloud project
  • Check that OAuth consent screen is configured
  • Verify the credentials.json file is valid

Security Notes

  • Never commit credentials.json or token.json to version control
  • The token gives access to your calendar - keep it secure
  • Revoke access anytime from your Google Account settings

📁 Project Structure

Google-Calender-MCP/
├── src/
│   └── calendar_mcp/
│       ├── __init__.py
│       ├── server.py      # MCP server with all tools
│       └── auth.py        # Google OAuth authentication
├── pyproject.toml         # Package configuration
├── requirements.txt       # Python dependencies
├── README.md             # This file
├── SETUP.md              # Detailed setup guide
├── CONTRIBUTING.md       # Contribution guidelines
└── test_server.py        # Test script

🤝 Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.

Ideas for contributions:

  • Recurring events support
  • Event updates/modifications
  • Multiple calendar support
  • Email attachments support
  • Better natural language parsing
  • Unit tests and integration tests
  • Email templates
  • Calendar sharing features

📝 License

MIT License - see LICENSE file for details

🙏 Acknowledgments

⭐ Star This Repo

If you find this useful, give it a star! It helps others discover the project.


Made with ❤️ for the MCP community

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选