Skip to content

Commit 587a443

Browse files
authored
Update README's auth block
- Add auth to TOC - Specify python for code block highlighting - Format auth example
1 parent 58c5e72 commit 587a443

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

README.md

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- [Prompts](#prompts)
3131
- [Images](#images)
3232
- [Context](#context)
33+
- [Authentication](#authentication)
3334
- [Running Your Server](#running-your-server)
3435
- [Development Mode](#development-mode)
3536
- [Claude Desktop Integration](#claude-desktop-integration)
@@ -316,21 +317,29 @@ Authentication can be used by servers that want to expose tools accessing protec
316317
`mcp.server.auth` implements an OAuth 2.0 server interface, which servers can use by
317318
providing an implementation of the `OAuthServerProvider` protocol.
318319

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"],
333340
),
341+
required_scopes=["myscope"],
342+
),
334343
)
335344
```
336345

0 commit comments

Comments
 (0)