home / mcp / google oauth mcp server

Google OAuth MCP Server

Provides a remote MCP server with Google OAuth and analytics for tool usage, performance, and user activity.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "bighadj22-cloudflare-mcp-google-oauth-analytics": {
      "url": "https://mcp-google-oauth.<your-subdomain>.workers.dev/sse",
      "headers": {
        "HOSTED_DOMAIN": "OPTIONAL_HOSTED_DOMAIN",
        "GOOGLE_CLIENT_ID": "YOUR_GOOGLE_CLIENT_ID",
        "GOOGLE_CLIENT_SECRET": "YOUR_GOOGLE_CLIENT_SECRET",
        "COOKIE_ENCRYPTION_KEY": "YOUR_COOKIE_ENCRYPTION_KEY",
        "MCP_ANALYTICS_API_KEY": "YOUR_ANALYTICS_API_KEY"
      }
    }
  }
}

This MCP server provides a remote, Google OAuth–based Model Context Protocol experience with built‑in analytics. You can deploy it to Cloudflare Workers, let users sign in with Google, and automatically track tool usage, performance, and user behavior for insights and optimization.

How to use

You connect to your remote MCP server from an MCP client or Claude Desktop to run tools like the built‑in add function. After authentication, tools are available per user and session, with analytics automatically captured to reveal usage patterns, successes, failures, and performance.

From a configured MCP client, you will access tools over your server URL and invoke them through the client’s interface. The server handles authentication via Google OAuth, and analytics are linked to the authenticated user so you can review activity in your analytics dashboard.

If you are using Claude Desktop or Cursor, you will connect using the provided MCP endpoints. After a successful login, you can list available tools and execute them with your inputs. The analytics system will automatically record tool execution times, input data (redacted as needed), results, and any errors.

How to install

Prerequisites you need before installing: Node.js and npm, and an active Cloudflare account with Wrangler installed.

1. Create a new Google Cloud OAuth App and capture the Client ID and Client Secret. 2. Install dependencies and prepare secrets. 3. Deploy to Cloudflare Workers and verify the remote MCP server is reachable.

Run the following steps exactly as shown to configure secrets and deploy.

wrangler secret put GOOGLE_CLIENT_ID
wrangler secret put GOOGLE_CLIENT_SECRET
wrangler secret put COOKIE_ENCRYPTION_KEY # add any random string here e.g. openssl rand -hex 32
wrangler secret put HOSTED_DOMAIN # optional: use this when restrict google account domain
wrangler secret put MCP_ANALYTICS_API_KEY # your analytics API key from mcpanalytics.dev

# Set up a KV namespace
wrangler kv:namespace create "OAUTH_KV"
# Update Wrangler config with the KV ID in your project

# Deploy to make it available at your workers.dev URL
wrangler deploy

Additional sections

Configuration and access control are achieved through Google OAuth. The server can restrict access to hosted domains by setting HOSTED_DOMAIN. Analytics are powered by the MCP Analytics service and can be viewed at your analytics dashboard.

Environment variables you will set include GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, COOKIE_ENCRYPTION_KEY, HOSTED_DOMAIN (optional), and MCP_ANALYTICS_API_KEY. These values enable OAuth, secure sessions, domain restriction, and analytics collection.

You can test the remote MCP server via the Claude Desktop integration by adding your server URL and initiating authentication. After login, the Tools section will display available tools like add, and you can perform an example operation to see the results and analytics in action.

Security best practices: keep OAuth client secrets confidential, rotate secrets periodically, and restrict hosted domains to prevent unauthorized access. Regularly review analytics to detect anomalous usage patterns or failures.

MCP connection configurations

{
  "mcpServers": {
    "google_oauth": {
      "type": "http",
      "url": "https://mcp-google-oauth.<your-subdomain>.workers.dev/sse",
      "args": []
    },
    "mcp_remote": {
      "type": "stdio",
      "command": "npx",
      "args": ["mcp-remote", "https://mcp-google-oauth.<your-subdomain>.workers.dev/sse"]
    }
  }
}

After you add these configurations, restart your MCP client to load the new servers. The http server is the preferred method, with the stdio option available for local tooling via npx.

Available tools

add

Tool that adds two numbers. Accepts two numeric inputs and returns their sum. This tool is available after successful authentication and is tracked by analytics for usage and performance.

Google OAuth MCP Server - bighadj22/cloudflare-mcp-google-oauth-analytics