MCPcopy Index your code
hub / github.com/modelcontextprotocol/python-sdk / as_app

Function as_app

tests/interaction/auth/test_as_handlers.py:32–42  ·  view source on GitHub ↗

Co-host the SDK's authorization-server routes and yield a raw httpx client against them.

()

Source from the content-addressed store, hash-verified

30
31@pytest.fixture
32async def as_app() -> AsyncIterator[tuple[httpx.AsyncClient, InMemoryAuthorizationServerProvider]]:
33 """Co-host the SDK's authorization-server routes and yield a raw httpx client against them."""
34 provider = InMemoryAuthorizationServerProvider()
35 settings = auth_settings()
36 async with mounted_app(
37 Server("guarded"),
38 auth=settings,
39 token_verifier=ProviderTokenVerifier(provider),
40 auth_server_provider=provider,
41 ) as (http, _):
42 yield http, provider
43
44
45def _pkce_pair() -> tuple[str, str]:

Callers

nothing calls this directly

Calls 5

auth_settingsFunction · 0.90
mounted_appFunction · 0.90
ServerClass · 0.90

Tested by

no test coverage detected