Skip to main content

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

Metadata

Release files for mcs-auth-linkauth 0.4.2

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-linkauth 0.4.2
File Size Uploaded
mcs_auth_linkauth-0.4.2.tar.gz 20.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcs-auth-linkauth 0.4.2
File Interpreter ABI Platform
mcs_auth_linkauth-0.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 34.2 kB

Release files / mcs_auth_linkauth-0.4.2.tar.gz

Download URL mcs_auth_linkauth-0.4.2.tar.gz
Size 20.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cae35fb8ed3a8ac643ae5f78cd4dde204af7c5903f90dec341ba8d82ed15b47e
BLAKE2b-256 checksum
How to use checksums
bf45f4309f5feda4ec6c7af00461fe4d4c810ac16596b628baccbf544823247c
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_linkauth-0.4.2-py3-none-any.whl

Download URL mcs_auth_linkauth-0.4.2-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
851351c2635ddad448e5771d112499989d60518f15e335a0e18dfcba9acd2196
BLAKE2b-256 checksum
How to use checksums
0c3692074708eaab02fcb70efa956a294cda85ec168f56901886bb0677285d09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.4.2 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.1.1

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