Skip to main content
Glama
pbulbule13
by pbulbule13
README.md
# Google Workspace MCP Server

A comprehensive Model Context Protocol (MCP) server for Google Workspace integration with Claude Desktop. Provides 109 tools for Gmail, Calendar, Sheets, Docs, Drive, plus local storage and personal memory system.

## Features

- **Gmail**: Read, send, reply, forward emails, manage drafts and labels
- **Google Calendar**: List, create, update, delete events
- **Google Sheets**: Create, read, write spreadsheets with formatting
- **Google Docs**: Create and edit documents with formatting
- **Google Drive**: Upload, download, share files and folders
- **Local Storage**: Profile, job applications, contacts, skills, tasks
- **Memory System**: Personal preferences, behaviors, goals, patterns

---

## Setup Guide

### Prerequisites

- Python 3.10 or higher
- Claude Desktop installed
- Google Cloud project with APIs enabled

### Step 1: Clone or Download

```bash
git clone <repository-url>
cd google-mcp-server
```

### Step 2: Install Dependencies

```bash
pip install -r requirements.txt
```

Required packages:
- `mcp>=0.9.0`
- `google-api-python-client>=2.100.0`
- `google-auth-httplib2>=0.2.0`
- `google-auth-oauthlib>=1.2.0`
- `python-dotenv>=1.0.0`
- `requests>=2.31.0`

### Step 3: Set Up Google Cloud Project

