@atlasauth/pca-mcp-rs (英语)
MCP授权资源服务器用于2026-07-28 MCP授权修改,由Proof-Crying Authority(PCA)支持. 何处 @atlasauth/pca-mcp 将工具处理器包裹在客户端上,所以每个呼叫都携带PCActn,这个包使接收这些呼叫的服务器成为正确的OAuth 2.1资源服务器:它服务于RFC 9728保护资源元数据,验证客户端ID元数据文档,执行RFC 8707资源绑定和RFC 9207发行者验证,在授权链下积累范围,并发布RFC 9470分步挑战. 当局是PCAKN,不是无记名标志:它的签名 aud 是资源约束.
安装
npm i @atlasauth/pca-mcp-rs @atlasauth/pca
所有东西都是纯和运行时间中立的(没有节点内建,没有框架),因此它挂载在快取,快取,Hono,Next.js,取取取处理器或任何路由器上.
使用量
import { prmHandler, authorizeRequest } from '@atlasauth/pca-mcp-rs';
const resource = 'https://mcp.example.com';
const authorizationServers = ['https://as.example.com'];
// 1. Serve the Protected Resource Metadata (RFC 9728) at the returned path.
const prm = prmHandler({ resource, authorizationServers, scopesSupported: ['refund:write'] });
// GET prm.path -> JSON prm.body
// 2. Admit each tool call.
const result = await authorizeRequest(req /* { headers, body? } */, {
resource, // must equal the PCActn's signed `aud`
authorizationServers, // allowed grant issuers (RFC 9207)
resolveGrant: async (ref) => grants.get(ref) ?? null,
prmUrl: `${resource}${prm.path}`,
tool: 'refund',
toolScopes: { refund: 'refund:write' },
toolStepUp: { refund: 2 }, // optional: require a guardian (2) or principal (3) co-sign
});
if (!result.ok) {
// result.status is 401 or 403; send the challenge header with the response.
return new Response(JSON.stringify({ error: result.error }), {
status: result.status,
headers: { 'WWW-Authenticate': result.wwwAuthenticate },
});
}
result.pcactn; result.grantedScopes; result.checks;
authorizeRequest 从中读取 PCActn PCA-Action 头(基数64url)或JSON体 { pcactn },且未关闭:任何缺失、不匹配或无法核实的元素均以正确状态被拒绝 WWW-Authenticate 还有403个意外错误.
API 密码
protectedResourceMetadata(opts), (中文(简体) ),prmHandler(opts), (中文(简体) ),WELL_KNOWN_OAUTH_PRM- RFC 9728元数据.authorizeRequest(req, opts), (中文(简体) ),extractPCActn(req)- 录取检查.wwwAuthenticateChallenge(opts)- 建立一个WWW-Authenticate: Bearer ...数值.clientIdMetadataDocument(opts), (中文(简体) ),verifyCimd(input, opts?)- 客户ID元数据文档(https)client_id,重定向URI检查).accumulateScopes(caveats, base?), (中文(简体) ),isScopeCaveat- 缩小范围scope戒备.requiredRolesForTier, (中文(简体) ),verifyStepUp, (中文(简体) ),StepUpChallenge- 站出来帮手.
状态
升级是通过加密核实的,没有缺省存在检查。 当适用几个层级源时(requiredTier, (中文(简体) ), toolStepUp[tool],则 riskTiers 有效层级是其最大层级,以及 toolStepUp 无 tool 未关闭( R3-08) 。 当某一层级适用时(toolStepUp, (中文(简体) ), requiredTier,或 riskTiers,通过 stepUpSignerSet (代理人、监护人和主要公用钥匙):每股按规定分级核实 t (第2级=t 2, 第3级=t 3,因此第3级需要经核实的主要份额),通过五氯苯甲醚阈值核查器。 或者通过自己的 stepUpSatisfied,它必须验证股票本身。 两者都一样 电话都关了. riskTiers 需要一个 serverRisk(pcactn, grant) 从服务器持有的数据中重新计算风险的回调; 代理签名 risk_claim.r 从未使用. authorizeRequest 仅与赠款和观众联系PCA核心核查员;它不需要重播商店或撤销列表,所以如果需要,请加入周围的列表。 PCA密码学没有经过独立审计.
许可证
麻省理工学院 - 见LICENSE