Skip to main content

LinkAuth credential broker connector for the Model Context Standard.

Project description

mcs-auth-linkauth

Authentication for agents that can't open a browser. LinkAuth credential broker connector for the Model Context Standard (MCS).

CLI tools, Telegram bots, background workers, Docker containers -- your agent shows a URL and a code, the user authenticates on any device, and the agent picks up the credentials automatically. No localhost callback. No web server. No browser on the agent's machine.

Think of it as the Device Flow experience, but for any credential type -- OAuth tokens, API keys, passwords, or custom secrets.

Installation

pip install mcs-auth-linkauth

Quick start

from mcs.auth.linkauth import LinkAuthProvider

provider = LinkAuthProvider(
    broker_url="https://auth.example.com",
    template="google_mail",
    display_name="Gmail Access",
)

try:
    token = provider.get_token("gmail")
except AuthChallenge as e:
    # Show this to the user via LLM, Telegram, CLI, ...
    print(f"Open {e.url} and enter code {e.code}")

How it works

Agent                     LinkAuth Broker              User
  |                            |                        |
  |-- create session --------->|                        |
  |   (public_key, template)   |                        |
  |<-- url + code ------------|                        |
  |                            |                        |
  |-- raise AuthChallenge ---->|                        |
  |   "Open URL, enter ABCD"  |                        |
  |                            |<-- user opens URL -----|
  |                            |    enters code         |
  |                            |    provides credentials|
  |                            |    (encrypted w/ pubkey)|
  |                            |                        |
  |-- poll ------------------->|                        |
  |<-- encrypted credentials --|                        |
  |-- decrypt (private key) -->|                        |
  |                            |                        |
  | token ready!               |                        |

Zero-knowledge: For form-based credentials (API keys, passwords), the broker encrypts with the agent's public key in the browser. The broker never sees the plaintext. For OAuth flows, the broker briefly handles tokens server-side before encrypting -- a documented trade-off.

Use with Auth0 Token Vault

The killer combo -- LinkAuth's device-flow UX with Auth0's multi-provider Token Vault:

from mcs.auth.auth0 import Auth0Provider
from mcs.auth.linkauth import LinkAuthConnector

provider = Auth0Provider(
    domain="my-tenant.auth0.com",
    client_id="...",
    client_secret="...",
    _auth=LinkAuthConnector(
        broker_url="https://auth.example.com",
        oauth_provider="auth0",
        oauth_scopes=["openid", "email", "offline_access"],
        oauth_extra_params={"audience": "...", "connection": "google-oauth2"},
        display_name="Gmail Access",
    ),
)

# Agent shows URL + code, user authenticates, Token Vault does the rest
token = provider.get_token("gmail")

Supported credential types

Template What the user sees
api_key Single password field
basic_auth Username + password form
openai, anthropic Branded API key form
google_mail, github, ... OAuth consent flow
Custom Define your own fields or OAuth provider

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_linkauth-0.4.1.tar.gz (20.3 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_linkauth-0.4.1-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file mcs_auth_linkauth-0.4.1.tar.gz.

File metadata

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

File hashes

Hashes for mcs_auth_linkauth-0.4.1.tar.gz
Algorithm Hash digest
SHA256 461f355880f4915a4d345f4c083620e58780c4bf99a51d82da77022013173b52
MD5 07b84fcf31e8dfe0e8d8786c5054dfe0
BLAKE2b-256 53c21eeb04d47805c9b8a4652ef2c0ac79fea88303a2de48b969343dd69b605d

See more details on using hashes here.

File details

Details for the file mcs_auth_linkauth-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mcs_auth_linkauth-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e4edf9e419d0d930843ee9c60b27d21f21a7f4ab4352db6510a27182cf134971
MD5 ff34189f0da501c40a58b3fed37eea0c
BLAKE2b-256 cce52cd5ff3c4ff40f5351c6ccaece022a5a1ceadfedd3eb3e973864c1f52356

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