Skip to main content
Glama
grat-cellpm

Google MCP Server

by grat-cellpm
README.md
# Google MCP Server

A Python-based MCP-style server using FastAPI that integrates with Google Docs and Gmail.
Before executing any action (e.g., appending to a doc, creating an email draft), it will prompt for your approval in the terminal.

## Setup Instructions

### 1. Enable APIs & Download Credentials
1. Go to the [Google Cloud Console](https://console.cloud.google.com/).
2. Create a new project or select an existing one.
3. Navigate to **APIs & Services > Library** and enable:
   - **Google Docs API**
   - **Gmail API**
4. Navigate to **APIs & Services > OAuth consent screen** and configure it (you can set it to "External" and add yourself as a test user). Add these scopes:
   - `https://www.googleapis.com/auth/documents`
   - `https://www.googleapis.com/auth/gmail.compose`
5. Navigate to **APIs & Services > Credentials**.
6. Click **Create Credentials > OAuth client ID**.
7. Choose **Desktop app** as the application type.
8. Download the JSON file, rename it to `credentials.json`, and place it in this directory (`google-mcp-server/`).

### 2. Install Dependencies
```bash
pip install -r requirements.txt
```

### 3. Run the Server
```bash
python server.py
```

On the first run, a browser window will open asking you to log in with your Google Account and authorize the application. Once authorized, a `token.json` file will be generated automatically, so you won't need to log in again.

## API Endpoints

### Append to Google Doc
**POST** `/append_to_doc`
```json
{
  "doc_id": "your_document_id_here",
  "content": "Hello world!"
}
```

### Create Email Draft
**POST** `/create_email_draft`
```json
{
  "to": "example@example.com",
  "subject": "Hello",
  "body": "This is an email draft."
}
```