MCP Google Calendar Server with Persistent Auth
Enables AI assistants to list and create Google Calendar events using natural language, with persistent OAuth authentication via Redis.
README
MCP Google Calendar Server with Persistent Auth
This project implements a Model Context Protocol (MCP) server for Google Calendar, featuring persistent OAuth 2.0 authentication using Redis. It allows AI assistants (like Claude or Custom Clients) to interact with your Google Calendar.
Features
- Google Calendar Integration: List upcoming events and create new events.
- Persistent Authentication: Uses Redis to store OAuth tokens securely, so you don't need to re-authenticate on every restart.
- FastMCP Framework: Built on top of the modern FastMCP framework.
- Client Implementation: Includes a sample client (
client.py) using OpenAI's GPT-4o to demonstrate interaction.
Supported Tools
list_events: Lists upcoming events from the user's primary calendar. Supports filtering by result count and minimum time.create_event: Creates a new event with a summary, start time, end time, and description.
Prerequisites
Before running this project, ensure you have the following:
- Python 3.12+: This project requires a recent version of Python.
- Redis Server: A running Redis instance is required for token storage.
- Google Cloud Project:
- Enable the Google Calendar API.
- Create OAuth 2.0 Client IDs (Desktop app).
- Scopes: Ensure the client has access to
https://www.googleapis.com/auth/calendar.events. - Redirect URI: If configured for web, ensure
http://localhost:8000/auth/callbackis allowed (FastMCP default). For Desktop/Installed App, this is handled automatically. - Download the JSON credentials or copy the Client ID and Client Secret.
- OpenAI API Key: Required if you want to run the provided
client.pytest script.
Installation
This project manages dependencies using uv (recommended) or you can use pip.
Using uv (Recommended)
- Sync the project environment:
uv sync
Using pip
- Create a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate - Install dependencies:
pip install -e .
Configuration
-
Copy the example environment file:
cp .env.example .env # On Windows: copy .env.example .env -
Edit
.envand fill in your credentials:
Please refer .env.example
Docker Support
You can also run the server using Docker.
-
Build the image:
docker build -t mcp-google-calendar . -
Run the container (ensure you environment variables are passed):
# Assuming you have a .env file docker run --env-file .env -p 8000:8000 mcp-google-calendarNote: If your Redis is running on the host, use
host.docker.internal(Windows/Mac) or--network="host"(Linux).
Running the Server
-
Start Redis: Ensure your Redis server is running locally (default port 6379).
-
Run the MCP Server: Using
uv:uv run server.pyUsing standard python:
python server.pyThe server will start at
http://localhost:8000.
You can also use profiles to maintain separate authentication sessions:
uv run client.py --profile work
uv run client.py --profile personal
uv run client.py --profile user1
uv run client.py --profile user2
Connecting a Client
Option 1: Using the provided Test Client
This project includes a CLI client powered by OpenAI to test the integration.
- Ensure the server is running.
- In a new terminal, run:
uv run client.py # or: python client.py - On first run, it will open your request OAuth authentication. Follow the steps in your browser to log in with your Google account.
- Once authenticated, you can chat with the assistant:
"What is on my calendar for today?" "Schedule a meeting with the team tomorrow at 2 PM."
Option 2: Using Claude Desktop
You can configure Claude Desktop to use this MCP server.
- Locate your Claude Desktop config file (typically
%APPDATA%\Claude\claude_desktop_config.jsonon Windows or~/Library/Application Support/Claude/claude_desktop_config.jsonon macOS). - Add the server configuration:
Note: Replace paths and credentials with your actual values.{ "mcpServers": { "google-calendar": { "command": "uv", "args": ["run", "--directory", "C:/path/to/repo/mcp-auth-google-calendar", "server.py"], "env": { "GOOGLE_CLIENT_ID": "your_client_id", "GOOGLE_CLIENT_SECRET": "your_client_secret" } } } }
Testing
Currently, no automated unit tests are included. The best way to test is using the client.py script as described above.
To run future tests (if added), you would use pytest:
uv run pytest
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。