File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments