Skip to main content

mcs-auth

The authentication backbone for the Model Context Standard (MCS).

Stop wiring OAuth flows, API keys, and token refresh logic into every agent you build. mcs-auth defines a universal CredentialProvider protocol -- one interface, any credential source. Your agent code never changes, no matter how authentication works behind the scenes.

Installation

pip install mcs-auth

What's inside

Component What it does
CredentialProvider Protocol: get_token(scope) -> str. Any provider satisfies it.
AuthPort Protocol for auth transport adapters (OAuth, LinkAuth, Device Flow, ...).
AuthChallenge Exception raised when user interaction is needed (URL + code).
AuthDecorator Decorator wrapping a ToolDriver -- catches auth challenges at the tool execution boundary.
StaticProvider Simple provider: tokens from a dict or environment variables.

Quick start

from mcs.auth.static import StaticProvider

# From a dict
provider = StaticProvider(tokens={"gmail": "ya29.xxx", "openai": "sk-xxx"})
token = provider.get_token("gmail")

# From environment variables (MCS_TOKEN_GMAIL, MCS_TOKEN_OPENAI, ...)
provider = StaticProvider()
token = provider.get_token("gmail")

The big picture

Your agent calls provider.get_token("gmail"). Where that token comes from is none of the agent's business:

CredentialProvider.get_token("gmail")
  |
  +-- StaticProvider          (env vars, dicts)
  +-- Auth0Provider           (Token Vault exchange)  --> mcs-auth-auth0
  +-- OAuthProvider           (browser login)         --> mcs-auth-oauth
  +-- LinkAuthProvider        (device-flow broker)    --> mcs-auth-linkauth

Swap providers without touching agent code. Add new services without new OAuth integrations. That's the power of a protocol-based auth layer.

License

Apache-2.0

Metadata

Release files for mcs-auth 0.4.0

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

Source distribution (sdist)

Source distribution for mcs-auth 0.4.0
File Size Uploaded Provenance Actions
mcs_auth-0.4.0.tar.gz 13.7 kB Without provenance Details for mcs_auth-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mcs-auth 0.4.0
File Interpreter ABI Platform Actions
mcs_auth-0.4.0-py3-none-any.whl Python 3 none any Details for mcs_auth-0.4.0-py3-none-any.whl

Total release size: 26.2 kB

Release files / mcs_auth-0.4.0.tar.gz

Download URL mcs_auth-0.4.0.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5f8a1883df5dc531773f90af3afc12ed12be4cd0f519280c88ca35f10ed25a7c
BLAKE2b-256 checksum
How to use checksums
e4fe59372a6972246d122c97b9a26c1f75c8516abf72907f916919f985a3110d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / mcs_auth-0.4.0-py3-none-any.whl

Download URL mcs_auth-0.4.0-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea9fba45e14827155335675f6fa6e69bf46b63d2cb2bce262eade669c7abddbd
BLAKE2b-256 checksum
How to use checksums
cc675e69132efcd2dad46cd5a6b7e7ba697de1bc2766a72a89f11dc9c1f4a1c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for mcs-auth 0.4.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.

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