Logo Google Calendar MCP 服务器

Google Calendar MCP 服务器

Cộng đồng
v-3

This MCP server allows Claude to interact with your Google Calendar, enabling capabilities like listing events, creating meetings, and finding free time slots.

Nhà phát hànhv-3
Kho mãgoogle-calendar
Ngôn ngữTypeScript
Bản fork
16
Sao
72
Công cụ có sẵn
0
Phương thức truyền tảistdio
Danh mục
Giấy phépMIT
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    Google Calendar MCP 服务器 cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    72 sao và 16 bản fork từ kho mã được liên kết.

Google Calendar MCP Server

This MCP server allows Claude to interact with your Google Calendar, enabling capabilities like listing events, creating meetings, and finding free time slots.

Prerequisites

  • Node.js (v16 or higher)
  • Claude Desktop App
  • A Google Cloud Project
  • Google Calendar API enabled
  • OAuth 2.0 credentials

Setup Instructions

1. Create a Google Cloud Project

  1. Go to the Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the Google Calendar API:
    • Go to "APIs & Services" > "Library"
    • Search for "Google Calendar API"
    • Click "Enable"

2. Configure OAuth Consent Screen

  1. Go to "APIs & Services" > "OAuth consent screen"
  2. Select "External" user type (unless you have a Google Workspace organization)
  3. Fill in the required information:
    • App name
    • User support email
    • Developer contact information
  4. Add the following scopes:
    • https://www.googleapis.com/auth/calendar
    • https://www.googleapis.com/auth/calendar.events
  5. Add your email address as a test user

3. Create OAuth 2.0 Credentials

  1. Go to "APIs & Services" > "Credentials"
  2. Click "Create Credentials" > "OAuth client ID"
  3. Select "Desktop app" as the application type
  4. Name your client (e.g., "MCP Calendar Client")
  5. Click "Create"
  6. Download the client configuration file (you'll need the client ID and client secret)

4. Get Refresh Token

  1. Create a new file named getToken.js:
javascript
const { google } = require('googleapis');
const http = require('http');
const url = require('url');

// Replace these with your OAuth 2.0 credentials
const CLIENT_ID = 'your-client-id';
const CLIENT_SECRET = 'your-client-secret';
const REDIRECT_URI = 'http://localhost:3000/oauth2callback';

// Configure OAuth2 client
const oauth2Client = new google.auth.OAuth2(
  CLIENT_ID,
  CLIENT_SECRET,
  REDIRECT_URI
);

// Define scopes
const scopes = [
  'https://www.googleapis.com/auth/calendar',
  'https://www.googleapis.com/auth/calendar.events'
];

async function getRefreshToken() {
  return new Promise((resolve, reject) => {
    try {
      // Create server to handle OAuth callback
      const server = http.createServer(async (req, res) => {
        try {
          const queryParams = url.parse(req.url, true).query;
          
          if (queryParams.code) {
            // Get tokens from code
            const { tokens } = await oauth2Client.getToken(queryParams.code);
            console.log('\n=================');
            console.log('Refresh Token:', tokens.refresh_token);
            console.log('=================\n');
            console.log('Save this refresh token in your configuration!');
            
            // Send success response
            res.end('Authentication successful! You can close this window.');
            
            // Close server
            server.close();
            resolve(tokens);
          }
        } catch (error) {
          console.error('Error getting tokens:', error);
          res.end('Authentication failed! Please check console for errors.');
          reject(error);
        }
      }).listen(3000, () => {
        // Generate auth url
        const authUrl = oauth2Client.generateAuthUrl({
          access_type: 'offline',
          scope: scopes,
          prompt: 'consent'  // Force consent screen to ensure refresh token
        });

        console.log('1. Copy this URL and paste it in your browser:');
        console.log('\n', authUrl, '\n');
        console.log('2. Follow the Google authentication process');
        console.log('3. Wait for the refresh token to appear here');
      });

    } catch (error) {
      console.error('Server creation error:', error);
      reject(error);
    }
  });
}

// Run the token retrieval
getRefreshToken().catch(console.error);
  1. Install required dependency:
bash
npm install googleapis
  1. Update the script with your OAuth credentials:

    • Replace your-client-id with your actual client ID
    • Replace your-client-secret with your actual client secret
  2. Run the script:

bash
node getToken.js
  1. Follow the instructions in the console:
    • Copy the provided URL
    • Paste it into your browser
    • Complete the Google authentication process
    • Copy the refresh token that appears in the console

5. Configure Claude Desktop

  1. Open your Claude Desktop configuration file:

For MacOS:

bash
code ~/Library/Application\ Support/Claude/claude_desktop_config.json

For Windows:

bash
code %AppData%\Claude\claude_desktop_config.json
  1. Add or update the configuration:
json
{
    "mcpServers": {
        "google-calendar": {
            "command": "node",
            "args": [
                "/ABSOLUTE/PATH/TO/YOUR/build/index.js"
            ],
            "env": {
                "GOOGLE_CLIENT_ID": "your_client_id_here",
                "GOOGLE_CLIENT_SECRET": "your_client_secret_here",
                "GOOGLE_REDIRECT_URI": "http://localhost",
                "GOOGLE_REFRESH_TOKEN": "your_refresh_token_here"
            }
        }
    }
}
  1. Save the file and restart Claude Desktop

Initial Project Setup

  1. Create a new directory for your project:
bash
mkdir google-calendar-mcp
cd google-calendar-mcp
  1. Initialize a new npm project:
bash
npm init -y
  1. Install dependencies:
bash
npm install @modelcontextprotocol/sdk googleapis google-auth-library zod
npm install -D @types/node typescript
  1. Create a tsconfig.json file:
json
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "Node16",
    "moduleResolution": "Node16",
    "outDir": "./build",
    "rootDir": "./src",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules"]
}
  1. Update package.json:
