@peac/mcp-server 0.10.13 → 0.11.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/README.md +109 -15
- package/dist/cli.cjs +634 -27
- 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 +634 -27
- 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 +53 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +53 -6
- 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/package.json +10 -6
- 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
|
}
|
|
@@ -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 = {
|