Skip to content

Commit 76ddc65

Browse files
committed
Add docs
1 parent fb5a568 commit 76ddc65

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,33 @@ async def long_task(files: list[str], ctx: Context) -> str:
250250
return "Processing complete"
251251
```
252252

253+
### Authentication
254+
255+
Authentication can be used by servers that want to expose tools accessing protected resources.
256+
257+
`mcp.server.auth` implements an OAuth 2.0 server interface, which servers can use by
258+
providing an implementation of the `OAuthServerProvider` protocol.
259+
260+
```
261+
mcp = FastMCP("My App",
262+
auth_provider=MyOAuthServerProvider(),
263+
auth=AuthSettings(
264+
issuer_url="https://myapp.com",
265+
revocation_options=RevocationOptions(
266+
enabled=True,
267+
),
268+
client_registration_options=ClientRegistrationOptions(
269+
enabled=True,
270+
valid_scopes=["myscope", "myotherscope"],
271+
default_scopes=["myscope"],
272+
),
273+
required_scopes=["myscope"],
274+
),
275+
)
276+
```
277+
278+
See [OAuthServerProvider](mcp/server/auth/provider.py) for more details.
279+
253280
## Running Your Server
254281

255282
### Development Mode

0 commit comments

Comments
 (0)