- Go to: https://console.cloud.google.com/
- Click "Select a project" → "New Project"
- Project name:
brain-gmail-integration - Click "Create"
- In the Google Cloud Console, go to "APIs & Services" → "Library"
- Search for "Gmail API"
- Click "Gmail API" → "Enable"
- Go to "APIs & Services" → "Credentials"
- Click "Create Credentials" → "OAuth client ID"
- If prompted, configure OAuth consent screen:
- User Type: "External" (unless you have Google Workspace)
- App name: "Brain Gmail Integration"
- User support email: Your email
- Developer contact: Your email
- Click "Save and Continue" through the scopes and test users sections
- Back to Credentials → "Create Credentials" → "OAuth client ID"
- Application type: "Desktop application"
- Name: "Brain Gmail Client"
- Click "Create"
- IMPORTANT: Download the JSON file (click Download button)
- Save it as
/Users/tarive/brain-poc/gmail_credentials.json
cd /Users/tarive/brain-poc
git clone https://github.com/jeremyjordan/mcp-gmail.git
cd mcp-gmail
pip install -e .uv add mcp-gmailAdd this to your ~/.claude.json file:
{
"mcpServers": {
"gmail": {
"type": "stdio",
"command": "python",
"args": ["-m", "mcp_gmail"],
"env": {
"GMAIL_CREDENTIALS_PATH": "/Users/tarive/brain-poc/gmail_credentials.json",
"GMAIL_TOKEN_PATH": "/Users/tarive/brain-poc/gmail_token.json"
}
}
}
}# Test if the server can start
python -m mcp_gmail --helpThe first time you use the Gmail MCP server, it will:
- Open your web browser
- Ask you to sign in to your Google account
- Request permissions for Gmail access
- Save authentication token to
gmail_token.json
# Add these functions to brain_global_commands.sh
# Send email to founder
brain_email_founder() {
if [ $# -lt 3 ]; then
echo "Usage: brain_email_founder <email> <subject> <message>"
echo "Example: brain_email_founder founder@startup.com 'Partnership Inquiry' 'Hi, I would like to discuss...'"
return 1
fi
local founder_email="$1"
local subject="$2"
local message="$3"
echo "📧 Sending email to $founder_email"
# Store in brain system first
brain_store "<people>$founder_email</people> emailed about: $subject"
# Note: Actual Gmail sending will be through Claude MCP integration
echo "Email composed and logged in brain system"
echo "Subject: $subject"
echo "To: $founder_email"
echo "Message: $message"
}
# Search founder emails
brain_search_founder_emails() {
if [ $# -lt 1 ]; then
echo "Usage: brain_search_founder_emails <founder_name_or_email>"
return 1
fi
local founder="$1"
echo "🔍 Searching emails for: $founder"
# Search brain system records
brain_search "$founder" --tag people
}
# List recent founder communications
brain_founder_communications() {
echo "📊 Recent Founder Communications:"
brain_search "emailed about" --tag people | head -10
}# Test brain integration
brain_email_founder "test@example.com" "Test Subject" "This is a test message"
# Check if it was stored
brain_search "test@example.com" --tag people# Check if Gmail MCP is connected
claude mcp list | grep gmail- Use:
brain_email_founder founder@startup.com "Partnership" "Hello, I'd like to discuss..." - Brain system logs the interaction
- Claude MCP sends the actual email via Gmail API
- Confirmation stored in brain system
- All founder emails automatically tagged with
<people>email</people> - Searchable by founder name or email
- Integrated with 5-dimensional tracking system
- Stored in Basic Memory for persistence
- "No module named mcp_gmail": Reinstall with
pip install -e . - Authentication errors: Delete
gmail_token.jsonand re-authenticate - Permission denied: Check OAuth scopes include Gmail send permission
- MCP connection failed: Verify path in
~/.claude.json
# Check OAuth token status
ls -la /Users/tarive/brain-poc/gmail_token.json
# Test credentials file
cat /Users/tarive/brain-poc/gmail_credentials.json | jq .
# Verify MCP server
python -m mcp_gmail --version- Never commit
gmail_credentials.jsonorgmail_token.jsonto git - Store credentials securely
- Use environment variables for production deployments
- Regularly review OAuth permissions in Google Account settings
Next Steps:
- Complete Google Cloud setup
- Download credentials.json file
- Install MCP server
- Test integration with Claude
- Add brain system commands