Google Contacts MCP Server
Enables AI assistants to access and search Google Contacts through per-user OAuth authentication on serverless AWS Lambda. Provides read-only access to personal contacts with zero data storage and real-time API queries.
README
Google Contacts MCP Server
Serverless MCP server for Google Contacts with per-user OAuth authentication on AWS Lambda
Developed by Offleash
Overview
A production-ready Model Context Protocol (MCP) server that enables AI assistants like Claude to access Google Contacts via a secure, serverless architecture. Each employee authenticates with their own Google account, and contact data flows through in real-time without storage.
Key Features
- Per-User OAuth 2.1 Authentication - Each employee uses their own Google Contacts
- Zero Contact Data Storage - Only OAuth tokens stored, contacts fetched in real-time
- Serverless AWS Lambda - Auto-scaling, pay-per-use, zero infrastructure management
- Privacy-First DynamoDB - Stores only tokens with automatic expiration (TTL)
- Works with Claude Web & Desktop - Single URL works for both access methods
- Read-Only Access - Uses
contacts.readonlyscope only
Architecture
Employee → Claude (Web/Desktop) → API Gateway → Lambda → Google Contacts API
↓
DynamoDB
(OAuth tokens only)
Components
- AWS Lambda - Hosts Express.js MCP server with Streamable HTTP transport
- API Gateway HTTP API - Exposes
/mcpendpoint with CORS and OAuth 2.1 endpoints - DynamoDB Tables:
sessions- Stores OAuth tokens with TTL (no contact data!)oauth-clients- Dynamic client registration (DCR)auth-codes- Temporary authorization codes (10-minute TTL)
- AWS Systems Manager Parameter Store - Stores Google OAuth client credentials
- AWS CDK - Infrastructure as Code for deployment
Quick Start
Prerequisites
- Node.js >= 18.0.0
- AWS Account with CLI configured
- Google Cloud Project with People API enabled
- AWS CDK installed:
npm install -g aws-cdk
1. Install Dependencies
npm install
2. Configure Google OAuth
- Go to Google Cloud Console
- Enable the People API
- Create OAuth 2.0 credentials (Web application type)
- Note your
client_idandclient_secret - Add redirect URI (you'll get this after deployment):
https://your-api-id.execute-api.region.amazonaws.com/google/callback
3. Deploy to AWS
# Build TypeScript
npm run build
# Build Lambda package
npm run build:lambda
# Deploy with CDK
npm run cdk:deploy
4. Configure OAuth Credentials
After deployment, update the Google OAuth credentials in AWS Systems Manager Parameter Store:
aws ssm put-parameter \
--name "/google-contacts-mcp/oauth-credentials" \
--value '{"client_id":"YOUR_CLIENT_ID","client_secret":"YOUR_CLIENT_SECRET"}' \
--type String \
--overwrite \
--region us-west-2
Note: The redirect URI is constructed dynamically as
${API_ENDPOINT}/google/callback- you don't need to include it in the parameter.
5. Add Redirect URI to Google
Copy the GoogleCallbackUrl from CDK outputs and add it to your Google OAuth credentials:
- Go to Google Cloud Console → APIs & Services → Credentials
- Edit your OAuth 2.0 Client ID
- Add the callback URL to "Authorized redirect URIs" (e.g.,
https://abc123.execute-api.us-west-2.amazonaws.com/google/callback)
Usage
Claude Web
- Go to Claude.ai → Settings → Integrations
- Click "Add server"
- Enter your MCP server URL:
https://your-api-id.execute-api.region.amazonaws.com/mcp - Click "Connect"
- Authenticate with your Google account when prompted
That's it! Claude will handle the OAuth 2.1 flow automatically.
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"google-contacts": {
"url": "https://your-api-id.execute-api.region.amazonaws.com/mcp"
}
}
}
Restart Claude Desktop. When you first use the server, you'll be redirected to authenticate with Google.
Available Tools
1. list_contacts
List contacts with pagination.
Parameters:
pageSize(optional): Number of contacts (1-1000, default: 100)pageToken(optional): Pagination tokensortOrder(optional): Sort order (FIRST_NAME_ASCENDING, etc.)
2. get_contact
Get details for a specific contact.
Parameters:
resourceName(required): Contact ID (e.g.,people/c1234567890)
3. search_contacts
Search across all contact fields.
Parameters:
query(required): Search termpageSize(optional): Number of results (default: 100)readMask(optional): Specific fields to return
4. search_directory
Search Google Workspace directory (Workspace accounts only).
Parameters:
query(required): Search termpageSize(optional): Number of results (default: 100)pageToken(optional): Pagination token
Privacy & Security
What We Store
✅ OAuth access tokens (encrypted, auto-expire) ✅ OAuth refresh tokens (encrypted, auto-expire) ✅ User email (for session management) ✅ Token expiration timestamps
What We DON'T Store
❌ Contact names, emails, phone numbers ❌ Search queries ❌ Any contact data whatsoever
All contact data flows through the server in real-time and is never persisted.
Development
# Install dependencies
npm install
# Build TypeScript
npm run build
# Build Lambda package
npm run build:lambda
# Type checking
npm run typecheck
# Deploy to AWS
npm run cdk:deploy
# Destroy AWS resources
npm run cdk:destroy
Project Structure
google-contacts-mcp/
├── bin/
│ └── app.ts # CDK app entry point
├── lib/
│ └── google-contacts-mcp-stack.ts # CDK infrastructure definition
├── src/
│ ├── lambda.ts # Lambda handler entry point
│ ├── app.ts # Express application setup
│ ├── mcp-service.ts # MCP protocol implementation
│ ├── oauth-provider.ts # OAuth 2.1 provider implementation
│ ├── oauth-client-store.ts # DynamoDB OAuth client registry
│ ├── auth-code-store.ts # DynamoDB authorization code storage
│ ├── session-manager.ts # DynamoDB session/token storage
│ ├── contacts.ts # Google Contacts API calls
│ └── types.ts # TypeScript type definitions
├── public/
│ └── logo.png # Server icon
├── package.json
├── tsconfig.json
├── cdk.json # CDK configuration
└── README.md
Costs
With AWS Lambda's pay-per-use model:
- Lambda: ~$0.20 per 1M requests
- API Gateway: ~$1.00 per 1M requests
- DynamoDB: ~$0.25 per 1M read/write requests
- Parameter Store (Standard String parameter): Free (standard throughput)
Typical monthly cost for a 50-person team: ~$3-8/month
Troubleshooting
"Authentication required"
Click the "Connect" button in Claude and authenticate with your Google account.
"Invalid or expired access token"
Your session expired. Click "Connect" again to re-authenticate.
"Failed to load OAuth credentials"
Update the parameter in AWS Systems Manager Parameter Store with your correct Google OAuth client ID and secret.
"Request is missing required authentication credential" (Google error)
Check that your Google Cloud Console OAuth consent screen includes the correct scopes:
https://www.googleapis.com/auth/contacts.readonlyhttps://www.googleapis.com/auth/userinfo.email
"Directory search only available for Google Workspace"
search_directory requires a Workspace account. Use search_contacts instead.
Support
- Documentation: See QUICKSTART.md
- Issues: GitHub Issues
- Commercial Support: Contact Offleash
License
This project is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0).
What this means:
- ✅ Free to use for personal and internal company purposes
- ✅ Must give credit to Offleash
- ❌ Cannot be sold or used commercially
- ❌ Modifications must use the same license
See LICENSE file for full terms or visit https://creativecommons.org/licenses/by-nc-sa/4.0/
About Offleash
Built by Offleash - Empowering teams with AI-powered tools.
Version: 1.0.0 Last Updated: October 2025
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。