A lightweight CRM by integrating Google Sheets, Gmail, and Google Docs.
Google Workspace CRM MCP Server
A Python MCP (Model Context Protocol) server that acts as a lightweight CRM by integrating Google Sheets (contact management & generic spreadsheet ops), Gmail (email communication), and Google Docs (document creation). Designed for hosting on Replit with Streamable HTTP transport, compatible with both Claude and ChatGPT as MCP clients.
Features
- 30 MCP tools for full CRM + workspace workflow
- Google Sheets: CRM contacts + generic read/write/append on any range, tab management, and new spreadsheet creation
- Gmail integration via OAuth2 for sending, searching, reading emails, replying, and drafting (with SMTP and domain-wide delegation fallbacks)
- Google Docs: Create new documents, append text, read document content
- Agent Cache: Thread-safe in-memory cache with TTL expiration, LRU eviction, namespace support, and bulk operations for fast batch processing
- OAuth2 MCP endpoint protection: Secure the
/mcpendpoint with Client Credentials or Authorization Code + PKCE flow — compatible with Claude's Advanced Settings - Settings dashboard: Web-based UI for credential management, OAuth2 authorization, Google Sheets selection, and comprehensive testing
- Streamable HTTP transport for remote hosting on Replit
- Full audit logging: Every tool call is tracked through 5 stages (received, API call, Google validated, result delivered, delivery confirmed)
- Comprehensive test suite: One-click tests for Service Account, MCP Tools, Gmail Send & Reply, Cache Pipeline, and CRM Contact Management — each writes results to a dedicated Google Sheet tab
- Rate limiting & caching to stay within Google API quotas
- PostgreSQL-backed credentials: All service account keys, OAuth tokens, and settings stored securely in the database — never in code or files
MCP Tools (30 total)
CRM Contact Management (8 tools)
| Tool | Description | R/W |
|---|---|---|
crm_list_contacts |
List all contacts with optional field filtering | Read |
crm_get_contact |
Get a single contact by email or row number | Read |
crm_add_contact |
Add a new contact to the CRM | Write |
crm_update_contact |
Update an existing contact's fields | Write |
crm_delete_contact |
Soft-delete a contact (moves to "Deleted" sheet) | Destructive |
crm_search_contacts |
Full-text search across all contact fields | Read |
crm_add_note |
Append a timestamped note to a contact | Write |
crm_get_contact_with_emails |
Get contact profile + recent email history | Read |
Google Sheets Operations (7 tools)
| Tool | Description | R/W |
|---|---|---|
sheets_read_range |
Read data from a specific A1 range | Read |
sheets_write_range |
Write a 2D array to a specific A1 range | Write |
sheets_append_rows |
Append rows to the end of a sheet tab | Write |
sheets_read_all |
Read all data from an entire sheet tab | Read |
sheets_list_tabs |
List all worksheet tabs with dimensions | Read |
sheets_create_tab |
Create a new worksheet tab with optional headers | Write |
sheets_delete_tab |
Delete a worksheet tab (permanent, requires confirm) | Destructive |
Google Workspace File Creation (4 tools)
| Tool | Description | R/W |
|---|---|---|
sheets_create_spreadsheet |
Create a brand new Google Sheets file | Write |
docs_create_document |
Create a new Google Doc with optional initial text | Write |
docs_append_text |
Append text to an existing Google Doc | Write |
docs_read_document |
Read the full text of a Google Doc | Read |
Email Communication (7 tools)
| Tool | Description | R/W |
|---|---|---|
gmail_send_email |
Send an email (plain text or HTML) | Write |
gmail_search_emails |
Search emails using Gmail query syntax | Read |
gmail_get_email |
Get full email content by message ID | Read |
gmail_send_reply |
Reply to an existing email thread | Write |
gmail_draft_email |
Create a draft email without sending | Write |
crm_log_email_to_contact |
Log an email interaction on a contact's record | Write |
crm_get_contact_with_emails |
Get contact profile + recent email history | Read |
Agent Cache (5 tools)
| Tool | Description | R/W |
|---|---|---|
cache_put |
Store a value in the agent cache with optional TTL and namespace | Write |
cache_get |
Retrieve a value from the cache | Read |
cache_list |
List cache keys, optionally filtered by namespace | Read |
cache_delete |
Delete a cache entry | Write |
cache_stats |
View cache statistics (entries, hits, misses, hit rate) | Read |
System & Audit (4 tools)
| Tool | Description | R/W |
|---|---|---|
system_health_check |
Test connectivity to all Google services | Read |
audit_get_logs |
Query the audit log (filter by tool, stage, errors) | Read |
audit_trace_request |
Get the |
Tools (5)
crm_list_contactsList all contacts with optional field filteringgmail_send_emailSend an email (plain text or HTML)sheets_read_rangeRead data from a specific A1 rangedocs_create_documentCreate a new Google Doc with optional initial textcache_putStore a value in the agent cache with optional TTL and namespaceEnvironment Variables
GOOGLE_CLIENT_IDrequiredOAuth2 Client ID for Google API accessGOOGLE_CLIENT_SECRETrequiredOAuth2 Client Secret for Google API accessDATABASE_URLrequiredPostgreSQL connection string for storing credentialsConfiguration
{"mcpServers": {"google-workspace-crm": {"command": "python", "args": ["path/to/main.py"]}}}