json
{
  "type": "module",
  "scripts": {
    "build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\""
  }
}
  1. Create your source directory:
bash
mkdir src
  1. Create a .env file for local development (don't commit this file):
bash
GOOGLE_CLIENT_ID=your_client_id_here
GOOGLE_CLIENT_SECRET=your_client_secret_here
GOOGLE_REDIRECT_URI=http://localhost
GOOGLE_REFRESH_TOKEN=your_refresh_token_here

Building and Running

  1. Build the server:
bash
npm run build
  1. The server will automatically start when you open Claude Desktop

Available Tools

The server provides the following tools:

  1. list_events: List calendar events within a specified time range
  2. create_event: Create a new calendar event
  3. update_event: Update an existing calendar event
  4. delete_event: Delete a calendar event
  5. find_free_time: Find available time slots in the calendar

Example Usage in Claude

After setup, you can use commands like:

  • "Show me my calendar events for next week"
  • "Schedule a meeting with [email_id] tomorrow at 2 PM for 1 hour"
  • "Find a free 30-minute slot this afternoon"
  • "Update my 3 PM meeting to 4 PM"
  • "Cancel my meeting with ID [event_id]"

Troubleshooting

Common Issues

  1. Tools not appearing in Claude:

    • Check Claude Desktop logs: tail -f ~/Library/Logs/Claude/mcp*.log
    • Verify all environment variables are set correctly
    • Ensure the path to index.js is absolute and correct
  2. Authentication Errors:

    • Verify your OAuth credentials are correct
    • Check if refresh token is valid
    • Ensure required scopes are enabled
  3. Server Connection Issues:

    • Check if the server built successfully
    • Verify file permissions on build/index.js (should be 755)
    • Try running the server directly: node /path/to/build/index.js

Viewing Logs

To view server logs:

bash
# For MacOS/Linux:
tail -n 20 -f ~/Library/Logs/Claude/mcp*.log

# For Windows:
Get-Content -Path "$env:AppData\Claude\Logs\mcp*.log" -Wait -Tail 20

Environment Variables

If you're getting environment variable errors, verify each one:

  1. GOOGLE_CLIENT_ID: Should start with something like "123456789-..."
  2. GOOGLE_CLIENT_SECRET: Usually ends in ".apps.googleusercontent.com"
  3. GOOGLE_REDIRECT_URI: Should be "http://localhost"
  4. GOOGLE_REFRESH_TOKEN: A long string that doesn't expire

Security Considerations

  • Keep your OAuth credentials secure
  • Don't commit credentials to version control
  • Use environment variables for sensitive data
  • Regularly rotate refresh tokens
  • Monitor API usage in Google Cloud Console

License

MIT License - See LICENSE file for details.

Support

If you encounter any issues:

  1. Check the troubleshooting section above
  2. Review Claude Desktop logs
  3. Open an issue on GitHub
  4. Contact the maintainer

Cài đặt

TypingMind
{
  "mcpServers": {
    "v-3-google-calendar": {
      "command": "node",
      "args": [
        "build/index.js"
      ],
      "env": {
        "GOOGLE_CLIENT_ID": "<GOOGLE_CLIENT_ID>",
        "GOOGLE_CLIENT_SECRET": "<GOOGLE_CLIENT_SECRET>",
        "GOOGLE_REDIRECT_URI": "<GOOGLE_REDIRECT_URI>",
        "GOOGLE_REFRESH_TOKEN": "<GOOGLE_REFRESH_TOKEN>"
      }
    }
  }
}

Dùng MCP Google Calendar MCP 服务器 với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối Google Calendar MCP 服务器, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm Google Calendar MCP 服务器 làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của Google Calendar MCP 服务器.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "v-3-google-calendar": {
      "command": "npx",
      "args": [
        "-y",
        "googlecalendar"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của Google Calendar MCP 服务器, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của Google Calendar MCP 服务器.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng Google Calendar MCP 服务器 giúp tôi làm việc này không?
Google Calendar MCP 服务器
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng Google Calendar MCP 服务器.

Câu hỏi thường gặp

Máy chủ MCP Google Calendar MCP 服务器 dùng để làm gì?

Google Calendar MCP 服务器 là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP Google Calendar MCP 服务器 với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng Google Calendar MCP 服务器 với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP Google Calendar MCP 服务器 với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối Google Calendar MCP 服务器, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP Google Calendar MCP 服务器 với TypingMind?

Google Calendar MCP 服务器 hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP Google Calendar MCP 服务器 cung cấp những công cụ nào trong TypingMind?

Google Calendar MCP 服务器 cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP Google Calendar MCP 服务器 không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu Google Calendar MCP 服务器 yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