Google Calendar

by amornpan

Not rated
GitHub

About

Integrates with Google Calendar API to enable event management through specialized tools for listing, creating, and deleting calendar events with timezone-aware handling and robust error management.

Details

Author
amornpan
Repository
amornpan/py-mcp-gcalendar
Categories
Productivity, Design, Developer Tools, AI, Security, API, Infrastructure

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Google Calendar
    Command (node, npx, python, etc.) YOUR_PYTHON_PATH
    Arguments
    • Argument 1 YOUR_PATH/GCalendar/src/mcp_server.py

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

1. สร้างโปรเจกต์ Google Cloud Console
- ไปที่ Google Cloud Console
- สร้างโปรเจกต์ใหม่
- เปิดใช้งาน Google Calendar API
- สร้าง OAuth 2.0 Client ID
- ดาวน์โหลด credentials.json ไปที่โฟลเดอร์ credentials/

2. สร้างโทเค็น

   python src/create_token.py

- ทำตามขั้นตอนในเบราว์เซอร์เพื่อให้สิทธิ์การเข้าถึง
- โทเค็นจะถูกบันทึกในโฟลเดอร์ credentials/ เป็น token.json

list

Retrieve a list of events from the calendar (from 2 years in the past to 1 year in the future).

create-event

Create a new event in the calendar.

delete-duplicates

Remove duplicate events.

delete-event

Delete a specified event.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "google calendar": {
            "env": {},
            "args": [
                "YOUR_PATH/GCalendar/src/mcp_server.py"
            ],
            "shell": false,
            "command": "YOUR_PYTHON_PATH"
        }
    }
}

Linux

{
    "env": [],
    "args": [
        "YOUR_PATH/GCalendar/src/mcp_server.py"
    ],
    "shell": false,
    "command": "YOUR_PYTHON_PATH"
}

Macos

{
    "env": [],
    "args": [
        "YOUR_PATH/GCalendar/src/mcp_server.py"
    ],
    "shell": false,
    "command": "YOUR_PYTHON_PATH"
}

Windows

{
    "env": [],
    "args": [
        "YOUR_PATH/GCalendar/src/mcp_server.py"
    ],
    "shell": false,
    "command": "YOUR_PYTHON_PATH"
}

Google Calendar MCP Server - คู่มือการติดตั้งและการใช้งาน

📘 ภาพรวม

Model Context Protocol (MCP) server ที่ให้บริการเข้าถึง Google Calendar API พร้อมรองรับการทำงานแบบ asynchronous operations ช่วยให้การจัดการปฏิทินมีประสิทธิภาพผ่านอินเตอร์เฟซที่เป็นมาตรฐาน

🚀 คุณสมบัติหลัก

- เชื่อมต่อกับ Google Calendar API แบบไร้รอยต่อ - รองรับการทำงานแบบ asynchronous สำหรับประสิทธิภาพสูงสุด - ระบบ authentication แบบ OAuth 2.0 พร้อมการต่ออายุโทเค็นอัตโนมัติ - การจัดการข้อผิดพลาดและการล็อกแบบครอบคลุม - อินเทอร์เฟซ MCP ที่เรียบง่ายสำหรับการใช้งานกับ Claude และ AI อื่นๆ

🔑 เครื่องมือ API

| เครื่องมือ | คำอธิบาย | |------------|----------| | list | ดึงรายการกิจกรรมในปฏิทิน (2 ปีย้อนหลังถึง 1 ปีล่วงหน้า) | | create-event | สร้างกิจกรรมใหม่ในปฏิทิน | | delete-duplicates | ลบกิจกรรมที่ซ้ำกัน | | delete-event | ลบกิจกรรมที่ระบุ |

🛠️ การติดตั้ง

สิ่งที่ต้องมีก่อน

- Python 3.9 หรือสูงกว่า - การเชื่อมต่ออินเทอร์เน็ต - โปรเจกต์ Google Cloud Console ที่มี Google Calendar API เปิดใช้งาน

ขั้นตอนการติดตั้ง

1. โคลนโปรเจกต์

   git clone https://github.com/yourusername/GCalendar.git
cd GCalendar

2. สร้างสภาพแวดล้อมเสมือน (วิธีที่แนะนำ)

   python -m venv gcalendar_venv

# สำหรับ Windows
gcalendar_venv\Scripts\activate

# สำหรับ macOS/Linux
source gcalendar_venv/bin/activate

3. ติดตั้งแพ็คเกจที่จำเป็น

   pip install -r requirements.txt

