Skip to main content

mcp-remote-auth

Shared OAuth infrastructure for MCP remote servers. Extracts the common OAuth proxy pattern used by gmail-mcp-remote, gcal-mcp-remote, notion-mcp-remote, and linkedin-scheduler-remote into a reusable library.

Install

pip install mcp-remote-auth-ldraney

Usage

from mcp_remote_auth import (
    ProviderConfig, TokenStore, OAuthProxyProvider,
    configure_mcp_auth, configure_transport_security,
    register_standard_routes, register_onboarding_routes,
    build_app_with_middleware,
)

config = ProviderConfig(
    provider_name="Gmail",
    authorize_url="https://accounts.google.com/o/oauth2/auth",
    token_url="https://oauth2.googleapis.com/token",
    client_id=os.environ["OAUTH_CLIENT_ID"],
    client_secret=os.environ["OAUTH_CLIENT_SECRET"],
    base_url=os.environ["BASE_URL"],
    scopes="https://www.googleapis.com/auth/gmail.readonly",
    extra_authorize_params={"access_type": "offline", "prompt": "consent"},
    upstream_token_key="google_refresh_token",
    upstream_response_token_field="refresh_token",
)

store = TokenStore(secret=os.environ["SESSION_SECRET"])
provider = OAuthProxyProvider(store=store, config=config)

configure_mcp_auth(mcp, provider, BASE_URL)
configure_transport_security(mcp, BASE_URL, os.environ.get("ADDITIONAL_ALLOWED_HOSTS", ""))
register_standard_routes(mcp, provider, BASE_URL)
register_onboarding_routes(mcp, provider, store, config, os.environ.get("ONBOARD_SECRET", ""))

app = build_app_with_middleware(mcp, use_body_inspection=True)
uvicorn.run(app, host="0.0.0.0", port=8000)

Metadata

Release files for mcp-remote-auth-ldraney 0.1.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 mcp-remote-auth-ldraney 0.1.0
File Size Uploaded
mcp_remote_auth_ldraney-0.1.0.tar.gz 16.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-remote-auth-ldraney 0.1.0
File Interpreter ABI Platform
mcp_remote_auth_ldraney-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.3 kB

Release files / mcp_remote_auth_ldraney-0.1.0.tar.gz

Download URL mcp_remote_auth_ldraney-0.1.0.tar.gz
Size 16.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f7886d149d65999b5b14d6088380dd885ab784ad069724d47e12498d0734b3e5
BLAKE2b-256 checksum
How to use checksums
ff31d65dd224beb3166d20fc4257993080a168e4a93d6a993a288019c9572993
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / mcp_remote_auth_ldraney-0.1.0-py3-none-any.whl

Download URL mcp_remote_auth_ldraney-0.1.0-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91835de9e1bbc5700128e60e8dd6f3dc7f4a63532df2c49897c1ed64b748c03c
BLAKE2b-256 checksum
How to use checksums
d1b9c78f3dc659c01bb009f8b1e0ee5910dc7e69b0a5b17b854451d0ae9e9212
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

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