mcs-auth-oauth
OAuth 2.0 for AI agents. Authorization Code Flow with PKCE connector for the Model Context Standard (MCS).
A 5-second localhost callback server and your agent has an OAuth token. Works with any OAuth 2.0 provider -- Google, Auth0, Microsoft, GitHub, you name it.
Installation
pip install mcs-auth-oauth
Quick start
from mcs.auth.oauth import OAuthProvider
provider = OAuthProvider(
authorize_url="https://accounts.google.com/o/oauth2/v2/auth",
token_url="https://oauth2.googleapis.com/token",
client_id="...",
client_secret="...",
scopes={"gmail": "https://mail.google.com/"},
)
# Opens browser, user logs in, token returned
token = provider.get_token("gmail")
How it works
- Agent calls
get_token("gmail") - Browser opens with the provider's consent screen
- User logs in and grants access
- Localhost callback receives the authorization code
- Code is exchanged for tokens (with PKCE)
- Token returned to agent -- done
The entire flow happens in a single get_token() call. The localhost
server lives for exactly one request and shuts down immediately.
Use with Auth0 Token Vault
from mcs.auth.auth0 import Auth0Provider
from mcs.auth.oauth import OAuthConnector
provider = Auth0Provider(
domain="my-tenant.auth0.com",
client_id="...",
client_secret="...",
_auth=OAuthConnector(
authorize_url="https://my-tenant.auth0.com/authorize",
token_url="https://my-tenant.auth0.com/oauth/token",
client_id="...",
client_secret="...",
extra_params={"connection": "google-oauth2", "audience": "..."},
),
)
Links
- Homepage: https://www.modelcontextstandard.io
- Source: https://github.com/modelcontextstandard/python-sdk
License
Apache-2.0
Metadata
Release files for mcs-auth-oauth 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcs_auth_oauth-0.3.0.tar.gz | 13.0 kB | Without provenance | Details for mcs_auth_oauth-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcs_auth_oauth-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for mcs_auth_oauth-0.3.0-py3-none-any.whl |
Total release size: 24.8 kB
Release files / mcs_auth_oauth-0.3.0.tar.gz
| Download URL | mcs_auth_oauth-0.3.0.tar.gz |
|---|---|
| Size | 13.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
62eb320a6e43e9c39a138b39a0e6f3811e1fa9a9c5135ee1caf2933c8ca2864a
|
|
BLAKE2b-256 checksum How to use checksums |
82b62b2830a7e9a5f83dfd341fb5a22bf72c0a13342ff6b687792dbaaf5f596d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.5
|
Release files / mcs_auth_oauth-0.3.0-py3-none-any.whl
| Download URL | mcs_auth_oauth-0.3.0-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
daba1cb19f2f14dd96d7f712574decf98f762ee6f403faadb8ef83d20f2323c2
|
|
BLAKE2b-256 checksum How to use checksums |
2d5cb789989c30538e08e33bc1a189a4f58cf10a0c97be0515b9758b178b77be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.5
|
Security for mcs-auth-oauth 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.