4. เตรียมโฟลเดอร์ที่จำเป็น

   mkdir -p credentials logs

การตั้งค่า Authentication

1. สร้างโปรเจกต์ Google Cloud Console
- ไปที่ Google Cloud Console
- สร้างโปรเจกต์ใหม่
- เปิดใช้งาน Google Calendar API
- สร้าง OAuth 2.0 Client ID
- ดาวน์โหลด credentials.json ไปที่โฟลเดอร์ credentials/

2. สร้างโทเค็น

   python src/create_token.py

- ทำตามขั้นตอนในเบราว์เซอร์เพื่อให้สิทธิ์การเข้าถึง
- โทเค็นจะถูกบันทึกในโฟลเดอร์ credentials/ เป็น token.json

⚙️ การกำหนดค่าเทคนิค

การกำหนดค่า MCP Server

เพิ่มในไฟล์ claude_desktop_config.json:
{
  "mcpServers": {
    "gcalendar": {
      "command": "YOUR_PYTHON_PATH",
      "args": [
        "YOUR_PATH/GCalendar/src/mcp_server.py"
      ]
    }
  }
}

แทนที่ตัวยึดตำแหน่ง:
- YOUR_PYTHON_PATH: พาธไปยัง Python interpreter (จาก venv หรือ conda)
- YOUR_PATH: พาธเต็มไปยังโฟลเดอร์ที่โคลน

โครงสร้างโปรเจกต์

GCalendar/
├── credentials/
│   ├── credentials.json   # จาก Google Cloud Console
│   └── token.json        # สร้างโดย create_token.py
├── logs/
│   └── calendar_service.log
├── src/
│   ├── calendar_service.py   # การดำเนินการปฏิทินหลัก
│   ├── create_token.py      # การสร้างโทเค็น
│   ├── list_past_events.py  # ยูทิลิตี้การแสดงรายการกิจกรรม
│   ├── mcp_client.py        # การใช้งาน MCP client
│   ├── mcp_server.py        # การใช้งานเซิร์ฟเวอร์หลัก
│   └── renew_token.py       # ยูทิลิตี้การต่ออายุโทเค็น
├── requirements.txt
└── README.md

📋 การใช้งาน

การเริ่มใช้งานเซิร์ฟเวอร์

1. เริ่มเซิร์ฟเวอร์ด้วยตนเอง

   python src/mcp_server.py

2. การใช้งานกับ Claude Desktop
- กำหนดค่าตามที่อธิบายในส่วนการกำหนดค่าข้างต้น
- Claude จะเริ่มใช้งานเซิร์ฟเวอร์โดยอัตโนมัติเมื่อจำเป็น

ตัวอย่างคำสั่ง

1. ดูรายการกิจกรรมในปฏิทิน

   แสดงกิจกรรมในปฏิทินของฉัน

2. สร้างกิจกรรมใหม่

   สร้างการประชุมชื่อ "ประชุมทีม" วันที่ 25 มีนาคม 2025 เวลา 14:00 น. ถึง 15:00 น.

3. ลบกิจกรรมที่ซ้ำกัน

   ลบกิจกรรม "ประชุมทีม" ที่ซ้ำกันในวันที่ 25 มีนาคม 2025

🔍 การแก้ไขปัญหา

ปัญหาการรับรองความถูกต้อง

1. ตรวจสอบว่าไฟล์ credentials.json และ token.json อยู่ในโฟลเดอร์ credentials/ 2. ลบ token.json และสร้างใหม่โดยใช้ create_token.py

ปัญหาเกี่ยวกับเขตเวลา

1. ตรวจสอบว่าไลบรารี timezone ถูกติดตั้งแล้ว:
   pip install pytz tzdata
   

การตรวจสอบล็อก

1. ดูไฟล์ล็อกเพื่อรับข้อมูลเพิ่มเติมเกี่ยวกับข้อผิดพลาด:
   cat logs/calendar_service.log
   

📚 การพึ่งพา

- google-auth-oauthlib==1.0.0 - google-auth-httplib2==0.1.0 - google-api-python-client==2.108.0 - aiohttp==3.8.5 - asyncio==3.4.3 - pytz==2023.3 - tzdata==2023.3

📄 ใบอนุญาต

โปรเจกต์นี้มีใบอนุญาตภายใต้ MIT License ดูไฟล์ LICENSE สำหรับรายละเอียด "# py-mcp-gcalendar"
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.