@peac/mcp-server 0.11.3 → 0.12.0-preview.2
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.
- package/dist/cli.cjs +77 -59
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +78 -60
- package/dist/cli.mjs.map +1 -1
- package/dist/handlers/issue.d.ts +2 -2
- package/dist/handlers/issue.d.ts.map +1 -1
- package/dist/handlers/verify.d.ts.map +1 -1
- package/dist/index.cjs +77 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +78 -60
- package/dist/index.mjs.map +1 -1
- package/dist/schemas/issue.d.ts +35 -20
- package/dist/schemas/issue.d.ts.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/manifest.json +1 -1
- package/package.json +5 -5
- package/server.json +2 -2
package/dist/handlers/issue.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Issue handler -- ZERO MCP SDK imports (DD-57)
|
|
2
|
+
* Issue handler -- Wire 0.2 only, ZERO MCP SDK imports (DD-57)
|
|
3
3
|
*
|
|
4
|
-
* Signs and returns a PEAC receipt JWS (in-memory only, no side-effects).
|
|
4
|
+
* Signs and returns a Wire 0.2 PEAC receipt JWS (in-memory only, no side-effects).
|
|
5
5
|
* Requires issuerKey + issuerId on ServerContext.
|
|
6
6
|
*/
|
|
7
7
|
import type { HandlerParams, HandlerResult } from './types.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issue.d.ts","sourceRoot":"","sources":["../../src/handlers/issue.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"issue.d.ts","sourceRoot":"","sources":["../../src/handlers/issue.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAiBtD,wBAAsB,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAyI3F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/handlers/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AA4GxD,wBAAsB,YAAY,CAAC,MAAM,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/handlers/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AA4GxD,wBAAsB,YAAY,CAAC,MAAM,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAqI7F"}
|
package/dist/index.cjs
CHANGED
|
@@ -416,16 +416,15 @@ async function handleVerify(params) {
|
|
|
416
416
|
const claims = result.claims;
|
|
417
417
|
const claimsSummary = {
|
|
418
418
|
iss: claims.iss,
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
419
|
+
kind: claims.kind,
|
|
420
|
+
type: claims.type,
|
|
421
|
+
jti: claims.jti,
|
|
422
|
+
...claims.sub !== void 0 && { sub: claims.sub },
|
|
423
|
+
variant: result.variant,
|
|
424
|
+
wireVersion: result.wireVersion
|
|
422
425
|
};
|
|
423
|
-
if (result.variant === "commerce") {
|
|
424
|
-
claimsSummary.amt = claims.amt;
|
|
425
|
-
claimsSummary.cur = claims.cur;
|
|
426
|
-
}
|
|
427
426
|
const tr = truncateResponse(
|
|
428
|
-
`Verification PASSED (${result.variant} receipt, kid=${result.kid})`,
|
|
427
|
+
`Verification PASSED (${result.variant} receipt, kind=${claims.kind ?? "unknown"}, kid=${result.kid})`,
|
|
429
428
|
policy
|
|
430
429
|
);
|
|
431
430
|
return {
|
|
@@ -658,49 +657,44 @@ async function handleIssue(params) {
|
|
|
658
657
|
isError: true
|
|
659
658
|
};
|
|
660
659
|
}
|
|
661
|
-
if (input.ttl_seconds !== void 0 && input.ttl_seconds > policy.limits.max_ttl_seconds) {
|
|
662
|
-
return {
|
|
663
|
-
text: `Input rejected: ttl_seconds ${input.ttl_seconds} exceeds max_ttl_seconds ${policy.limits.max_ttl_seconds}`,
|
|
664
|
-
structured: {
|
|
665
|
-
ok: false,
|
|
666
|
-
code: "E_MCP_INVALID_INPUT",
|
|
667
|
-
message: `ttl_seconds ${input.ttl_seconds} exceeds policy max of ${policy.limits.max_ttl_seconds}`
|
|
668
|
-
},
|
|
669
|
-
isError: true
|
|
670
|
-
};
|
|
671
|
-
}
|
|
672
660
|
const keyPatterns = buildKeyPatterns(context.issuerKey.privateKey, context.issuerKey.publicKey);
|
|
673
|
-
const now = Math.floor(Date.now() / 1e3);
|
|
674
|
-
const exp = input.ttl_seconds !== void 0 ? now + input.ttl_seconds : void 0;
|
|
675
661
|
try {
|
|
676
|
-
|
|
662
|
+
if (input.policy && !input.policy.digest) {
|
|
663
|
+
return {
|
|
664
|
+
text: "Issue failed: policy.digest is required when policy block is provided",
|
|
665
|
+
structured: {
|
|
666
|
+
ok: false,
|
|
667
|
+
code: "E_MCP_ISSUE_FAILED",
|
|
668
|
+
message: "policy.digest is required when policy block is provided (uri/version alone is insufficient for binding)"
|
|
669
|
+
},
|
|
670
|
+
isError: true
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
const policyBlock = input.policy?.digest ? { digest: input.policy.digest, uri: input.policy.uri, version: input.policy.version } : void 0;
|
|
674
|
+
const result = await protocol.issueWire02({
|
|
677
675
|
iss: context.issuerId,
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
network: input.network,
|
|
686
|
-
evidence: input.evidence,
|
|
687
|
-
subject: input.subject,
|
|
688
|
-
exp,
|
|
676
|
+
kind: input.kind,
|
|
677
|
+
type: input.type,
|
|
678
|
+
sub: input.sub,
|
|
679
|
+
pillars: input.pillars,
|
|
680
|
+
occurred_at: input.occurred_at,
|
|
681
|
+
extensions: input.extensions,
|
|
682
|
+
policy: policyBlock,
|
|
689
683
|
privateKey: context.issuerKey.privateKey,
|
|
690
684
|
kid: context.issuerKey.kid
|
|
691
685
|
});
|
|
692
686
|
const { payload } = crypto.decode(result.jws);
|
|
693
687
|
const claimsSummary = {
|
|
694
688
|
iss: payload.iss,
|
|
695
|
-
|
|
689
|
+
kind: payload.kind,
|
|
690
|
+
type: payload.type,
|
|
696
691
|
iat: payload.iat,
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
cur: payload.cur
|
|
692
|
+
jti: payload.jti,
|
|
693
|
+
...payload.sub !== void 0 ? { sub: payload.sub } : {},
|
|
694
|
+
...payload.pillars !== void 0 ? { pillars: payload.pillars } : {}
|
|
701
695
|
};
|
|
702
696
|
const tr = truncateResponse(
|
|
703
|
-
`Receipt issued:
|
|
697
|
+
`Receipt issued: jti=${claimsSummary.jti}, kind=${claimsSummary.kind}, type=${claimsSummary.type}`,
|
|
704
698
|
policy
|
|
705
699
|
);
|
|
706
700
|
const safeText = sanitizeOutput(tr.text, keyPatterns);
|
|
@@ -1140,18 +1134,41 @@ var DecodeOutputSchema = zod.z.object({
|
|
|
1140
1134
|
verified: zod.z.literal(false)
|
|
1141
1135
|
});
|
|
1142
1136
|
var IssueInputSchema = zod.z.object({
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1137
|
+
kind: zod.z.enum(["evidence", "challenge"]).describe("Structural kind: evidence (records interaction) or challenge (requests action)"),
|
|
1138
|
+
type: zod.z.string().min(1).max(256).refine(
|
|
1139
|
+
(v) => /^https?:\/\//.test(v) || /^[a-zA-Z0-9][a-zA-Z0-9._-]*\.[a-zA-Z0-9._-]+\/[a-zA-Z0-9]/.test(v),
|
|
1140
|
+
{
|
|
1141
|
+
message: "type must be reverse-DNS (e.g. org.peacprotocol/payment) or absolute URI (https://...)"
|
|
1142
|
+
}
|
|
1143
|
+
).describe("Semantic type in reverse-DNS or absolute URI form (e.g. org.peacprotocol/payment)"),
|
|
1144
|
+
sub: zod.z.string().max(2048).optional().describe("Subject identifier (resource or interaction target)"),
|
|
1145
|
+
pillars: zod.z.array(
|
|
1146
|
+
zod.z.enum([
|
|
1147
|
+
"access",
|
|
1148
|
+
"attribution",
|
|
1149
|
+
"commerce",
|
|
1150
|
+
"compliance",
|
|
1151
|
+
"consent",
|
|
1152
|
+
"identity",
|
|
1153
|
+
"privacy",
|
|
1154
|
+
"provenance",
|
|
1155
|
+
"purpose",
|
|
1156
|
+
"safety"
|
|
1157
|
+
])
|
|
1158
|
+
).optional().refine(
|
|
1159
|
+
(arr) => !arr || new Set(arr).size === arr.length && [...arr].sort().every((v, i) => v === arr[i]),
|
|
1160
|
+
{ message: "pillars must be unique and sorted ascending" }
|
|
1161
|
+
).describe("Evidence pillars from closed 10-value taxonomy (sorted ascending)"),
|
|
1162
|
+
occurred_at: zod.z.string().optional().refine((v) => !v || !isNaN(Date.parse(v)), {
|
|
1163
|
+
message: "occurred_at must be a valid ISO 8601 timestamp"
|
|
1164
|
+
}).describe("ISO 8601 timestamp when interaction occurred (evidence kind only)"),
|
|
1165
|
+
extensions: zod.z.record(zod.z.string(), zod.z.unknown()).optional().describe("Extension groups keyed by reverse-DNS identifier"),
|
|
1166
|
+
policy: zod.z.object({
|
|
1167
|
+
uri: zod.z.string().url().max(2048).refine((v) => v.startsWith("https://"), { message: "policy.uri must use HTTPS" }).describe("Policy document URI (HTTPS only)"),
|
|
1168
|
+
version: zod.z.string().max(256).optional().describe("Policy version"),
|
|
1169
|
+
digest: zod.z.string().regex(/^sha256:[0-9a-f]{64}$/).optional().describe("Policy digest in sha256:<64 hex> format")
|
|
1170
|
+
}).optional().describe("Policy binding block"),
|
|
1171
|
+
ttl_seconds: zod.z.number().int().positive().optional().describe("Reserved for future use (Wire 0.2 receipts do not expire)")
|
|
1155
1172
|
});
|
|
1156
1173
|
var MetaSchema4 = zod.z.object({
|
|
1157
1174
|
serverVersion: zod.z.string(),
|
|
@@ -1160,12 +1177,12 @@ var MetaSchema4 = zod.z.object({
|
|
|
1160
1177
|
});
|
|
1161
1178
|
var ClaimsSummarySchema = zod.z.object({
|
|
1162
1179
|
iss: zod.z.string(),
|
|
1163
|
-
|
|
1180
|
+
kind: zod.z.string(),
|
|
1181
|
+
type: zod.z.string(),
|
|
1164
1182
|
iat: zod.z.number(),
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
cur: zod.z.string()
|
|
1183
|
+
jti: zod.z.string(),
|
|
1184
|
+
sub: zod.z.string().optional(),
|
|
1185
|
+
pillars: zod.z.array(zod.z.string()).optional()
|
|
1169
1186
|
});
|
|
1170
1187
|
var IssueOutputSchema = zod.z.object({
|
|
1171
1188
|
_meta: MetaSchema4,
|
|
@@ -1201,7 +1218,8 @@ function makeMeta(ctx, serverName) {
|
|
|
1201
1218
|
serverName,
|
|
1202
1219
|
serverVersion: ctx.version,
|
|
1203
1220
|
policyHash: ctx.policyHash,
|
|
1204
|
-
protocolVersion: ctx.protocolVersion
|
|
1221
|
+
protocolVersion: ctx.protocolVersion,
|
|
1222
|
+
wireFormatVersion: "0.2"
|
|
1205
1223
|
};
|
|
1206
1224
|
}
|
|
1207
1225
|
function handlerResultToCallToolResult(result, meta) {
|
|
@@ -1393,8 +1411,8 @@ function createPeacMcpServer(options) {
|
|
|
1393
1411
|
register(
|
|
1394
1412
|
"peac_issue",
|
|
1395
1413
|
{
|
|
1396
|
-
title: "Issue PEAC Receipt",
|
|
1397
|
-
description: "Sign and return a
|
|
1414
|
+
title: "Issue Wire 0.2 PEAC Receipt",
|
|
1415
|
+
description: "Sign and return a Wire 0.2 PEAC receipt JWS. Accepts kind, type, pillars, extensions, and policy fields. Wire 0.2 only: Wire 0.1 fields are not accepted. Requires server configured with an Ed25519 issuer key (--issuer-key and --issuer-id).",
|
|
1398
1416
|
inputSchema: IssueInputSchema,
|
|
1399
1417
|
outputSchema: IssueOutputSchema,
|
|
1400
1418
|
annotations: ISSUE_TOOL_ANNOTATIONS
|