@atlasauth/pca-mcp-rs 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +63 -0
  3. package/package.json +28 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Atlas Authorization
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # @atlasauth/pca-mcp-rs
2
+
3
+ MCP authorization resource server for the 2026-07-28 MCP authorization revision, backed by Proof-Carrying Authority (PCA). Where `@atlasauth/pca-mcp` wraps tool handlers on the client so each call carries a PCActn, this package makes the server that receives those calls a correct OAuth 2.1 resource server: it serves RFC 9728 Protected Resource Metadata, validates Client-ID Metadata Documents, enforces RFC 8707 resource binding and RFC 9207 issuer validation, accumulates scopes down the delegation chain, and issues RFC 9470 step-up challenges. The authority is the PCActn, not a bearer token: its signed `aud` is the resource binding.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm i @atlasauth/pca-mcp-rs @atlasauth/pca
9
+ ```
10
+
11
+ Everything is pure and runtime-neutral (no Node builtins, no framework), so it mounts on Express, Fastify, Hono, Next.js, Fetch handlers or any router.
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import { prmHandler, authorizeRequest } from '@atlasauth/pca-mcp-rs';
17
+
18
+ const resource = 'https://mcp.example.com';
19
+ const authorizationServers = ['https://as.example.com'];
20
+
21
+ // 1. Serve the Protected Resource Metadata (RFC 9728) at the returned path.
22
+ const prm = prmHandler({ resource, authorizationServers, scopesSupported: ['refund:write'] });
23
+ // GET prm.path -> JSON prm.body
24
+
25
+ // 2. Admit each tool call.
26
+ const result = await authorizeRequest(req /* { headers, body? } */, {
27
+ resource, // must equal the PCActn's signed `aud`
28
+ authorizationServers, // allowed grant issuers (RFC 9207)
29
+ resolveGrant: async (ref) => grants.get(ref) ?? null,
30
+ prmUrl: `${resource}${prm.path}`,
31
+ tool: 'refund',
32
+ toolScopes: { refund: 'refund:write' },
33
+ toolStepUp: { refund: 2 }, // optional: require a guardian (2) or principal (3) co-sign
34
+ });
35
+
36
+ if (!result.ok) {
37
+ // result.status is 401 or 403; send the challenge header with the response.
38
+ return new Response(JSON.stringify({ error: result.error }), {
39
+ status: result.status,
40
+ headers: { 'WWW-Authenticate': result.wwwAuthenticate },
41
+ });
42
+ }
43
+ result.pcactn; result.grantedScopes; result.checks;
44
+ ```
45
+
46
+ `authorizeRequest` reads the PCActn from the `PCA-Action` header (base64url) or a JSON body `{ pcactn }`, and fails closed: any missing, mismatched or unverifiable element is denied with the correct status and `WWW-Authenticate` challenge, and unexpected errors deny with 403.
47
+
48
+ ## API
49
+
50
+ - `protectedResourceMetadata(opts)`, `prmHandler(opts)`, `WELL_KNOWN_OAUTH_PRM` - RFC 9728 metadata.
51
+ - `authorizeRequest(req, opts)`, `extractPCActn(req)` - the admission check.
52
+ - `wwwAuthenticateChallenge(opts)` - build a `WWW-Authenticate: Bearer ...` value.
53
+ - `clientIdMetadataDocument(opts)`, `verifyCimd(input, opts?)` - Client-ID Metadata Documents (https `client_id`, redirect URI checks).
54
+ - `accumulateScopes(caveats, base?)`, `isScopeCaveat` - scope narrowing from `scope` caveats.
55
+ - `requiredRolesForTier`, `defaultStepUpSatisfied`, `StepUpChallenge` - step-up helpers.
56
+
57
+ ## Status
58
+
59
+ Step-up satisfaction defaults to a presence check: `defaultStepUpSatisfied` only tests that the PCActn carries a threshold share from a qualifying role. It does not cryptographically verify the shares. Pass `stepUpSatisfied` to `authorizeRequest` to plug in a real threshold verifier. `authorizeRequest` calls the PCA core verifier with the grant and audience only; it takes no replay store or revocation list, so add those around it if you need them. PCA cryptography has not been independently audited.
60
+
61
+ ## License
62
+
63
+ MIT - see LICENSE
package/package.json CHANGED
@@ -1,7 +1,28 @@
1
1
  {
2
2
  "name": "@atlasauth/pca-mcp-rs",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "MCP authorization resource-server for the 2026-07-28 spec: serve RFC 9728 PRM + Client-ID Metadata Documents, enforce RFC 8707 resource indicators + RFC 9207 issuer validation + scope accumulation, and wire PCA FROST step-up into the MCP step-up challenge.",
5
+ "keywords": [
6
+ "mcp",
7
+ "resource server",
8
+ "rfc 9728",
9
+ "rfc 8707",
10
+ "oauth",
11
+ "agent authorization",
12
+ "proof-carrying authority",
13
+ "pca",
14
+ "ai agents"
15
+ ],
16
+ "license": "MIT",
17
+ "homepage": "https://github.com/Atlas-Authorization/pca#readme",
18
+ "bugs": {
19
+ "url": "https://github.com/Atlas-Authorization/pca/issues"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/Atlas-Authorization/pca.git",
24
+ "directory": "packages/pca-mcp-rs"
25
+ },
5
26
  "main": "./dist/index.js",
6
27
  "types": "./dist/index.d.ts",
7
28
  "exports": {
@@ -12,7 +33,7 @@
12
33
  "./package.json": "./package.json"
13
34
  },
14
35
  "dependencies": {
15
- "@atlasauth/pca": "0.1.0"
36
+ "@atlasauth/pca": "0.3.0"
16
37
  },
17
38
  "devDependencies": {
18
39
  "typescript": "^5.6.3",
@@ -20,8 +41,12 @@
20
41
  },
21
42
  "files": [
22
43
  "dist",
23
- "README.md"
44
+ "README.md",
45
+ "LICENSE"
24
46
  ],
47
+ "engines": {
48
+ "node": ">=20"
49
+ },
25
50
  "publishConfig": {
26
51
  "access": "public"
27
52
  },