Skip to main content

oauth_protected_resource_metadata

Function oauth_protected_resource_metadata 

Source
pub(crate) async fn oauth_protected_resource_metadata() -> Json<Value>
Expand description

RFC 9728 — OAuth 2.0 Protected Resource Metadata

我们不是完整 OAuth 授权服务器(那需要独立的 IdP),只是告诉 MCP 客户端 “这个资源要 Bearer token,scope 列表如下”。LLM agent 实际拿到 key 的方式 仍然是运维线下发放 + 写入 MCP client 配置里的 Authorization 头。

客户端可以 GET /.well-known/oauth-protected-resource 来发现:

  • resource: 本 MCP endpoint URI
  • bearer_methods_supported: 我们只支持 header(Authorization: Bearer …)
  • scopes_supported: 可声明的 futu-auth scope 列表
  • resource_name / resource_documentation: 给人看的说明