Google Calendar

搜索与获取

by Kashyab19

连接 Google 账号以浏览和管理日历与事件,支持创建、更新、删除单次、重复或全天事件,并可跨日历查找安排、保持日程同步。

什么是 Google Calendar

连接 Google 账号以浏览和管理日历与事件,支持创建、更新、删除单次、重复或全天事件,并可跨日历查找安排、保持日程同步。

README

Google Calendar MCP Server

A Model Context Protocol (MCP) server that provides Google Calendar integration through the Smithery framework. This server enables AI assistants to interact with Google Calendar data including calendars, events, and user authentication.

Features

  • OAuth 2.1 Authentication: Secure authentication using OAuth 2.1 with PKCE
  • Calendar Management: List, create, update, and delete calendars
  • Event Operations: Full CRUD operations for calendar events
  • Search Functionality: Search events across multiple calendars
  • All-day Event Support: Handle both timed and all-day events
  • Error Handling: Comprehensive error handling with user-friendly messages
  • Guest Access: Supports anonymous access for initial connections

Architecture

This project consists of two main components:

  1. MCP Server (src/): The main MCP server that implements the Model Context Protocol
  2. Auth Server (auth-server/): OAuth 2.1 authorization server for secure authentication

Prerequisites

  • Node.js 20.0.0 or higher
  • npm or yarn
  • Google Cloud Console project with Calendar API enabled
  • OAuth 2.0 credentials from Google Cloud Console

Installation

  1. Clone and navigate to the project

    bash
    cd gcal-mcp
    npm install
    
  2. Install auth-server dependencies

    bash
    cd auth-server
    npm install
    cd ..
    
  3. Configure environment variables

    bash
    # Copy example files
    cp auth-server/env.example auth-server/.env
    
    # Edit auth-server/.env with your settings
    

Configuration

Auth Server Configuration

Create auth-server/.env with the following variables:

env
# Auth Server Configuration
AUTH_SERVER_ISSUER=http://localhost:3080
MCP_RESOURCE_ID=https://smithery.ai

# Google OAuth Configuration
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_REDIRECT_URI=http://localhost:3080/oauth/google/callback

# JWT Configuration
JWT_SECRET=your_jwt_secret_key
JWT_ISSUER=http://localhost:3080
JWT_AUDIENCE=https://smithery.ai

# Database (optional - uses in-memory by default)
DATABASE_URL=sqlite://./auth.db

Google Cloud Console Setup

  1. Create a Google Cloud project
  2. Enable the Google Calendar API
  3. Configure OAuth consent screen
  4. Create OAuth 2.0 credentials
  5. Add authorized redirect URIs:
    • http://localhost:3080/oauth/google/callback
    • https://smithery.ai/playground/callback

Usage

Development Mode

  1. Start the auth server

    bash
    cd auth-server
    npm run dev
    
  2. Start the MCP server (in a new terminal)

    bash
    cd gcal-mcp
    npm run dev
    
  3. Connect via Smithery Playground

    • Open Smithery Playground
    • Connect to your MCP server
    • Complete OAuth authentication when prompted

Production Deployment

  1. Build the project

    bash
    npm run build
    
  2. Configure production environment

    • Update auth server URL in production
    • Use HTTPS for all URLs
    • Configure proper CORS settings

Available Tools

Calendar Tools

  • list_calendars: List all accessible calendars
  • get_calendar: Get details of a specific calendar
  • create_calendar: Create a new calendar
  • update_calendar: Update calendar properties
  • delete_calendar: Delete a calendar
  • search_calendars: Search calendars by name or description

Event Tools

  • list_events: List events from a calendar
  • get_event: Get details of a specific event
  • create_event: Create a new event
  • update_event: Update event properties
  • delete_event: Delete an event
  • search_events: Search events across calendars

Authentication Tools

  • check_auth_status: Check current authentication status

API Reference

Authentication Flow

  1. Initial Connection: MCP server allows anonymous initial connections
  2. OAuth Registration: Client registers with the auth server
  3. Authorization: User authorizes via Google OAuth
  4. Token Exchange: Authorization code exchanged for access token
  5. Token Verification: All subsequent requests verify the access token

Error Handling

The server provides comprehensive error handling with specific error types:

  • AuthenticationError: OAuth or token-related errors
  • ValidationError: Input validation failures
  • RateLimitError: Rate limiting violations
  • GoogleAPIError: Google Calendar API errors
  • NetworkError: Network connectivity issues

Development

Project Structure

