mcp-oauth
Use when implementing or integrating the MCP OAuth authorization server, its metadata, public clients, consent callback, pod broker seam, signed tokens and grant stores.
- License 许可
- MIT
- 所属仓库
- jeswr/solid-sdk
- 最近更新
- 2026-11-15
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- mcp-oauth
- description
- Use when implementing or integrating the MCP OAuth authorization server, its metadata, public clients, consent callback, pod broker seam, signed tokens and grant stores.
02 资源文件 30
- 参考文档package.json1.3 KB
- 参考文档README.md13.4 KB
- 脚本src/clients.test.ts8.5 KB
- 脚本src/clients.ts4.2 KB
- 脚本src/grant-hooks.test.ts14.2 KB
- 脚本src/index.ts1.2 KB
- 脚本src/jwt.test.ts5.7 KB
- 脚本src/jwt.ts4.2 KB
- 脚本src/lws-trust.test.ts4.4 KB
- 脚本src/lws-trust.ts2.1 KB
- 脚本src/metadata.ts316 B
- 脚本src/pod-sessions.test.ts52.4 KB
- 脚本src/pod-sessions.ts16.9 KB
- 脚本src/protocol.test.ts980 B
- 脚本src/protocol.ts3.3 KB
- 脚本src/server.test.ts42.7 KB
- 脚本src/server.ts18.7 KB
- 脚本src/stores.test.ts4.6 KB
- 脚本src/stores.ts2.2 KB
- 脚本src/testing.ts197 B
- 脚本src/types.ts4.5 KB
- 脚本src/vault-stores.ts5.4 KB
- 脚本src/vault.test.ts11.8 KB
- 脚本src/vault.ts3.7 KB
- 脚本test/fixtures.ts3.8 KB
- 脚本test/lws-storage.ts5.9 KB
- 脚本test/pod-issuer.ts10.1 KB
- 参考文档tsconfig.json320 B
- 参考文档tsconfig.test.json224 B
- 脚本vitest.config.ts456 B
03 SKILL.md 正文
<!-- AUTHORED-BY Codex GPT-6.1-Sol -->
@jeswr/mcp-oauth
Read this package's README, repository AGENTS.md, and MCP DESIGN §3/§5 before changing the API.
This package owns MCP-09 authorization server core and MCP-10's createPodSessionProvider,
createSessionVault, and ciphertext stores. MCP-11 supplies browser login/consent UI,
the public Solid Client ID Document, and HTTP composition.
- Use
createAuthorizationServerand Web Request/Response; keep framework dependencies out. - Keep upstream pod credentials inside the injected broker. Only
{id, webId}enters grants. - Use pod-auth/node createNodeOidcClient for upstream PKCE/state/nonce/DPoP/refresh; retain the original sealed private JWK with rotating refresh credentials. The protocol engine imports signing keys as non-extractable; only server vault envelopes contain private JWKs.
- Never let a resource choose where the ID token goes: LWS exchanges go only to the issuer's
origin, a stored root's origin, or a configured
lwsAuthorizationServersentry. A realm is a stored-root container, or a same-origin storage description whose advertised root lies inside a stored root and contains the resource; a description never widens the audience. - Keep MCP_VAULT_KEY canonical base64 of exactly 32 bytes. Default to Upstash/Vercel KV; memory is explicit and single-process; files use a private local directory and atomic writes.
- Never weaken vault CAS or deletion tombstones. Consume callbacks once and claim refresh ownership before contacting the issuer. Crashed refreshes fail closed and require new login.
- Recheck broker
isActiveduring MCP verification/issuance and before resource fetches; MCP revocation/reuse retires the pod session and invalidates all grants bound to it. - Pass
verifyWebId: falseto the Node engine: the broker owns the single guarded fetch-rdf profile binding check at completion, alongside storage discovery and content negotiation. Refresh retains that binding and verifies subject/nonce/WebID without another profile fetch after refresh rotation. - Resolve profiles through fetch-rdf + wrapper accessors, require profile issuer trust, scope authenticated fetch to advertised storage roots, refuse caller credentials and redirects.
- Require PKCE S256, nonempty state, exact redirects, and an exact configured resource.
- Keep ES256 access tokens ten minutes and bind
audto the MCP resource. - Consume codes/refresh credentials atomically. Reuse revokes the entire family; never reset a revoked grant. Hash bearer credentials before storing them and retain reuse tombstones.
- Use the DNS-pinning guarded-fetch Node entry for client metadata. Never follow redirects; preserve response size/time limits and exact client_id matching. metadataFetch is a trusted test/composition seam and must already enforce SSRF protection.
authorize(request, session)is trusted completion, never an unauthenticated HTTP route. The composition authenticates the browser and validates consent/CSRF before calling it.- Await
grantCreated({grant, client, redirectUri, issuedAt})after durable grant storage and before code storage. It receives independent readonly-typed snapshots and seconds since epoch; denial skips it. Hook failure must prevent a code, attempt session-wide revocation and return a trustedserver_errorredirect with state/iss, including if credential cleanup fails. revokeGrant(grantId)is a trusted server-only API: unknown IDs are no-ops, retries remain irreversible and retry cleanup, and every grant on that pod session must fail verification and code/refresh exchange. Propagate storage/broker failures to the caller.- Pluggable stores require durable atomic consume and irreversible revoke; memory stores are
single-process fixtures.
./testingexposes these stores to dependent tests. - Use fixtures only. Exercise signature verification, replay races, audience/expiry failures, malformed metadata and denial paths. Keep all coverage thresholds at 100%.
Validate with package lint/build/typecheck/test, root lint and affected/full Turbo gates. Do not add dependencies or publish without task authorization and the package-policy check.
04 同仓库更多 Skills
storage-conformance
Work on @jeswr/storage-conformance, the shared storage conformance suite package in the Solid SDK workspace.
fetch-rdf-engine-tests
Maintain fetch-rdf's real Node WASM parser integration tests without introducing a reverse engine dependency in fetch-rdf.
alpha
Use when checking fixtures, including folded YAML descriptions.
widget
Use when testing package skills: YAML quoting works.
web-seo
Use when improving technical and entity SEO for a modern personal, portfolio, documentation, or marketing site, including crawlable HTML, canonical metadata, sitemap and robots, Person/ProfilePage JSON-LD, Core Web Vitals, and honest ranking expectations.
solid-wac
Use when implementing or auditing Solid server WAC authorization, ACL creation and inheritance, auxiliary-resource escalation, method-to-mode mapping, 401 versus 403 challenges, WAC-Allow, or defensive typed ACL parsing with @solid/object and @rdfjs/wrapper.