Files
obsidian-mcp/Config/McpDiscoveryOptions.cs
T
zhengchen.tao 37082e165d
Build Docker Image / build (push) Failing after 15m17s
Build Docker Image / deploy (push) Has been skipped
feat(oauth): expose RFC 9728 protected resource metadata endpoint
Claude.ai's MCP OAuth client only sends the RFC 8707 `resource` param
when it has Protected Resource Metadata (PRM) to learn the resource
identifier from. Without it, nas-auth's /authorize rejected the request
with 'resource 必填'.

Adds /.well-known/oauth-protected-resource (RFC 9728) that returns the
resource URL + AS URL + supported scopes. ResourceUrl is configurable
via Mcp__OAuthDiscovery__ResourceUrl, falling back to request authority
when unset (works in local dev).
2026-05-16 17:35:57 +08:00

23 lines
1006 B
C#

namespace ObsidianMcp.Config;
/// <summary>
/// /.well-known/oauth-authorization-server + /.well-known/oauth-protected-resource
/// 端点返回的元数据。环境变量前缀 Mcp__OAuthDiscovery__。
/// </summary>
public class McpDiscoveryOptions
{
public const string Section = "Mcp:OAuthDiscovery";
public string Issuer { get; set; } = "https://auth.zhengchentao.win";
public string AuthorizationEndpoint { get; set; } = "https://auth.zhengchentao.win/authorize";
public string TokenEndpoint { get; set; } = "https://auth.zhengchentao.win/token";
public string RegistrationEndpoint { get; set; } = "https://auth.zhengchentao.win/register";
/// <summary>
/// 本资源服务的标识符(RFC 9728 PRM 的 `resource` 字段,必须与 nas-auth
/// resources.json 里 obsidian 条目的 resource_url 完全一致)。
/// 留空时 PRM 端点回退用请求的 `scheme://host`。
/// </summary>
public string ResourceUrl { get; set; } = string.Empty;
}