@peac/mcp-server 0.10.13 → 0.11.3
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/.mcp.json +9 -0
- package/README.md +116 -15
- package/dist/cli.cjs +639 -32
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.ts +5 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.mjs +639 -32
- package/dist/cli.mjs.map +1 -1
- package/dist/http-transport.d.ts +65 -0
- package/dist/http-transport.d.ts.map +1 -0
- package/dist/index.cjs +58 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +58 -11
- package/dist/index.mjs.map +1 -1
- package/dist/infra/constants.d.ts +7 -1
- package/dist/infra/constants.d.ts.map +1 -1
- package/dist/infra/path-safety.d.ts +3 -1
- package/dist/infra/path-safety.d.ts.map +1 -1
- package/dist/infra/policy.d.ts +9 -95
- package/dist/infra/policy.d.ts.map +1 -1
- package/dist/schemas/bundle.d.ts +4 -48
- package/dist/schemas/bundle.d.ts.map +1 -1
- package/dist/schemas/decode.d.ts +3 -33
- package/dist/schemas/decode.d.ts.map +1 -1
- package/dist/schemas/inspect.d.ts +4 -68
- package/dist/schemas/inspect.d.ts.map +1 -1
- package/dist/schemas/issue.d.ts +8 -89
- package/dist/schemas/issue.d.ts.map +1 -1
- package/dist/schemas/verify.d.ts +4 -66
- package/dist/schemas/verify.d.ts.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/session-manager.d.ts +59 -0
- package/dist/session-manager.d.ts.map +1 -0
- package/manifest.json +84 -0
- package/package.json +13 -7
- package/server.json +23 -0
- package/smithery.yaml +36 -0
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { ERRORS } from '@peac/kernel';
|
|
2
3
|
import { verifyLocal, issue, IssueError } from '@peac/protocol';
|
|
3
4
|
import { base64urlDecode, decode, sha256Hex, sign, validateKeypair, derivePublicKey, base64urlEncode } from '@peac/crypto';
|
|
4
5
|
import { readFile, mkdir, rename, rm, mkdtemp, writeFile, stat, lstat } from 'fs/promises';
|
|
@@ -12,7 +13,7 @@ import { z } from 'zod';
|
|
|
12
13
|
|
|
13
14
|
// src/infra/constants.ts
|
|
14
15
|
var SERVER_NAME = "peac-mcp-server";
|
|
15
|
-
var SERVER_VERSION = "0.
|
|
16
|
+
var SERVER_VERSION = "0.11.2";
|
|
16
17
|
var MCP_PROTOCOL_VERSION = "2025-11-25";
|
|
17
18
|
var DEFAULT_MAX_JWS_BYTES = 16384;
|
|
18
19
|
var DEFAULT_MAX_RESPONSE_BYTES = 65536;
|
|
@@ -726,10 +727,40 @@ async function handleIssue(params) {
|
|
|
726
727
|
};
|
|
727
728
|
}
|
|
728
729
|
}
|
|
730
|
+
var WINDOWS_RESERVED_NAMES = /* @__PURE__ */ new Set([
|
|
731
|
+
"con",
|
|
732
|
+
"prn",
|
|
733
|
+
"aux",
|
|
734
|
+
"nul",
|
|
735
|
+
"com1",
|
|
736
|
+
"com2",
|
|
737
|
+
"com3",
|
|
738
|
+
"com4",
|
|
739
|
+
"com5",
|
|
740
|
+
"com6",
|
|
741
|
+
"com7",
|
|
742
|
+
"com8",
|
|
743
|
+
"com9",
|
|
744
|
+
"lpt1",
|
|
745
|
+
"lpt2",
|
|
746
|
+
"lpt3",
|
|
747
|
+
"lpt4",
|
|
748
|
+
"lpt5",
|
|
749
|
+
"lpt6",
|
|
750
|
+
"lpt7",
|
|
751
|
+
"lpt8",
|
|
752
|
+
"lpt9"
|
|
753
|
+
]);
|
|
729
754
|
function assertRelativePath(p) {
|
|
730
755
|
if (!p || p.trim().length === 0) {
|
|
731
756
|
throw new PathTraversalError("Path must not be empty");
|
|
732
757
|
}
|
|
758
|
+
if (p.includes("\0")) {
|
|
759
|
+
throw new PathTraversalError("Null bytes are not allowed in paths");
|
|
760
|
+
}
|
|
761
|
+
if (p.includes(":")) {
|
|
762
|
+
throw new PathTraversalError("Colons are not allowed in paths (drive letters, NTFS ADS)");
|
|
763
|
+
}
|
|
733
764
|
if (nodePath.isAbsolute(p)) {
|
|
734
765
|
throw new PathTraversalError("Absolute paths are not allowed");
|
|
735
766
|
}
|
|
@@ -746,6 +777,14 @@ function assertRelativePath(p) {
|
|
|
746
777
|
if (p.startsWith(".")) {
|
|
747
778
|
throw new PathTraversalError("Hidden paths (starting with .) are not allowed");
|
|
748
779
|
}
|
|
780
|
+
if (p.endsWith(".") || p.endsWith(" ")) {
|
|
781
|
+
throw new PathTraversalError("Trailing dots and spaces are not allowed");
|
|
782
|
+
}
|
|
783
|
+
const dotIndex = p.indexOf(".");
|
|
784
|
+
const baseName = (dotIndex >= 0 ? p.slice(0, dotIndex) : p).toLowerCase();
|
|
785
|
+
if (WINDOWS_RESERVED_NAMES.has(baseName)) {
|
|
786
|
+
throw new PathTraversalError(`Windows reserved device name: ${baseName.toUpperCase()}`);
|
|
787
|
+
}
|
|
749
788
|
}
|
|
750
789
|
function resolveOutputPath(basePath, relativePath) {
|
|
751
790
|
assertRelativePath(relativePath);
|
|
@@ -1115,7 +1154,7 @@ var IssueOutputSchema = z.object({
|
|
|
1115
1154
|
});
|
|
1116
1155
|
var BundleInputSchema = z.object({
|
|
1117
1156
|
receipts: z.array(z.string().max(16384)).min(1).max(256).describe("Receipt JWS strings to bundle (1-256)"),
|
|
1118
|
-
metadata: z.record(z.unknown()).optional().describe("Optional metadata to include in the manifest"),
|
|
1157
|
+
metadata: z.record(z.string(), z.unknown()).optional().describe("Optional metadata to include in the manifest"),
|
|
1119
1158
|
output_path: z.string().max(255).optional().describe("Output directory name (single segment within --bundle-dir)")
|
|
1120
1159
|
});
|
|
1121
1160
|
var MetaSchema5 = z.object({
|
|
@@ -1171,9 +1210,17 @@ var BUNDLE_TOOL_ANNOTATIONS = {
|
|
|
1171
1210
|
};
|
|
1172
1211
|
var MAX_INPUT_DEPTH = 10;
|
|
1173
1212
|
function errorCallToolResult(meta, code, message) {
|
|
1213
|
+
const errorDef = ERRORS[code];
|
|
1174
1214
|
return {
|
|
1175
1215
|
content: [{ type: "text", text: message }],
|
|
1176
|
-
structuredContent: {
|
|
1216
|
+
structuredContent: {
|
|
1217
|
+
_meta: meta,
|
|
1218
|
+
ok: false,
|
|
1219
|
+
code,
|
|
1220
|
+
message,
|
|
1221
|
+
retryable: errorDef?.retryable ?? false,
|
|
1222
|
+
next_action: errorDef?.next_action ?? "none"
|
|
1223
|
+
},
|
|
1177
1224
|
isError: true
|
|
1178
1225
|
};
|
|
1179
1226
|
}
|
|
@@ -1277,7 +1324,7 @@ function createPeacMcpServer(options) {
|
|
|
1277
1324
|
"peac_verify",
|
|
1278
1325
|
{
|
|
1279
1326
|
title: "Verify PEAC Receipt",
|
|
1280
|
-
description: "Verify a PEAC receipt
|
|
1327
|
+
description: "Verify a PEAC receipt: check Ed25519 signature, validate claims, and return structured check results. Read-only, no side effects.",
|
|
1281
1328
|
inputSchema: VerifyInputSchema,
|
|
1282
1329
|
outputSchema: VerifyOutputSchema,
|
|
1283
1330
|
annotations: PURE_TOOL_ANNOTATIONS
|
|
@@ -1293,7 +1340,7 @@ function createPeacMcpServer(options) {
|
|
|
1293
1340
|
"peac_inspect",
|
|
1294
1341
|
{
|
|
1295
1342
|
title: "Inspect PEAC Receipt",
|
|
1296
|
-
description: "
|
|
1343
|
+
description: "Inspect a PEAC receipt without verifying the signature. Returns decoded header, payload metadata, and timestamps. Read-only.",
|
|
1297
1344
|
inputSchema: InspectInputSchema,
|
|
1298
1345
|
outputSchema: InspectOutputSchema,
|
|
1299
1346
|
annotations: PURE_TOOL_ANNOTATIONS
|
|
@@ -1309,7 +1356,7 @@ function createPeacMcpServer(options) {
|
|
|
1309
1356
|
"peac_decode",
|
|
1310
1357
|
{
|
|
1311
1358
|
title: "Decode PEAC Receipt",
|
|
1312
|
-
description: "Raw
|
|
1359
|
+
description: "Raw-decode a PEAC receipt JWS into header and payload objects. No signature check. Use peac_verify for trusted results.",
|
|
1313
1360
|
inputSchema: DecodeInputSchema,
|
|
1314
1361
|
outputSchema: DecodeOutputSchema,
|
|
1315
1362
|
annotations: PURE_TOOL_ANNOTATIONS
|
|
@@ -1326,7 +1373,7 @@ function createPeacMcpServer(options) {
|
|
|
1326
1373
|
"peac_issue",
|
|
1327
1374
|
{
|
|
1328
1375
|
title: "Issue PEAC Receipt",
|
|
1329
|
-
description: "Sign and return a PEAC receipt JWS. Requires server
|
|
1376
|
+
description: "Sign and return a new PEAC receipt JWS. Requires server configured with an Ed25519 issuer key (--issuer-key and --issuer-id).",
|
|
1330
1377
|
inputSchema: IssueInputSchema,
|
|
1331
1378
|
outputSchema: IssueOutputSchema,
|
|
1332
1379
|
annotations: ISSUE_TOOL_ANNOTATIONS
|
|
@@ -1343,7 +1390,7 @@ function createPeacMcpServer(options) {
|
|
|
1343
1390
|
"peac_create_bundle",
|
|
1344
1391
|
{
|
|
1345
1392
|
title: "Create Evidence Bundle",
|
|
1346
|
-
description: "Create a signed evidence bundle directory from receipt JWS strings. Requires --issuer-key, --issuer-id, and --bundle-dir.",
|
|
1393
|
+
description: "Create a signed evidence bundle directory from one or more receipt JWS strings. Writes files to disk. Requires --issuer-key, --issuer-id, and --bundle-dir.",
|
|
1347
1394
|
inputSchema: BundleInputSchema,
|
|
1348
1395
|
outputSchema: BundleOutputSchema,
|
|
1349
1396
|
annotations: BUNDLE_TOOL_ANNOTATIONS
|
|
@@ -1384,9 +1431,9 @@ var JwksConfigSchema = z.object({
|
|
|
1384
1431
|
var PolicySchema = z.object({
|
|
1385
1432
|
version: z.literal("1"),
|
|
1386
1433
|
allow_network: z.boolean().default(false),
|
|
1387
|
-
redaction: RedactionSchema.
|
|
1388
|
-
tools: z.record(z.string(), ToolPolicySchema).
|
|
1389
|
-
limits: LimitsSchema.
|
|
1434
|
+
redaction: RedactionSchema.prefault({}),
|
|
1435
|
+
tools: z.record(z.string(), ToolPolicySchema).prefault({}),
|
|
1436
|
+
limits: LimitsSchema.prefault({}),
|
|
1390
1437
|
jwks: JwksConfigSchema.optional()
|
|
1391
1438
|
});
|
|
1392
1439
|
var DEFAULT_POLICY = {
|