Metadata-Version: 2.4
Name: keycardai-fastmcp
Version: 0.2.0
Summary: FastMCP integration for Keycard OAuth client with automated token exchange and authentication
Project-URL: Homepage, https://github.com/keycardai/python-sdk
Project-URL: Repository, https://github.com/keycardai/python-sdk
Project-URL: Documentation, https://docs.keycardai.com
Project-URL: Issues, https://github.com/keycardai/python-sdk/issues
Author-email: Keycard <support@keycard.ai>
License: MIT
Keywords: authentication,fastmcp,keycard,mcp,model-context-protocol,oauth,token-exchange
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP :: Session
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: fastmcp>=3.0.0
Requires-Dist: httpx>=0.27.2
Requires-Dist: keycardai-mcp>=0.15.0
Requires-Dist: keycardai-oauth>=0.7.0
Requires-Dist: pydantic-settings>=2.7.1
Requires-Dist: pydantic>=2.11.7
Provides-Extra: test
Requires-Dist: pytest-asyncio>=1.1.0; extra == 'test'
Requires-Dist: pytest>=8.4.1; extra == 'test'
Description-Content-Type: text/markdown

# 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

```bash
pip install keycardai-fastmcp
```

## Quick Start

```python
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.
