Skip to main content

FastMCP integration for Keycard OAuth client with automated token exchange and authentication

Project description

keycardai-fastmcp

FastMCP integration for Keycard OAuth: protect FastMCP servers with Keycard authentication and run delegated OAuth 2.0 token exchange (RFC 8693) for downstream APIs.

This is the canonical home for the integration; keycardai-mcp-fastmcp is preserved as a deprecation bridge for callers still on the old name.

Installation

pip install keycardai-fastmcp

Quick Start

from fastmcp import FastMCP, Context
from keycardai.fastmcp import AuthProvider

auth_provider = AuthProvider(
    zone_id="abc1234",
    mcp_server_name="My Server",
    mcp_base_url="http://localhost:8000",
)

mcp = FastMCP("My Server", auth=auth_provider.get_remote_auth_provider())

@mcp.tool()
@auth_provider.grant("https://api.example.com")
async def call_external_api(ctx: Context, query: str):
    keycardai = await ctx.get_state("keycardai")
    token = keycardai.access("https://api.example.com").access_token
    return f"Results for {query} (token starts with {token[:8]})"

Migration from keycardai-mcp-fastmcp

The old package keeps working: from keycardai.mcp.integrations.fastmcp import AuthProvider emits a DeprecationWarning pointing here and returns the same class. Migrate when convenient.

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

keycardai_fastmcp-0.3.0.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

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

keycardai_fastmcp-0.3.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file keycardai_fastmcp-0.3.0.tar.gz.

File metadata

  • Download URL: keycardai_fastmcp-0.3.0.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for keycardai_fastmcp-0.3.0.tar.gz
Algorithm Hash digest
SHA256 90e1f775a4290e7f1b7f9e4054565435c71b2c0141026e67634282ce5c79fdbe
MD5 baadc3e9a16baf5016321e7ec31e3f92
BLAKE2b-256 a7d35cc5083dc8804a8f837759cfaf8d6872af5e175814f73a55761fc81c9dfa

See more details on using hashes here.

File details

Details for the file keycardai_fastmcp-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: keycardai_fastmcp-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for keycardai_fastmcp-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 03b61fa09b59644e2668d881d39a8977d123f3d39af4fcfc15d488b5c8cbe2a2
MD5 c1f56569ec21718dd5efa7422343a9e9
BLAKE2b-256 da00d66b2041a482910be4ec07ea641b67b880c444f08c0c4825a8409f7435c5

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