This guide walks you through setting up the Google MCP Server with detailed Google Cloud Console configuration.
- Python 3.12 or higher
uvfor dependency management- A Google account
- Claude Desktop or MCP-compatible client
- Go to the Google Cloud Console
- Click on the project selector dropdown (top-left, next to "Google Cloud")
- Click "New Project"
- Enter a project name (e.g., "claude-google-integration")
- Select your organization (if applicable)
- Click "Create"
- Wait for the project to be created and make sure it's selected
- In the Google Cloud Console, navigate to "APIs & Services" > "Library"
- Search for and enable the following APIs (click on each, then click "Enable"):
- Google Drive API
- Gmail API
- Google Calendar API
- People API (for contacts and user profile information)
- Go to "APIs & Services" > "OAuth consent screen"
- Choose "External" user type (unless you're using Google Workspace)
- Click "Create"
- Fill in the required information:
- App name: Choose a name (e.g., "Claude Google Integration")
- User support email: Your email address
- Developer contact information: Your email address
- Click "Save and Continue"
- On the "Scopes" page, click "Save and Continue" (we'll add scopes in our application)
- On the "Test users" page, add your email address to test the integration
- Click "Save and Continue"
- Review and click "Back to Dashboard"
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth client ID"
- Choose "Desktop application" as the application type
- Enter a name (e.g., "Google MCP Server")
- Click "Create"
- A dialog will appear with your client ID and client secret
- Important: Copy both the Client ID and Client Secret - you'll need these for the MCP server
- In the Credentials page, click on your newly created OAuth client ID
- Under "Authorized redirect URIs", add:
http://localhost:8080 - Click "Save"
Note: The default redirect URI is http://localhost:8080. If you need to use a different port, make sure to update both the Google Cloud Console configuration and your .env file.
# Clone or download the repository
git clone https://github.com/robcerda/google-mcp-server
cd google-mcp-server
# Install dependencies with uv
uv sync
# Test the server works
uv run python test_cli.pyCopy the example environment file and configure your Google OAuth2 credentials:
cp .env.example .envEdit the .env file with your Google Cloud Console credentials:
# Google OAuth2 Configuration
GOOGLE_CLIENT_ID=your_client_id_here.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your_client_secret_here
# Optional: Custom redirect URI (defaults to http://localhost:8080)
# GOOGLE_REDIRECT_URI=http://localhost:8080
# Optional: Additional scopes (space-separated)
# GOOGLE_ADDITIONAL_SCOPES=https://www.googleapis.com/auth/spreadsheetsAdd the server to your Claude Desktop configuration file:
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\\Claude\\claude_desktop_config.json
{
"mcpServers": {
"google-services": {
"command": "/path/to/google-mcp-server/.venv/bin/mcp",
"args": [
"run",
"/path/to/google-mcp-server/server.py"
]
}
}
}Example with full path:
{
"mcpServers": {
"google-services": {
"command": "/Users/rob/Scripts/google-mcp-server/.venv/bin/mcp",
"args": [
"run",
"/Users/rob/Scripts/google-mcp-server/server.py"
]
}
}
}Alternative using uv (if MCP path issues):
{
"mcpServers": {
"google-services": {
"command": "/opt/homebrew/bin/uv",
"args": [
"run",
"--with",
"mcp[cli]",
"mcp",
"run",
"/Users/rob/Scripts/google-mcp-server/server.py"
],
"cwd": "/Users/rob/Scripts/google-mcp-server"
}
}
}Note: Use the full path to uv (find yours with which uv) to ensure Claude Desktop can locate it.
Before using with Claude Desktop, test the server:
# Test authentication and API access
uv run python test_cli.py
# Test the MCP server directly
uv run mcp run server.pyWhen you first use the server, it will automatically launch your browser for OAuth2 authentication:
- The server will open your default browser
- Sign in to your Google account
- Grant the requested permissions
- The browser will redirect to a success page
- Return to Claude - you're now authenticated!
Your credentials will be securely stored locally in ~/.config/google-mcp-server/token.json.
You can add additional Google API scopes by setting the GOOGLE_ADDITIONAL_SCOPES environment variable:
GOOGLE_ADDITIONAL_SCOPES=https://www.googleapis.com/auth/spreadsheets https://www.googleapis.com/auth/contactsIf you need to use a different port for the OAuth2 callback:
GOOGLE_REDIRECT_URI=http://localhost:9000Make sure to update the authorized redirect URIs in your Google Cloud Console accordingly.
- Local Storage: Credentials are stored locally in
~/.config/google-mcp-server/ - Token Refresh: Access tokens are automatically refreshed using stored refresh tokens
- Scope Limitation: Only request the minimum required scopes for functionality
- No Server Storage: No credentials or tokens are sent to external servers