1. Go to [Google Cloud Console](https://console.cloud.google.com)
2. Create a new project (or select existing)
3. Enable the following APIs:
   - Gmail API
   - Google Calendar API
   - Google Sheets API
   - Google Docs API
   - Google Drive API
4. Go to **APIs & Services > Credentials**
5. Click **Create Credentials > OAuth client ID**
6. Select **Desktop app** as application type
7. Download the JSON file
8. Rename it to `credentials.json` and place in the `google-mcp-server` folder

### Step 4: Authenticate with Google

Run the authentication script:

```bash
cd google-mcp-server
python src/google_auth.py
```

This will:
1. Open a browser window for Google sign-in
2. Ask you to authorize the app
3. Create a `tokens.json` file with your access tokens

### Step 5: Set Up Database Folder (Optional)

Create a centralized database folder for all your data:

```bash
mkdir -p ~/Documents/pbdb/mcp
mkdir -p ~/Documents/pbdb/analytics
mkdir -p ~/Documents/pbdb/exports
mkdir -p ~/Documents/pbdb/backups
```

The MCP server stores data in:
- `~/Documents/pbdb/mcp/local_data.db` - Job tracking, contacts, skills
- `~/Documents/pbdb/mcp/personal_memory.db` - Personal memory system

### Step 6: Configure Claude Desktop

1. Find your Claude Desktop config file:
   - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
   - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
   - **Linux**: `~/.config/Claude/claude_desktop_config.json`

2. Add the MCP server configuration:

```json
{
  "mcpServers": {
    "google-workspace": {
      "command": "python",
      "args": [
        "C:/path/to/google-mcp-server/src/mcp_server.py"
      ],
      "env": {},
      "cwd": "C:/path/to/google-mcp-server"
    }
  }
}
```

**Windows Example:**
```json
{
  "mcpServers": {
    "google-workspace": {
      "command": "C:\\Users\\YourName\\miniconda3\\python.exe",
      "args": [
        "C:\\Users\\YourName\\google-mcp-server\\src\\mcp_server.py"
      ],
      "env": {},
      "cwd": "C:\\Users\\YourName\\google-mcp-server"
    }
  }
}
```

**macOS/Linux Example:**
```json
{
  "mcpServers": {
    "google-workspace": {
      "command": "/usr/bin/python3",
      "args": [
        "/home/username/google-mcp-server/src/mcp_server.py"
      ],
      "env": {},
      "cwd": "/home/username/google-mcp-server"
    }
  }
}
```

### Step 7: Restart Claude Desktop

Close and reopen Claude Desktop. The MCP server will initialize automatically.

### Step 8: Verify Installation

In Claude Desktop, try these commands:
- "Show my recent emails"
- "What events do I have on my calendar?"
- "List my Google Drive files"
- "What do you know about me?"

---

## Available Tools (109 Total)

### Gmail (21 tools)
| Tool | Description |
|------|-------------|
| `list_emails` | List emails from inbox |
| `get_email_detail` | Get full email content |
| `send_email` | Send a new email |
| `search_emails` | Search emails with query |
| `create_draft` | Create a draft email |
| `list_drafts` | List all drafts |
| `update_draft` | Update a draft |
| `send_draft` | Send a draft |
| `delete_draft` | Delete a draft |
| `reply_to_email` | Reply to an email |
| `forward_email` | Forward an email |
| `add_label` | Add label to email |
| `remove_label` | Remove label from email |
| `list_labels` | List all labels |
| `mark_as_read` | Mark email as read |
| `mark_as_unread` | Mark email as unread |
| `trash_email` | Move to trash |
| `archive_email` | Archive email |
| `create_followup_draft` | Create job follow-up draft |
| `create_thank_you_draft` | Create thank you draft |

### Calendar (5 tools)
| Tool | Description |
|------|-------------|
| `list_calendar_events` | List upcoming events |
| `create_calendar_event` | Create a new event |
| `update_calendar_event` | Update an event |
| `delete_calendar_event` | Delete an event |
| `get_calendar_event` | Get event details |

### Sheets (11 tools)
| Tool | Description |
|------|-------------|
| `create_spreadsheet` | Create new spreadsheet |
| `read_sheet` | Read data from sheet |
| `write_sheet` | Write data to sheet |
| `append_sheet` | Append rows to sheet |
| `get_sheet_info` | Get spreadsheet info |
| `create_sheet_tab` | Create new tab |
| `list_spreadsheets` | List all spreadsheets |
| `format_cells` | Format cells |
| `add_formula` | Add formula to cell |
| `share_spreadsheet` | Share spreadsheet |
| `create_job_tracker` | Create job tracker template |

### Docs (12 tools)
| Tool | Description |
|------|-------------|
| `create_document` | Create new document |
| `read_document` | Read document content |
| `append_to_document` | Append text |
| `format_document_text` | Format text |
| `apply_paragraph_style` | Apply styles |
| `insert_table` | Insert table |
| `insert_bullet_list` | Insert bullet list |
| `insert_numbered_list` | Insert numbered list |
| `list_documents` | List all documents |
| `share_document` | Share document |
| `create_daily_report` | Create report template |

### Drive (17 tools)
| Tool | Description |
|------|-------------|
| `list_files` | List files |
| `list_folders` | List folders |
| `create_folder` | Create folder |
| `upload_file` | Upload file |
| `download_file` | Download file |
| `move_file` | Move file |
| `copy_file` | Copy file |
| `delete_file` | Delete file |
| `search_files` | Search files |
| `share_file` | Share with user |
| `share_file_with_anyone` | Share with link |
| `get_file_metadata` | Get file info |
| `rename_file` | Rename file |
| `get_storage_quota` | Get storage info |
| `export_to_drive` | Export content |

### Local Storage (21 tools)
| Tool | Description |
|------|-------------|
| `set_profile` | Set profile field |
| `get_profile` | Get profile |
| `get_full_profile` | Get complete profile |
| `add_job_application` | Add job application |
| `get_job_applications` | Get applications |
| `update_job_application` | Update application |
| `add_interview` | Add interview |
| `get_interviews` | Get interviews |
| `add_contact` | Add contact |
| `get_contacts` | Get contacts |
| `add_skill` | Add skill |
| `get_skills` | Get skills |
| `add_work_experience` | Add experience |
| `get_work_experience` | Get experience |
| `add_education` | Add education |
| `get_education` | Get education |
| `add_task` | Add task |
| `get_tasks` | Get tasks |
| `complete_task` | Complete task |
| `add_note` | Add note |
| `get_notes` | Get notes |
| `get_job_search_summary` | Get job stats |

### Memory System (22 tools)
| Tool | Description |
|------|-------------|
| `save_about_me` | Save user info |
| `get_about_me` | Get user info |
| `remember` | Remember anything |
| `recall` | Recall memories |
| `add_behavior` | Store behavior pattern |
| `get_behaviors` | Get behaviors |
| `add_preference` | Store preference |
| `get_preferences` | Get preferences |
| `add_goal` | Store goal |
| `get_goals` | Get goals |
| `add_work_style` | Store work style |
| `get_work_style` | Get work style |
| `add_fact` | Store fact |
| `get_facts` | Get facts |
| `add_decision` | Log decision |
| `get_decisions` | Get decisions |
| `add_interaction` | Log interaction |
| `get_interactions` | Get interactions |
| `add_learning` | Store learning |
| `get_learnings` | Get learnings |
| `get_everything_about_user` | Get all user data |
| `search_memory` | Search memories |

---

## Project Structure

```
google-mcp-server/
├── src/
│   ├── mcp_server.py       # Main MCP server (109 tools)
│   ├── google_auth.py      # OAuth authentication
│   ├── google_gmail.py     # Gmail integration
│   ├── google_calendar.py  # Calendar integration
│   ├── google_sheets.py    # Sheets integration
│   ├── google_docs.py      # Docs integration
│   ├── google_drive.py     # Drive integration
│   ├── local_storage.py    # SQLite local storage
│   └── memory_system.py    # Personal memory system
├── credentials.json        # OAuth credentials (create this)
├── tokens.json            # Auth tokens (auto-generated)
├── config.json            # Configuration
├── requirements.txt       # Dependencies
└── README.md
```

---

## Troubleshooting

### Server not loading in Claude Desktop
1. Check the path in `claude_desktop_config.json`
2. Verify Python path is correct
3. Check logs at `%APPDATA%\Claude\logs\mcp-server-google-workspace.log`

### Authentication errors
1. Delete `tokens.json` and re-authenticate
2. Verify `credentials.json` is valid
3. Check that APIs are enabled in Google Cloud Console

### Database errors
1. Verify database folder exists at `~/Documents/pbdb/mcp/`
2. Check file permissions
3. Delete `.db` files to reset (data will be lost)

---

## License

MIT License