Skip to main content

Credential provider abstraction for the Model Context Standard.

Project description

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).
AuthMixin Mixin for drivers -- 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.

Links

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcs_auth-0.3.1.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcs_auth-0.3.1-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file mcs_auth-0.3.1.tar.gz.

File metadata

  • Download URL: mcs_auth-0.3.1.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for mcs_auth-0.3.1.tar.gz
Algorithm Hash digest
SHA256 71acb33a06c01f71fadee84796bae56e1caef4ba749e7f748a7a5bd66a0c3a08
MD5 cd2407d3ebde17bff2a4ce4964c849b0
BLAKE2b-256 94474832c99403ffde68224b41878df71def8e60a6724685d9363c00a6f1d663

See more details on using hashes here.

File details

Details for the file mcs_auth-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: mcs_auth-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for mcs_auth-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f791139bee103ae6ce1a99f0ed1d7424d3ef2e9e58ef3b72e036f31e13ffd126
MD5 714c6efcb5d88c5772a987c1ba41c387
BLAKE2b-256 f0d527fc859d0f46927a0cec5b0a13556211431b21fe807bc6b5e4c02246b294

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page