diff --git a/README.md b/README.md index 3889dc40..75332644 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ - [Prompts](#prompts) - [Images](#images) - [Context](#context) + - [Authentication](#authentication) - [Running Your Server](#running-your-server) - [Development Mode](#development-mode) - [Claude Desktop Integration](#claude-desktop-integration) @@ -316,21 +317,29 @@ Authentication can be used by servers that want to expose tools accessing protec `mcp.server.auth` implements an OAuth 2.0 server interface, which servers can use by providing an implementation of the `OAuthServerProvider` protocol. -``` -mcp = FastMCP("My App", - auth_provider=MyOAuthServerProvider(), - auth=AuthSettings( - issuer_url="https://myapp.com", - revocation_options=RevocationOptions( - enabled=True, - ), - client_registration_options=ClientRegistrationOptions( - enabled=True, - valid_scopes=["myscope", "myotherscope"], - default_scopes=["myscope"], - ), - required_scopes=["myscope"], +```python +from mcp.server.auth.settings import ( + AuthSettings, + ClientRegistrationOptions, + RevocationOptions, +) +from mcp.server.fastmcp import FastMCP + +mcp = FastMCP( + "My App", + auth_provider=MyOAuthServerProvider(), + auth=AuthSettings( + issuer_url="https://myapp.com", + revocation_options=RevocationOptions( + enabled=True, + ), + client_registration_options=ClientRegistrationOptions( + enabled=True, + valid_scopes=["myscope", "myotherscope"], + default_scopes=["myscope"], ), + required_scopes=["myscope"], + ), ) ```