calendar-pa

calendar-pa

Google Calendar MCP server with natural language scheduling, conflict detection, smart slot finding, complex recurring events, and a Telegram bot interface. Self-hosted, works with Claude Desktop and any MCP-compatible client.

Category
访问服务器

README

Calendar PA

A production-grade Google Calendar MCP server with a Telegram bot interface. Manage your calendar in plain English — schedule meetings, find free slots, set up recurring events, and get reminders — all through Claude or Telegram.


Features

  • Natural language scheduling — "Schedule a team sync tomorrow at 3pm for an hour"
  • Conflict detection — automatically checks for clashes before creating events
  • Smart slot finder — "Find me a 2 hour deep work block this week" (AI-powered reasoning)
  • Complex recurring events — "Every second Tuesday of the month", "Every weekday until December"
  • Reminders — configurable popup and email reminders on any event
  • Session memory — remembers context and preferences across sessions
  • Two interfaces — Claude Desktop (MCP) and Telegram bot

Architecture

Google Calendar API
        ↑
MCP Server (Python)
        ↑
   ┌────┴────┐
Claude    Telegram Bot
Desktop   (Claude API + MCP tools)

The MCP server exposes tools that any MCP-compatible client can use. The Telegram bot calls the same tool handlers directly, giving you a mobile-friendly interface with the same intelligence.


Quick Start

Requirements

  • Python 3.12+
  • A Google Cloud project with the Calendar API enabled
  • An Anthropic API key (for the Telegram bot)
  • A Telegram bot token (for the Telegram bot)

1. Clone and set up

git clone https://github.com/Richardilemon/calendar-pa.git
cd calendar-pa

python3 -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

pip install -r requirements.txt

2. Google Calendar OAuth

  1. Go to Google Cloud Console
  2. Create a new project (or use an existing one)
  3. Enable the Google Calendar API
  4. Go to APIs & Services → Credentials → Create Credentials → OAuth 2.0 Client ID
  5. Application type: Desktop app
  6. Download the JSON file, rename it to credentials.json, place it in the project root
  7. Add your Google account as a test user under OAuth consent screen → Test users

3. Configure environment

cp .env.example .env

Edit .env with your values:

# Google Calendar
CALENDAR_ID=primary
CREDENTIALS_FILE=/absolute/path/to/calendar-pa/credentials.json
TOKEN_FILE=/absolute/path/to/calendar-pa/token.json

# Session context storage
CONTEXT_FILE=/absolute/path/to/calendar-pa/data/session_context.json

# Telegram bot (required for bot interface)
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
ANTHROPIC_API_KEY=your_anthropic_api_key

4. Authenticate with Google

python -c "from src.auth import get_calendar_service; get_calendar_service(); print('authenticated')"

This opens your browser for OAuth authorization. A token.json file is saved for future sessions.

5. Run the MCP server

python -m src.server

6. Connect to Claude Desktop

Add to your claude_desktop_config.json:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "calendar-pa": {
      "command": "/absolute/path/to/calendar-pa/venv/bin/python",
      "args": ["/absolute/path/to/calendar-pa/src/server.py"],
      "cwd": "/absolute/path/to/calendar-pa"
    }
  }
}

Restart Claude Desktop. You should see calendar-pa in the connectors list.

7. Run the Telegram bot (optional)

Create a Telegram bot via @BotFather and add the token to .env, then:

python src/bot.py

MCP Tools

Tool Description
get_events Fetch events by date, date range, or keyword
create_event Create event with automatic conflict detection
update_event Reschedule, rename, or update any event
delete_event Delete with confirmation step
find_free_slot AI-powered free slot finder
create_recurring_event Natural language recurring events
set_reminder Add popup or email reminders
get_session_context Load persistent session state
update_session_context Save state across sessions

Resources

Resource URI Description
Today's schedule calendar://today Live events for today
This week's schedule calendar://week Live events for the week
Tool statistics system://tool-stats Tool call metrics

Usage Examples

Claude Desktop:

  • "What's on my calendar this week?"
  • "Schedule a FANAP planning session tomorrow at 10am for 2 hours"
  • "Find me a free 90 minute slot on Thursday"
  • "Create a recurring team standup every Monday at 9am"
  • "Move my 3pm meeting to Friday"

Telegram bot:

  • /today — today's schedule
  • /week — this week at a glance
  • Or just type naturally — the bot understands plain English

Self-Hosting Notes

This is a self-hosted tool — you run your own instance with your own credentials. There is no shared hosted service.

Each user needs:

  • Their own Google OAuth credentials (credentials.json)
  • Their own Anthropic API key (for the Telegram bot)
  • Their own Telegram bot token (for the Telegram bot)

None of these are included in the repo — they stay on your machine only.


Deployment

To run the Telegram bot as an always-on service, deploy src/bot.py to any Python-compatible host:

  • Railway — recommended, generous free tier
  • Render — Background Worker, $7/month
  • Fly.io — free tier available
  • Any VPS — run with python src/bot.py or set up as a systemd service

For cloud deployment, store credentials.json and token.json as base64-encoded environment variables:

base64 -i credentials.json | tr -d '\n'  # → GOOGLE_CREDENTIALS_B64
base64 -i token.json | tr -d '\n'        # → GOOGLE_TOKEN_B64

The server decodes these at startup via src/setup.py.


Project Structure

calendar-pa/
├── src/
│   ├── server.py          # MCP server — tools, resources, routing
│   ├── auth.py            # Google OAuth flow
│   ├── bot.py             # Telegram bot
│   ├── setup.py           # Cloud deployment credential setup
│   └── tools/
│       ├── calendar.py    # All calendar tool handlers
│       └── context.py     # Session context tools
├── data/                  # Session context storage (gitignored)
├── credentials.json       # Google OAuth credentials (gitignored)
├── token.json             # Google OAuth token (gitignored)
├── .env                   # Environment variables (gitignored)
├── .env.example           # Environment variable template
├── requirements.txt
└── Procfile               # For cloud deployment

Roadmap

v1 (current)

  • Core calendar operations with conflict detection
  • Smart slot finder with AI reasoning
  • Complex recurring events
  • Session memory
  • Telegram bot interface

v2 (planned)

  • Multi-calendar support
  • Per-user OAuth for hosted deployment
  • React Native app for alarm-based notifications
  • Meeting suggestions with attendee availability

Built With


License

MIT

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选