@@ -315,27 +315,42 @@ async def long_task(files: list[str], ctx: Context) -> str:
315315Authentication can be used by servers that want to expose tools accessing protected resources.
316316
317317` mcp.server.auth ` implements an OAuth 2.0 server interface, which servers can use by
318- providing an implementation of the ` OAuthServerProvider ` protocol.
318+ providing an implementation of the ` OAuthAuthorizationServerProvider ` protocol.
319319
320- ```
321- mcp = FastMCP("My App",
322- auth_server_provider=MyOAuthServerProvider(),
323- auth=AuthSettings(
324- issuer_url="https://myapp.com",
325- revocation_options=RevocationOptions(
326- enabled=True,
327- ),
328- client_registration_options=ClientRegistrationOptions(
329- enabled=True,
330- valid_scopes=["myscope", "myotherscope"],
331- default_scopes=["myscope"],
332- ),
333- required_scopes=["myscope"],
320+ ``` python
321+ from mcp import FastMCP
322+ from mcp.server.auth.provider import OAuthAuthorizationServerProvider
323+ from mcp.server.auth.settings import (
324+ AuthSettings,
325+ ClientRegistrationOptions,
326+ RevocationOptions,
327+ )
328+
329+
330+ class MyOAuthServerProvider (OAuthAuthorizationServerProvider ):
331+ # See an example on how to implement at `examples/servers/simple-auth`
332+ ...
333+
334+
335+ mcp = FastMCP(
336+ " My App" ,
337+ auth_server_provider = MyOAuthServerProvider(),
338+ auth = AuthSettings(
339+ issuer_url = " https://myapp.com" ,
340+ revocation_options = RevocationOptions(
341+ enabled = True ,
342+ ),
343+ client_registration_options = ClientRegistrationOptions(
344+ enabled = True ,
345+ valid_scopes = [" myscope" , " myotherscope" ],
346+ default_scopes = [" myscope" ],
334347 ),
348+ required_scopes = [" myscope" ],
349+ ),
335350)
336351```
337352
338- See [ OAuthServerProvider ] ( src/mcp/server/auth/provider.py ) for more details.
353+ See [ OAuthAuthorizationServerProvider ] ( src/mcp/server/auth/provider.py ) for more details.
339354
340355## Running Your Server
341356
@@ -462,15 +477,12 @@ For low level server with Streamable HTTP implementations, see:
462477- Stateful server: [ ` examples/servers/simple-streamablehttp/ ` ] ( examples/servers/simple-streamablehttp/ )
463478- Stateless server: [ ` examples/servers/simple-streamablehttp-stateless/ ` ] ( examples/servers/simple-streamablehttp-stateless/ )
464479
465-
466-
467480The streamable HTTP transport supports:
468481- Stateful and stateless operation modes
469482- Resumability with event stores
470- - JSON or SSE response formats
483+ - JSON or SSE response formats
471484- Better scalability for multi-node deployments
472485
473-
474486### Mounting to an Existing ASGI Server
475487
476488> ** Note** : SSE transport is being superseded by [ Streamable HTTP transport] ( https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http ) .
0 commit comments