code
gcal-mcp/
├── src/
│   ├── index.ts              # Main MCP server
│   ├── oauth-provider.ts     # OAuth provider implementation
│   ├── auth-utils.ts         # Authentication utilities
│   ├── constants.ts          # Server constants
│   ├── errors.ts             # Error handling
│   └── tools/
│       ├── auth.ts           # Authentication tools
│       ├── calendars.ts      # Calendar management tools
│       └── events.ts         # Event management tools
├── auth-server/
│   ├── src/
│   │   ├── index.ts          # Auth server main
│   │   ├── google-auth.ts    # Google OAuth integration
│   │   ├── storage.ts        # Token storage
│   │   └── crypto.ts         # Cryptographic utilities
│   └── tests/                # E2E tests
└── package.json

Scripts

  • npm run dev: Start development server
  • npm run build: Build for production
  • npm run check: Lint and format code
  • npm run test: Run tests

Testing

Run the comprehensive E2E tests:

bash
cd auth-server
npm run test:e2e

Troubleshooting

Common Issues

  1. Infinite Loop During Registration

    • Cause: Smithery SDK's requireBearerAuth middleware blocks MCP initialize
    • Solution: OAuth is currently disabled. Contact Smithery developers for SDK fix
  2. Authentication Failures

    • Verify Google OAuth credentials
    • Check redirect URI configuration
    • Ensure Calendar API is enabled
  3. Network Connectivity

    • Verify auth server is running on port 3080
    • Check firewall settings
    • Ensure proper URL configuration

Debug Mode

Enable debug logging:

bash
LOG_LEVEL=debug npm run dev

Configuration Check

Use the configuration checker:

bash
./check-config.sh

Security Considerations

  • Token Storage: Access tokens are stored securely with automatic refresh
  • PKCE: Uses Proof Key for Code Exchange for enhanced security
  • HTTPS: Always use HTTPS in production
  • Scope Limitation: Minimal required scopes for Google Calendar access
  • Token Expiration: Automatic token refresh and cleanup

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Run linting and formatting
  6. Submit a pull request

Code Style

  • Use TypeScript strict mode
  • Follow the existing code structure
  • Add comprehensive error handling
  • Include JSDoc comments for public APIs
  • Run npm run check before committing

Support

Related Projects

常见问题

Google Calendar 是什么?

连接 Google 账号以浏览和管理日历与事件,支持创建、更新、删除单次、重复或全天事件,并可跨日历查找安排、保持日程同步。

相关 Skills

技能搜索

by daymade

Universal
热门

通过CCPM直接搜索、查看、安装、更新和卸载Claude Code Skill,适合查找PDF、代码审查等场景插件,也能列出已装Skill并自动执行命令返回结果。

想给Claude Code找对技能时,用它能一站式搜索、安装和管理CCPM注册表里的能力,省去到处翻找的时间。

搜索与获取
未扫描1.3k

深度研究

by daymade

Universal
热门

围绕既定模板拆题、多轮检索、整理证据表并交叉校验引用,产出格式严格、可追溯的研究报告,适合市场调研、竞品分析、政策追踪等高要求写作任务

把网页搜索、信息检索和研究分析串成一条链路,适合需要快速汇总线索、做深度判断的开发与研究工作。

搜索与获取
未扫描1.3k

标准研究员

by levnikolaevich

Universal

基于项目技术栈和 Epic/Story 需求,用 MCP Ref 检索相关 RFC、行业标准与架构模式,整理成可直接写入 Story Technical Notes 的研究结论与参考链接。

做技术方案时先让标准研究员帮你查标准与设计模式,基于 MCP Ref 产出可复用的技术注释研究,省下大量检索整理时间。

搜索与获取
未扫描549

相关 MCP Server

网页抓取

编辑精选

by Anthropic

热门

Fetch 是 MCP 官方参考服务器,让 AI 能抓取网页并转为 Markdown 格式。

这个服务器解决了 AI 直接处理网页内容时格式混乱的问题,适合需要让 Claude 分析在线文档或新闻的开发者。不过作为参考实现,它缺乏生产级的安全配置,你得自己处理反爬虫和隐私风险。

搜索与获取
89.8k

Brave 搜索

编辑精选

by Anthropic

热门

Brave Search 是让 Claude 直接调用 Brave 搜索 API 获取实时网络信息的 MCP 服务器。

如果你想让 AI 助手帮你搜索最新资讯或技术文档,这个工具能绕过传统搜索的限制,直接返回结构化数据。特别适合需要实时信息的开发者,比如查 API 更新或竞品动态。不过它依赖 Brave 的 API 配额,高频使用可能受限。

搜索与获取
89.7k

by Anthropic

热门

Puppeteer 是让 Claude 自动操作浏览器进行网页抓取和测试的 MCP 服务器。

这个服务器解决了手动编写 Puppeteer 脚本的繁琐问题,适合需要自动化网页交互的开发者,比如抓取动态内容或做端到端测试。不过,作为参考实现,它可能缺少生产级的安全防护,建议在可控环境中使用。

搜索与获取
89.2k

评论