Crates.io | mcp-gmailcal |
lib.rs | mcp-gmailcal |
version | 0.10.0 |
source | src |
created_at | 2025-05-12 21:35:12.399482+00 |
updated_at | 2025-05-12 21:35:12.399482+00 |
description | A MCP server for google mail, calendar, and contacts. |
homepage | |
repository | |
max_upload_size | |
id | 1671110 |
size | 1,151,115 |
Welcome to the Gmail & Calendar MCP Server! This is a Model Completion Protocol (MCP) server designed to interact seamlessly with the Gmail and Google Calendar APIs, empowering Claude to read and manage emails and calendar events from your Google account. 🚀
The MCP Server is built on Rust, providing a robust and efficient interface to the Google APIs. Through this server, users can perform various functionalities like:
This server enhances Claude's email and calendar management capabilities with specialized prompts for email analysis, summarization, task extraction, meeting detection, contact extraction, prioritization, and more.
To utilize the Gmail MCP Server, follow these steps:
To obtain a refresh token:
https://mail.google.com/
https://www.googleapis.com/auth/calendar.readonly
https://www.googleapis.com/auth/calendar
https://www.googleapis.com/auth/contacts.readonly
cargo run -- auth
which will request all required scopesIn the same directory as the executable, create a .env
file with:
GMAIL_CLIENT_ID=your-client-id
GMAIL_CLIENT_SECRET=your-client-secret
GMAIL_REFRESH_TOKEN=your-refresh-token
To compile and run the server, execute:
cargo build --release
./target/release/mcp-gmailcal
When running in read-only environments like Claude AI, use the --memory-only
flag to prevent file system writes:
cargo run -- --memory-only
# or
./target/release/mcp-gmailcal --memory-only
This will use in-memory logging (via stderr) instead of attempting to write log files to disk.
claude mcp add
You can directly use tools through commands like:
/tool list_emails max_results=5
/tool search_emails query="from:example.com after:2024/01/01" max_results=10
/tool get_email message_id=18c1eab45a2d0123
/tool analyze_email message_id=18c1eab45a2d0123 analysis_type="tasks"
/tool batch_analyze_emails message_ids=["18c1eab45a2d0123", "18c1eab45a2d0456"] analysis_type="summary"
/tool list_labels
/tool check_connection
/tool list_calendars
/tool list_events calendar_id="primary" max_results=10 time_min="2024-03-01T00:00:00Z" time_max="2024-04-01T00:00:00Z"
/tool get_event calendar_id="primary" event_id="abc123event456id"
/tool create_event summary="Team Meeting" description="Weekly sync" location="Conference Room A" start_time="2024-04-10T14:00:00Z" end_time="2024-04-10T15:00:00Z" attendees=["person1@example.com", "person2@example.com"]
/tool list_contacts max_results=10
/tool search_contacts query="John" max_results=5
/tool get_contact resource_name="people/c12345678901234567"
Or through natural language requests:
The Gmail MCP Server provides specialized analysis capabilities through a set of custom prompts that help Claude understand and extract insights from emails:
analyze_email message_id="..." analysis_type="tasks|meetings|contacts|summary|priority|all"
batch_analyze_emails message_ids=["id1", "id2", "id3"] analysis_type="summary"
These analysis features help users quickly understand email content, extract important information, and take appropriate actions without having to read through lengthy messages.
mcp-attr
- For MCP server implementationtokio
- Asynchronous runtimereqwest
- HTTP client for Google APIsserde
and serde_json
- For JSON serializationdotenv
- For environment variable managementlog
, simplelog
, and chrono
- For logging functionalityuuid
- For generating unique request IDschrono
- For datetime handlingThe Google Calendar integration provides a set of tools to manage your calendar events through Claude:
The Calendar API uses the same OAuth credentials as the Gmail API, but requires the following additional scopes:
https://www.googleapis.com/auth/calendar.readonly
(for reading calendars and events)https://www.googleapis.com/auth/calendar
(for creating and modifying events)You can modify your OAuth consent screen to include these scopes when setting up your Google Cloud project.
The Google People API integration provides tools to access and search your contacts:
The People API uses the same OAuth credentials as the Gmail API, but requires the following additional scope:
https://www.googleapis.com/auth/contacts.readonly
(for reading contact information)This scope gives read-only access to your contacts, allowing the MCP server to retrieve contact information without modifying your contact list.
src/
├── lib.rs # Main implementation including API clients and MCP server
├── main.rs # Command-line interface and server startup
├── config.rs # Configuration handling
├── gmail_api.rs # Gmail API client implementation
├── calendar_api.rs # Google Calendar API client implementation
├── people_api.rs # Google People API client implementation (contacts)
├── logging.rs # Logging setup
├── server.rs # MCP server implementation
└── prompts.rs # Email analysis prompts
tests/
└── integration_tests.rs # Integration tests for MCP commands
.env.example # Example environment variables
.gitignore # Git ignore configuration
Cargo.toml # Rust dependencies
mcp-test.sh # MCP test script
mise.toml # Development environment configuration
README.md # This file
test_mcp_server/ # Test utilities for the MCP server
Make sure to handle sensitive information with care as some files may contain credentials or tokens. Always refer to the official Gmail API documentation for the latest updates and practices.
Thank you for your interest in the Gmail MCP Server! If you have any questions or feedback, feel free to reach out or contribute to the repository! Happy coding! 🎉
To create a new release:
# View current version
./trigger-release.sh version
# Bump patch version (0.1.0 -> 0.1.1)
./trigger-release.sh bump-patch
# Bump minor version (0.1.0 -> 0.2.0)
./trigger-release.sh bump-minor
# Bump major version (0.1.0 -> 1.0.0)
./trigger-release.sh bump-major
# Or set a specific version
./trigger-release.sh set-version 1.2.3
git add Cargo.toml
git commit -m "Bump version to X.Y.Z"
git push
./trigger-release.sh tag-current