Skip to main content

MCP B2C OAuth

A project for implementing Google OAuth2 client app B2C authentication for the MCP platform.

Overview

This project provides integration with Google OAuth2 for authentication and authorization within the MCP (Model Context Protocol) platform. It enables secure user authentication through Google's identity platform.

Features

  • Google OAuth2 integration
  • OAuth 2.0 authentication flow
  • Token management
  • User profile retrieval
  • Role-based access control

Installation

uv sync

Configuration

Modify .env file in the root directory with the following variables:

MCP_CLIENT_ID=<YOUR_GOOGLE_CLIENT_ID>
MCP_CLIENT_SECRET=<YOUR_GOOGLE_CLIENT_SECRET>

Usage

Start the development server:

uv run .

Authentication Flow

  1. User is redirected to Google OAuth2 login page
  2. After successful authentication, Google redirects to the callback URL
  3. Application validates the received token
  4. User session is established

API Reference

Authentication Endpoints

  • GET /callback - Handles the OAuth callback
  • GET /.well-known/oauth-authorization-server - Auth Server Details
    • GET /authorize - Used by MCP Clients to authorize with the server
    • GET /token - Used by MCP Clients to get token from code
    • GET /register - Used by MCP Clients to register themselves to server

Development

Prerequisites

  • Python 3.13+
  • Google Cloud Platform account with OAuth 2.0 client credentials

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

Name - kv.coder@gmail.com

Project Link: https://github.com/ksankaran/mcp-b2c-oauth

Metadata

Release files for iflow-mcp_ksankaran_mcp-b2c-oauth 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iflow-mcp_ksankaran_mcp-b2c-oauth 0.1.1
File Size Uploaded
iflow_mcp_ksankaran_mcp_b2c_oauth-0.1.1.tar.gz 10.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iflow-mcp_ksankaran_mcp-b2c-oauth 0.1.1
File Interpreter ABI Platform
iflow_mcp_ksankaran_mcp_b2c_oauth-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.5 kB

Release files / iflow_mcp_ksankaran_mcp_b2c_oauth-0.1.1.tar.gz

Download URL iflow_mcp_ksankaran_mcp_b2c_oauth-0.1.1.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3b79972b3287c263b6284db146fe64711c5ff2b8a0a9d670da37f976c6926209
BLAKE2b-256 checksum
How to use checksums
f9e21db73b4eb0ca0792d491404668ce417d00f9a4e67485048e115ef258baec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / iflow_mcp_ksankaran_mcp_b2c_oauth-0.1.1-py3-none-any.whl

Download URL iflow_mcp_ksankaran_mcp_b2c_oauth-0.1.1-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9384486604d8be18fc672c1016c9ce20f7a3f4dcaa72072e51e32058ecc8575d
BLAKE2b-256 checksum
How to use checksums
6ce9c13a02c36862829c4a13c9a944467f132959c396ccc5e0f092f907869ed2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page