Google Search Console + GA4 MCP Server
Google Search Console + GA4 MCP Server for Vercel
This project is a Vercel-hosted Node.js MCP server for ChatGPT. It uses Google OAuth 2.0 with read-only scopes only and exposes these MCP tools:
list_search_console_sitesquery_search_consolelist_ga4_propertiesrun_ga4_report
Routes
GET /mcpandPOST /mcpfor the public MCP endpointGET /auth/google/startto begin Google OAuthGET /auth/google/callbackfor the Google OAuth callbackPOST /oauth/tokenfor OAuth token exchangeGET /.well-known/oauth-authorization-serverGET /.well-known/oauth-protected-resource
Required environment variables
GOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRETAPP_BASE_URLAPP_ENCRYPTION_KEY
You can copy .env.example locally and fill in your values.
Generate APP_ENCRYPTION_KEY as a base64-encoded 32-byte secret. Example:
[Convert]::ToBase64String((1..32 | ForEach-Object { Get-Random -Minimum 0 -Maximum 256 }))Google Cloud setup
Create a Google Cloud project.
Enable these APIs:
Google Search Console API
Google Analytics Data API
Google Analytics Admin API
Create OAuth 2.0 credentials for a Web application.
Add this authorized redirect URI:
https://YOUR-VERCEL-DOMAIN/auth/google/callbackScopes used
https://www.googleapis.com/auth/webmasters.readonlyhttps://www.googleapis.com/auth/analytics.readonly
Deploy to Vercel
Import the repo into Vercel.
Set the environment variables above.
Deploy.
Confirm these URLs respond:
//.well-known/oauth-authorization-server/.well-known/oauth-protected-resource/mcp
Local development
npm install
npm run devOr run the Express server directly:
npm startNotes
This server keeps its OAuth state stateless by encrypting tokens instead of storing them in a database.
The MCP endpoint accepts bearer tokens and also supports the browser session cookie set after OAuth completion.