@ai-dossier/mcp-server 1.0.1

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 (50) hide show
  1. package/README.md +379 -0
  2. package/dist/index.d.ts +8 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +332 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/parsers/signatureVerifier.d.ts +10 -0
  7. package/dist/parsers/signatureVerifier.d.ts.map +1 -0
  8. package/dist/parsers/signatureVerifier.js +85 -0
  9. package/dist/parsers/signatureVerifier.js.map +1 -0
  10. package/dist/resources/concept.d.ts +7 -0
  11. package/dist/resources/concept.d.ts.map +1 -0
  12. package/dist/resources/concept.js +11 -0
  13. package/dist/resources/concept.js.map +1 -0
  14. package/dist/resources/protocol.d.ts +7 -0
  15. package/dist/resources/protocol.d.ts.map +1 -0
  16. package/dist/resources/protocol.js +11 -0
  17. package/dist/resources/protocol.js.map +1 -0
  18. package/dist/resources/security.d.ts +7 -0
  19. package/dist/resources/security.d.ts.map +1 -0
  20. package/dist/resources/security.js +11 -0
  21. package/dist/resources/security.js.map +1 -0
  22. package/dist/tools/listDossiers.d.ts +19 -0
  23. package/dist/tools/listDossiers.d.ts.map +1 -0
  24. package/dist/tools/listDossiers.js +104 -0
  25. package/dist/tools/listDossiers.js.map +1 -0
  26. package/dist/tools/readDossier.d.ts +27 -0
  27. package/dist/tools/readDossier.d.ts.map +1 -0
  28. package/dist/tools/readDossier.js +46 -0
  29. package/dist/tools/readDossier.js.map +1 -0
  30. package/dist/tools/verifyDossier.d.ts +15 -0
  31. package/dist/tools/verifyDossier.d.ts.map +1 -0
  32. package/dist/tools/verifyDossier.js +107 -0
  33. package/dist/tools/verifyDossier.js.map +1 -0
  34. package/dist/utils/errors.d.ts +35 -0
  35. package/dist/utils/errors.d.ts.map +1 -0
  36. package/dist/utils/errors.js +68 -0
  37. package/dist/utils/errors.js.map +1 -0
  38. package/dist/utils/logger.d.ts +31 -0
  39. package/dist/utils/logger.d.ts.map +1 -0
  40. package/dist/utils/logger.js +58 -0
  41. package/dist/utils/logger.js.map +1 -0
  42. package/dist/utils/resourceLoader.d.ts +20 -0
  43. package/dist/utils/resourceLoader.d.ts.map +1 -0
  44. package/dist/utils/resourceLoader.js +46 -0
  45. package/dist/utils/resourceLoader.js.map +1 -0
  46. package/dist/utils/response.d.ts +17 -0
  47. package/dist/utils/response.d.ts.map +1 -0
  48. package/dist/utils/response.js +22 -0
  49. package/dist/utils/response.js.map +1 -0
  50. package/package.json +45 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listDossiers.js","sourceRoot":"","sources":["../../src/tools/listDossiers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA4DH,oCA4DC;AAtHD,qCAAgD;AAChD,yCAAoD;AACpD,2CAA2F;AAC3F,4CAAyC;AAazC;;GAEG;AACH,SAAS,gBAAgB,CAAC,GAAW,EAAE,QAAgB,EAAE,SAAkB;IACzE,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAA,qBAAW,EAAC,GAAG,CAAC,CAAC;QAEjC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,MAAM,QAAQ,GAAG,IAAA,gBAAI,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAElC,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,IAAA,kBAAQ,EAAC,QAAQ,CAAC,CAAC;gBAEhC,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;oBACvB,gCAAgC;oBAChC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,cAAc,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;wBAC1E,SAAS;oBACX,CAAC;oBAED,IAAI,SAAS,EAAE,CAAC;wBACd,KAAK,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE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AAU;QACV,KAAK,EAAE,QAAQ,CAAC,MAAM;QACtB,UAAU,EAAE,YAAY,CAAC,MAAM;KAChC,CAAC,CAAC;IAEH,OAAO;QACL,QAAQ;QACR,WAAW,EAAE,UAAU;QACvB,KAAK,EAAE,QAAQ,CAAC,MAAM;KACvB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * read_dossier tool - Read and return dossier content
