|
30 | 30 | - [Prompts](#prompts) |
31 | 31 | - [Images](#images) |
32 | 32 | - [Context](#context) |
| 33 | + - [Authentication](#authentication) |
33 | 34 | - [Running Your Server](#running-your-server) |
34 | 35 | - [Development Mode](#development-mode) |
35 | 36 | - [Claude Desktop Integration](#claude-desktop-integration) |
@@ -316,21 +317,29 @@ Authentication can be used by servers that want to expose tools accessing protec |
316 | 317 | `mcp.server.auth` implements an OAuth 2.0 server interface, which servers can use by |
317 | 318 | providing an implementation of the `OAuthServerProvider` protocol. |
318 | 319 |
|
319 | | -``` |
320 | | -mcp = FastMCP("My App", |
321 | | - auth_provider=MyOAuthServerProvider(), |
322 | | - auth=AuthSettings( |
323 | | - issuer_url="https://myapp.com", |
324 | | - revocation_options=RevocationOptions( |
325 | | - enabled=True, |
326 | | - ), |
327 | | - client_registration_options=ClientRegistrationOptions( |
328 | | - enabled=True, |
329 | | - valid_scopes=["myscope", "myotherscope"], |
330 | | - default_scopes=["myscope"], |
331 | | - ), |
332 | | - required_scopes=["myscope"], |
| 320 | +```python |
| 321 | +from mcp.server.auth.settings import ( |
| 322 | + AuthSettings, |
| 323 | + ClientRegistrationOptions, |
| 324 | + RevocationOptions, |
| 325 | +) |
| 326 | +from mcp.server.fastmcp import FastMCP |
| 327 | + |
| 328 | +mcp = FastMCP( |
| 329 | + "My App", |
| 330 | + auth_provider=MyOAuthServerProvider(), |
| 331 | + auth=AuthSettings( |
| 332 | + issuer_url="https://myapp.com", |
| 333 | + revocation_options=RevocationOptions( |
| 334 | + enabled=True, |
| 335 | + ), |
| 336 | + client_registration_options=ClientRegistrationOptions( |
| 337 | + enabled=True, |
| 338 | + valid_scopes=["myscope", "myotherscope"], |
| 339 | + default_scopes=["myscope"], |
333 | 340 | ), |
| 341 | + required_scopes=["myscope"], |
| 342 | + ), |
334 | 343 | ) |
335 | 344 | ``` |
336 | 345 |
|
|
0 commit comments