3
+ * Should be called AFTER verify_dossier passes
4
+ */
5
+ import { type DossierFrontmatter } from '@ai-dossier/core';
6
+ export interface ReadDossierInput {
7
+ path: string;
8
+ }
9
+ export interface ReadDossierOutput {
10
+ metadata: {
11
+ title: string;
12
+ version: string;
13
+ protocol: string;
14
+ status: string;
15
+ risk_level: string;
16
+ objective: string;
17
+ path: string;
18
+ };
19
+ frontmatter: DossierFrontmatter;
20
+ body: string;
21
+ }
22
+ /**
23
+ * Read and parse a dossier file
24
+ * Returns metadata and content for LLM execution
25
+ */
26
+ export declare function readDossier(input: ReadDossierInput): ReadDossierOutput;
27
+ //# sourceMappingURL=readDossier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readDossier.d.ts","sourceRoot":"","sources":["../../src/tools/readDossier.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,kBAAkB,EAAoB,MAAM,kBAAkB,CAAC;AAG7E,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,WAAW,EAAE,kBAAkB,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,iBAAiB,CAoCtE"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ /**
3
+ * read_dossier tool - Read and return dossier content
4
+ * Should be called AFTER verify_dossier passes
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.readDossier = readDossier;
8
+ const node_path_1 = require("node:path");
9
+ const core_1 = require("@ai-dossier/core");
10
+ const logger_1 = require("../utils/logger");
11
+ /**
12
+ * Read and parse a dossier file
13
+ * Returns metadata and content for LLM execution
14
+ */
15
+ function readDossier(input) {
16
+ const { path } = input;
17
+ // Validate path stays within the current working directory
18
+ const resolvedPath = (0, node_path_1.resolve)(path);
19
+ const cwd = process.cwd();
20
+ if (!resolvedPath.startsWith(`${cwd}/`) && resolvedPath !== cwd) {
21
+ throw new Error(`Access denied: path "${path}" is outside the working directory`);
22
+ }
23
+ logger_1.logger.info('Reading dossier', { dossierFile: path });
24
+ const parsed = (0, core_1.parseDossierFile)(path);
25
+ const { frontmatter, body } = parsed;
26
+ const output = {
27
+ metadata: {
28
+ title: frontmatter.title,
29
+ version: frontmatter.version,
30
+ protocol: frontmatter.protocol_version,
31
+ status: frontmatter.status,
32
+ risk_level: frontmatter.risk_level,
33
+ objective: frontmatter.objective,
34
+ path,
35
+ },
36
+ frontmatter,
37
+ body,
38
+ };
39
+ logger_1.logger.info('Dossier read successfully', {
40
+ dossierFile: path,
41
+ title: frontmatter.title,
42
+ bodyLength: body.length,
43
+ });
44
+ return output;
45
+ }
46
+ //# sourceMappingURL=readDossier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readDossier.js","sourceRoot":"","sources":["../../src/tools/readDossier.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA4BH,kCAoCC;AA9DD,yCAAoC;AACpC,2CAA6E;AAC7E,4CAAyC;AAoBzC;;;GAGG;AACH,SAAgB,WAAW,CAAC,KAAuB;IACjD,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAEvB,2DAA2D;IAC3D,MAAM,YAAY,GAAG,IAAA,mBAAO,EAAC,IAAI,CAAC,CAAC;IACnC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,GAAG,GAAG,CAAC,IAAI,YAAY,KAAK,GAAG,EAAE,CAAC;QAChE,MAAM,IAAI,KAAK,CAAC,wBAAwB,IAAI,oCAAoC,CAAC,CAAC;IACpF,CAAC;IAED,eAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IAEtD,MAAM,MAAM,GAAG,IAAA,uBAAgB,EAAC,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAErC,MAAM,MAAM,GAAsB;QAChC,QAAQ,EAAE;YACR,KAAK,EAAE,WAAW,CAAC,KAAK;YACxB,OAAO,EAAE,WAAW,CAAC,OAAO;YAC5B,QAAQ,EAAE,WAAW,CAAC,gBAAgB;YACtC,MAAM,EAAE,WAAW,CAAC,MAAM;YAC1B,UAAU,EAAE,WAAW,CAAC,UAAU;YAClC,SAAS,EAAE,WAAW,CAAC,SAAS;YAChC,IAAI;SACL;QACD,WAAW;QACX,IAAI;KACL,CAAC;IAEF,eAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE;QACvC,WAAW,EAAE,IAAI;QACjB,KAAK,EAAE,WAAW,CAAC,KAAK;QACxB,UAAU,EAAE,IAAI,CAAC,MAAM;KACxB,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * verify_dossier tool - Security verification for dossiers
3
+ * Verifies integrity (checksum) and authenticity (signature)
4
+ * Returns recommendation: ALLOW, WARN, or BLOCK
5
+ */
6
+ import { type VerificationResult } from '@ai-dossier/core';
7
+ export interface VerifyDossierInput {
8
+ path: string;
9
+ trusted_keys_path?: string;
10
+ }
11
+ /**
12
+ * Verify dossier security (integrity, authenticity, risk assessment)
13
+ */
14
+ export declare function verifyDossier(input: VerifyDossierInput): Promise<VerificationResult>;
15
+ //# sourceMappingURL=verifyDossier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyDossier.d.ts","sourceRoot":"","sources":["../../src/tools/verifyDossier.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAKL,KAAK,kBAAkB,EAExB,MAAM,kBAAkB,CAAC;AAI1B,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA0G1F"}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ /**
3
+ * verify_dossier tool - Security verification for dossiers
4
+ * Verifies integrity (checksum) and authenticity (signature)
5
+ * Returns recommendation: ALLOW, WARN, or BLOCK
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.verifyDossier = verifyDossier;
9
+ const core_1 = require("@ai-dossier/core");
10
+ const signatureVerifier_1 = require("../parsers/signatureVerifier");
11
+ const logger_1 = require("../utils/logger");
12
+ /**
13
+ * Verify dossier security (integrity, authenticity, risk assessment)
14
+ */
15
+ async function verifyDossier(input) {
16
+ const { path, trusted_keys_path } = input;
17
+ logger_1.logger.info('Starting dossier verification', { dossierFile: path });
18
+ const result = (0, core_1.createDefaultVerificationResult)(path);
19
+ try {
20
+ // 1. Parse dossier
21
+ const parsed = (0, core_1.parseDossierFile)(path);
22
+ const { frontmatter, body } = parsed;
23
+ // 2. INTEGRITY CHECK (checksum)
24
+ const checksumHash = frontmatter.checksum?.hash;
25
+ result.integrity = (0, core_1.verifyIntegrity)(body, checksumHash);
26
+ if (result.integrity.status === 'missing') {
27
+ result.errors.push('Missing checksum - cannot verify integrity');
28
+ result.recommendation = 'BLOCK';
29
+ result.message = 'DO NOT EXECUTE - No checksum found';
30
+ logger_1.logger.error('Verification FAILED - missing checksum', { dossierFile: path });
31
+ return result;
32
+ }
33
+ if (result.integrity.status === 'invalid') {
34
+ result.errors.push('Checksum verification FAILED - do not execute!');
35
+ result.recommendation = 'BLOCK';
36
+ result.message = 'DO NOT EXECUTE - Dossier has been tampered with!';
37
+ result.authenticity.status = 'error';
38
+ result.authenticity.message = 'Cannot verify signature - integrity check failed';
39
+ logger_1.logger.error('Verification FAILED - checksum mismatch', { dossierFile: path });
40
+ return result;
41
+ }
42
+ // 3. AUTHENTICITY CHECK (signature)
43
+ result.authenticity = await (0, signatureVerifier_1.verifyAuthenticity)(body, frontmatter, trusted_keys_path);
44
+ if (result.authenticity.status === 'invalid') {
45
+ result.errors.push('Signature verification FAILED - do not execute!');
46
+ result.recommendation = 'BLOCK';
47
+ result.message = 'DO NOT EXECUTE - Invalid signature!';
48
+ logger_1.logger.error('Verification FAILED - invalid signature', { dossierFile: path });
49
+ return result;
50
+ }
51
+ // 4. RISK ASSESSMENT
52
+ result.riskAssessment = {
53
+ riskLevel: frontmatter.risk_level || 'unknown',
54
+ riskFactors: frontmatter.risk_factors || [],
55
+ destructiveOperations: frontmatter.destructive_operations || [],
56
+ requiresApproval: frontmatter.requires_approval !== false, // default true
57
+ };
58
+ // 5. RECOMMENDATION LOGIC
59
+ // Note: integrity 'invalid' and authenticity 'invalid' already handled above with early return
60
+ if (result.authenticity.status === 'verified' && result.riskAssessment.riskLevel === 'low') {
61
+ result.recommendation = 'ALLOW';
62
+ result.message = 'Verified dossier from trusted source with low risk. Safe to execute.';
63
+ }
64
+ else if (result.authenticity.status === 'unsigned' ||
65
+ result.authenticity.status === 'signed_unknown' ||
66
+ result.riskAssessment.riskLevel === 'high' ||
67
+ result.riskAssessment.riskLevel === 'critical') {
68
+ result.recommendation = 'WARN';
69
+ // Build warning message
70
+ const warnings = [];
71
+ if (result.authenticity.status === 'unsigned') {
72
+ warnings.push('Dossier is not signed (cannot verify author)');
73
+ }
74
+ if (result.authenticity.status === 'signed_unknown') {
75
+ warnings.push('Signature is valid but signer is not in your trusted keys list');
76
+ }
77
+ if (result.riskAssessment.riskLevel === 'high' ||
78
+ result.riskAssessment.riskLevel === 'critical') {
79
+ warnings.push(`High risk level: ${result.riskAssessment.riskLevel}`);
80
+ }
81
+ result.message = `WARNING: ${warnings.join('. ')}. Review before execution.`;
82
+ }
83
+ else {
84
+ result.recommendation = 'WARN';
85
+ result.message = 'Unsigned dossier with medium risk. Verify source before execution.';
86
+ }
87
+ logger_1.logger.info('Verification completed', {
88
+ dossierFile: path,
89
+ recommendation: result.recommendation,
90
+ integrity: result.integrity.status,
91
+ authenticity: result.authenticity.status,
92
+ riskLevel: result.riskAssessment.riskLevel,
93
+ });
94
+ }
95
+ catch (err) {
96
+ result.errors.push(`Verification error: ${(0, core_1.getErrorMessage)(err)}`);
97
+ result.recommendation = 'BLOCK';
98
+ result.message = `DO NOT EXECUTE - Verification failed: ${(0, core_1.getErrorMessage)(err)}`;
99
+ logger_1.logger.error('Verification FAILED with exception', {
100
+ dossierFile: path,
101
+ error: (0, core_1.getErrorMessage)(err),
102
+ stack: (0, core_1.getErrorStack)(err),
103
+ });
104
+ }
105
+ return result;
106
+ }
107
+ //# sourceMappingURL=verifyDossier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyDossier.js","sourceRoot":"","sources":["../../src/tools/verifyDossier.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAqBH,sCA0GC;AA7HD,2CAO0B;AAC1B,oEAAkE;AAClE,4CAAyC;AAOzC;;GAEG;AACI,KAAK,UAAU,aAAa,CAAC,KAAyB;IAC3D,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAC;IAE1C,eAAM,CAAC,IAAI,CAAC,+BAA+B,EAAE,EAAE,WAAW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AE,CAAC;QACjF,eAAM,CAAC,KAAK,CAAC,oCAAoC,EAAE;YACjD,WAAW,EAAE,IAAI;YACjB,KAAK,EAAE,IAAA,sBAAe,EAAC,GAAG,CAAC;YAC3B,KAAK,EAAE,IAAA,oBAAa,EAAC,GAAG,CAAC;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Error types for dossier MCP server
3
+ */
4
+ export declare enum ErrorType {
5
+ CLIENT_ERROR = "CLIENT_ERROR",
6
+ SERVER_ERROR = "SERVER_ERROR",
7
+ SECURITY_ERROR = "SECURITY_ERROR",
8
+ EXTERNAL_ERROR = "EXTERNAL_ERROR"
9
+ }
10
+ export declare class DossierError extends Error {
11
+ type: ErrorType;
12
+ code?: string | undefined;
13
+ context?: Record<string, unknown> | undefined;
14
+ constructor(type: ErrorType, message: string, code?: string | undefined, context?: Record<string, unknown> | undefined);
15
+ toJSON(): {
16
+ type: ErrorType;
17
+ message: string;
18
+ code: string | undefined;
19
+ context: Record<string, unknown> | undefined;
20
+ };
21
+ }
22
+ export declare class DossierParseError extends DossierError {
23
+ constructor(message: string, context?: Record<string, unknown>);
24
+ }
25
+ export declare class DossierVerificationError extends DossierError {
26
+ verificationType: 'CHECKSUM_MISMATCH' | 'SIGNATURE_INVALID' | 'MISSING_METADATA';
27
+ constructor(verificationType: 'CHECKSUM_MISMATCH' | 'SIGNATURE_INVALID' | 'MISSING_METADATA', details: Record<string, unknown>);
28
+ }
29
+ export declare class DossierNotFoundError extends DossierError {
30
+ constructor(path: string);
31
+ }
32
+ export declare class ExternalToolError extends DossierError {
33
+ constructor(tool: string, message: string, context?: Record<string, unknown>);
34
+ }
35
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,oBAAY,SAAS;IACnB,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;IAC7B,cAAc,mBAAmB;IACjC,cAAc,mBAAmB;CAClC;AAED,qBAAa,YAAa,SAAQ,KAAK;IAE5B,IAAI,EAAE,SAAS;IAEf,IAAI,CAAC,EAAE,MAAM;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBAHjC,IAAI,EAAE,SAAS,EACtB,OAAO,EAAE,MAAM,EACR,IAAI,CAAC,EAAE,MAAM,YAAA,EACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAA;IAM1C,MAAM;;;;;;CAQP;AAED,qBAAa,iBAAkB,SAAQ,YAAY;gBACrC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/D;AAED,qBAAa,wBAAyB,SAAQ,YAAY;IAE/C,gBAAgB,EAAE,mBAAmB,GAAG,mBAAmB,GAAG,kBAAkB;gBAAhF,gBAAgB,EAAE,mBAAmB,GAAG,mBAAmB,GAAG,kBAAkB,EACvF,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAUnC;AAED,qBAAa,oBAAqB,SAAQ,YAAY;gBACxC,IAAI,EAAE,MAAM;CAIzB;AAED,qBAAa,iBAAkB,SAAQ,YAAY;gBACrC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAO7E"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ /**
3
+ * Error types for dossier MCP server
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ExternalToolError = exports.DossierNotFoundError = exports.DossierVerificationError = exports.DossierParseError = exports.DossierError = exports.ErrorType = void 0;
7
+ var ErrorType;
8
+ (function (ErrorType) {
9
+ ErrorType["CLIENT_ERROR"] = "CLIENT_ERROR";
10
+ ErrorType["SERVER_ERROR"] = "SERVER_ERROR";
11
+ ErrorType["SECURITY_ERROR"] = "SECURITY_ERROR";
12
+ ErrorType["EXTERNAL_ERROR"] = "EXTERNAL_ERROR";
13
+ })(ErrorType || (exports.ErrorType = ErrorType = {}));
14
+ class DossierError extends Error {
15
+ type;
16
+ code;
17
+ context;
18
+ constructor(type, message, code, context) {
19
+ super(message);
20
+ this.type = type;
21
+ this.code = code;
22
+ this.context = context;
23
+ this.name = 'DossierError';
24
+ }
25
+ toJSON() {
26
+ return {
27
+ type: this.type,
28
+ message: this.message,
29
+ code: this.code,
30
+ context: this.context,
31
+ };
32
+ }
33
+ }
34
+ exports.DossierError = DossierError;
35
+ class DossierParseError extends DossierError {
36
+ constructor(message, context) {
37
+ super(ErrorType.CLIENT_ERROR, message, 'PARSE_ERROR', context);
38
+ this.name = 'DossierParseError';
39
+ }
40
+ }
41
+ exports.DossierParseError = DossierParseError;
42
+ class DossierVerificationError extends DossierError {
43
+ verificationType;
44
+ constructor(verificationType, details) {
45
+ super(ErrorType.SECURITY_ERROR, `Verification failed: ${verificationType}`, verificationType, details);
46
+ this.verificationType = verificationType;
47
+ this.name = 'DossierVerificationError';
48
+ }
49
+ }
50
+ exports.DossierVerificationError = DossierVerificationError;
51
+ class DossierNotFoundError extends DossierError {
52
+ constructor(path) {
53
+ super(ErrorType.CLIENT_ERROR, `Dossier not found: ${path}`, 'NOT_FOUND', { path });
54
+ this.name = 'DossierNotFoundError';
55
+ }
56
+ }
57
+ exports.DossierNotFoundError = DossierNotFoundError;
58
+ class ExternalToolError extends DossierError {
59
+ constructor(tool, message, context) {
60
+ super(ErrorType.EXTERNAL_ERROR, `${tool} error: ${message}`, 'EXTERNAL_TOOL_ERROR', {
61
+ tool,
62
+ ...context,
63
+ });
64
+ this.name = 'ExternalToolError';
65
+ }
66
+ }
67
+ exports.ExternalToolError = ExternalToolError;
68
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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AAED,MAAa,oBAAqB,SAAQ,YAAY;IACpD,YAAY,IAAY;QACtB,KAAK,CAAC,SAAS,CAAC,YAAY,EAAE,sBAAsB,IAAI,EAAE,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QACnF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AALD,oDAKC;AAED,MAAa,iBAAkB,SAAQ,YAAY;IACjD,YAAY,IAAY,EAAE,OAAe,EAAE,OAAiC;QAC1E,KAAK,CAAC,SAAS,CAAC,cAAc,EAAE,GAAG,IAAI,WAAW,OAAO,EAAE,EAAE,qBAAqB,EAAE;YAClF,IAAI;YACJ,GAAG,OAAO;SACX,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AARD,8CAQC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Structured logging utility for MCP server
3
+ * CRITICAL: All logs MUST go to stderr, not stdout
4
+ * stdout is reserved for JSON-RPC messages only
5
+ */
6
+ export declare enum LogLevel {
7
+ DEBUG = "debug",
8
+ INFO = "info",
9
+ WARN = "warn",
10
+ ERROR = "error"
11
+ }
12
+ export interface LogEntry {
13
+ timestamp: string;
14
+ level: LogLevel;
15
+ message: string;
16
+ context?: Record<string, unknown>;
17
+ }
18
+ declare class Logger {
19
+ private minLevel;
20
+ constructor(minLevel?: LogLevel);
21
+ private shouldLog;
22
+ private log;
23
+ debug(message: string, context?: Record<string, unknown>): void;
24
+ info(message: string, context?: Record<string, unknown>): void;
25
+ warn(message: string, context?: Record<string, unknown>): void;
26
+ error(message: string, context?: Record<string, unknown>): void;
27
+ setLevel(level: LogLevel): void;
28
+ }
29
+ export declare const logger: Logger;
30
+ export {};
31
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,oBAAY,QAAQ;IAClB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,cAAM,MAAM;IACV,OAAO,CAAC,QAAQ,CAAW;gBAEf,QAAQ,GAAE,QAAwB;IAI9C,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,GAAG;IAgBX,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI/D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI9D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI9D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI/D,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;CAGhC;AAGD,eAAO,MAAM,MAAM,QAElB,CAAC"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ /**
3
+ * Structured logging utility for MCP server
4
+ * CRITICAL: All logs MUST go to stderr, not stdout
5
+ * stdout is reserved for JSON-RPC messages only
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.logger = exports.LogLevel = void 0;
9
+ var LogLevel;
10
+ (function (LogLevel) {
11
+ LogLevel["DEBUG"] = "debug";
12
+ LogLevel["INFO"] = "info";
13
+ LogLevel["WARN"] = "warn";
14
+ LogLevel["ERROR"] = "error";
15
+ })(LogLevel || (exports.LogLevel = LogLevel = {}));
16
+ class Logger {
17
+ minLevel;
18
+ constructor(minLevel = LogLevel.INFO) {
19
+ this.minLevel = minLevel;
20
+ }
21
+ shouldLog(level) {
22
+ const levels = [LogLevel.DEBUG, LogLevel.INFO, LogLevel.WARN, LogLevel.ERROR];
23
+ const minIndex = levels.indexOf(this.minLevel);
24
+ const currentIndex = levels.indexOf(level);
25
+ return currentIndex >= minIndex;
26
+ }
27
+ log(level, message, context) {
28
+ if (!this.shouldLog(level)) {
29
+ return;
30
+ }
31
+ const entry = {
32
+ timestamp: new Date().toISOString(),
33
+ level,
34
+ message,
35
+ context,
36
+ };
37
+ // CRITICAL: Write to stderr only!
38
+ console.error(JSON.stringify(entry));
39
+ }
40
+ debug(message, context) {
41
+ this.log(LogLevel.DEBUG, message, context);
42
+ }
43
+ info(message, context) {
44
+ this.log(LogLevel.INFO, message, context);
45
+ }
46
+ warn(message, context) {
47
+ this.log(LogLevel.WARN, message, context);
48
+ }
49
+ error(message, context) {
50
+ this.log(LogLevel.ERROR, message, context);
51
+ }
52
+ setLevel(level) {
53
+ this.minLevel = level;
54
+ }
55
+ }
56
+ // Export singleton instance
57
+ exports.logger = new Logger(process.env.LOG_LEVEL === 'debug' ? LogLevel.DEBUG : LogLevel.INFO);
58
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,2BAAe,CAAA;AACjB,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB;AASD,MAAM,MAAM;IACF,QAAQ,CAAW;IAE3B,YAAY,WAAqB,QAAQ,CAAC,IAAI;QAC5C,IAAI,CAAC,QAAQ,GAAG,QA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AAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,QAAQ,CAAC,KAAe;QACtB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;CACF;AAED,4BAA4B;AACf,QAAA,MAAM,GAAG,IAAI,MAAM,CAC9B,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CACnE,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Resource file loader utility
3
+ * Loads markdown files from the project with logging
4
+ */
5
+ /**
6
+ * Load a markdown resource file with logging
7
+ * @param relativePath - Path relative to project root (e.g., 'PROTOCOL.md', 'security/ARCHITECTURE.md')
8
+ * @param resourceName - Human-readable name for logging (e.g., 'protocol', 'security')
9
+ * @returns File content as string
10
+ * @throws Error if file cannot be loaded
11
+ */
12
+ export declare function loadMarkdownResource(relativePath: string, resourceName: string): string;
13
+ /**
14
+ * Factory to create resource loader functions
15
+ * @param relativePath - Path relative to project root
16
+ * @param resourceName - Human-readable name for logging
17
+ * @returns A function that loads the resource when called
18
+ */
19
+ export declare const createResourceLoader: (relativePath: string, resourceName: string) => (() => string);
20
+ //# sourceMappingURL=resourceLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceLoader.d.ts","sourceRoot":"","sources":["../../src/utils/resourceLoader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAiBvF;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAC9B,cAAc,MAAM,EAAE,cAAc,MAAM,KAAG,CAAC,MAAM,MAAM,CAET,CAAC"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ /**
3
+ * Resource file loader utility
4
+ * Loads markdown files from the project with logging
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.createResourceLoader = void 0;
8
+ exports.loadMarkdownResource = loadMarkdownResource;
9
+ const node_fs_1 = require("node:fs");
10
+ const node_path_1 = require("node:path");
11
+ const core_1 = require("@ai-dossier/core");
12
+ const logger_1 = require("./logger");
13
+ /**
14
+ * Load a markdown resource file with logging
15
+ * @param relativePath - Path relative to project root (e.g., 'PROTOCOL.md', 'security/ARCHITECTURE.md')
16
+ * @param resourceName - Human-readable name for logging (e.g., 'protocol', 'security')
17
+ * @returns File content as string
18
+ * @throws Error if file cannot be loaded
19
+ */
20
+ function loadMarkdownResource(relativePath, resourceName) {
21
+ const fullPath = (0, node_path_1.join)(__dirname, '../../..', relativePath);
22
+ try {
23
+ const content = (0, node_fs_1.readFileSync)(fullPath, 'utf8');
24
+ logger_1.logger.debug(`Loaded ${resourceName} resource`, {
25
+ path: fullPath,
26
+ length: content.length,
27
+ });
28
+ return content;
29
+ }
30
+ catch (err) {
31
+ logger_1.logger.error(`Failed to load ${relativePath}`, {
32
+ path: fullPath,
33
+ error: (0, core_1.getErrorMessage)(err),
34
+ });
35
+ throw new Error(`Failed to load ${relativePath}: ${(0, core_1.getErrorMessage)(err)}`);
36
+ }
37
+ }
38
+ /**
39
+ * Factory to create resource loader functions
40
+ * @param relativePath - Path relative to project root
41
+ * @param resourceName - Human-readable name for logging
42
+ * @returns A function that loads the resource when called
43
+ */
44
+ const createResourceLoader = (relativePath, resourceName) => () => loadMarkdownResource(relativePath, resourceName);
45
+ exports.createResourceLoader = createResourceLoader;
46
+ //# sourceMappingURL=resourceLoader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceLoader.js","sourceRoot":"","sources":["../../src/utils/resourceLoader.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAcH,oDAiBC;AA7BD,qCAAuC;AACvC,yCAAiC;AACjC,2CAAmD;AACnD,qCAAkC;AAElC;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAAC,YAAoB,EAAE,YAAoB;IAC7E,MAAM,QAAQ,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;IAE3D,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAA,sBAAY,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC/C,eAAM,CAAC,KAAK,CAAC,UAAU,YAAY,WAAW,EAAE;YAC9C,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,eAAM,CAAC,KAAK,CAAC,kBAAkB,YAAY,EAAE,EAAE;YAC7C,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,IAAA,sBAAe,EAAC,GAAG,CAAC;SAC5B,CAAC,CAAC;QACH,MAAM,IAAI,KAAK,CAAC,kBAAkB,YAAY,KAAK,IAAA,sBAAe,EAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACI,MAAM,oBAAoB,GAC/B,CAAC,YAAoB,EAAE,YAAoB,EAAkB,EAAE,CAC/D,GAAW,EAAE,CACX,oBAAoB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AAHxC,QAAA,oBAAoB,wBAGoB"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * MCP tool response utilities
3
+ */
4
+ /**
5
+ * Create a standardized MCP tool response
6
+ * @param data - Data to include in the response (will be JSON stringified)
7
+ * @param isError - Whether this is an error response
8
+ * @returns Formatted tool response object
9
+ */
10
+ export declare function createToolResponse(data: unknown, isError?: boolean): {
11
+ content: Array<{
12
+ type: "text";
13
+ text: string;
14
+ }>;
15
+ isError?: boolean;
16
+ };
17
+ //# sourceMappingURL=response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/utils/response.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,UAAQ;aAEpD,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;cACpC,OAAO;EAQpB"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ /**
3
+ * MCP tool response utilities
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createToolResponse = createToolResponse;
7
+ /**
8
+ * Create a standardized MCP tool response
9
+ * @param data - Data to include in the response (will be JSON stringified)
10
+ * @param isError - Whether this is an error response
11
+ * @returns Formatted tool response object
12
+ */
13
+ function createToolResponse(data, isError = false) {
14
+ const response = {
15
+ content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
16
+ };
17
+ if (isError) {
18
+ response.isError = true;
19
+ }
20
+ return response;
21
+ }
22
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../src/utils/response.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAQH,gDAWC;AAjBD;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,IAAa,EAAE,OAAO,GAAG,KAAK;IAC/D,MAAM,QAAQ,GAGV;QACF,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;KACjE,CAAC;IACF,IAAI,OAAO,EAAE,CAAC;QACZ,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;IAC1B,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@ai-dossier/mcp-server",
3
+ "version": "1.0.1",
4
+ "description": "MCP server for dossier automation standard - enables LLMs to discover, verify, and execute dossiers",
5
+ "main": "dist/index.js",
6
+ "bin": {
7
+ "dossier-mcp-server": "dist/index.js"
8
+ },
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "dev": "tsx src/index.ts",
12
+ "start": "node dist/index.js",
13
+ "test": "echo \"No tests yet for mcp-server\""
14
+ },
15
+ "keywords": [
16
+ "mcp",
17
+ "dossier",
18
+ "automation",
19
+ "llm",
20
+ "ai",
21
+ "model-context-protocol"
22
+ ],
23
+ "author": "Yuval Dimnik <yuval.dimnik@gmail.com>",
24
+ "license": "MIT",
25
+ "type": "commonjs",
26
+ "files": [
27
+ "dist/"
28
+ ],
29
+ "publishConfig": {
30
+ "access": "public",
31
+ "registry": "https://registry.npmjs.org"
32
+ },
33
+ "dependencies": {
34
+ "@aws-sdk/client-kms": "^3.927.0",
35
+ "@ai-dossier/core": "*",
36
+ "@modelcontextprotocol/sdk": "^1.21.0",
37
+ "tweetnacl": "^1.0.3",
38
+ "zod": "^3.25.76"
39
+ },
40
+ "devDependencies": {
41
+ "@types/node": "^24.10.0",
42
+ "tsx": "^4.20.6",
43
+ "typescript": "^5.9.3"
44
+ }
45
+ }