@j0hanz/cortex-mcp 0.1.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.
Files changed (80) hide show
  1. package/README.md +269 -0
  2. package/dist/assets/logo.svg +49 -0
  3. package/dist/engine/config.d.ts +9 -0
  4. package/dist/engine/config.d.ts.map +1 -0
  5. package/dist/engine/config.js +26 -0
  6. package/dist/engine/config.js.map +1 -0
  7. package/dist/engine/context.d.ts +7 -0
  8. package/dist/engine/context.d.ts.map +1 -0
  9. package/dist/engine/context.js +6 -0
  10. package/dist/engine/context.js.map +1 -0
  11. package/dist/engine/events.d.ts +51 -0
  12. package/dist/engine/events.d.ts.map +1 -0
  13. package/dist/engine/events.js +9 -0
  14. package/dist/engine/events.js.map +1 -0
  15. package/dist/engine/index.d.ts +6 -0
  16. package/dist/engine/index.d.ts.map +1 -0
  17. package/dist/engine/index.js +6 -0
  18. package/dist/engine/index.js.map +1 -0
  19. package/dist/engine/reasoner.d.ts +12 -0
  20. package/dist/engine/reasoner.d.ts.map +1 -0
  21. package/dist/engine/reasoner.js +208 -0
  22. package/dist/engine/reasoner.js.map +1 -0
  23. package/dist/engine/session-store.d.ts +17 -0
  24. package/dist/engine/session-store.d.ts.map +1 -0
  25. package/dist/engine/session-store.js +120 -0
  26. package/dist/engine/session-store.js.map +1 -0
  27. package/dist/index.d.ts +3 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +48 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/instructions.md +131 -0
  32. package/dist/lib/errors.d.ts +19 -0
  33. package/dist/lib/errors.d.ts.map +1 -0
  34. package/dist/lib/errors.js +41 -0
  35. package/dist/lib/errors.js.map +1 -0
  36. package/dist/lib/instructions.d.ts +5 -0
  37. package/dist/lib/instructions.d.ts.map +1 -0
  38. package/dist/lib/instructions.js +14 -0
  39. package/dist/lib/instructions.js.map +1 -0
  40. package/dist/lib/text.d.ts +20 -0
  41. package/dist/lib/text.d.ts.map +1 -0
  42. package/dist/lib/text.js +74 -0
  43. package/dist/lib/text.js.map +1 -0
  44. package/dist/lib/tool-response.d.ts +6 -0
  45. package/dist/lib/tool-response.d.ts.map +1 -0
  46. package/dist/lib/tool-response.js +13 -0
  47. package/dist/lib/tool-response.js.map +1 -0
  48. package/dist/lib/types.d.ts +27 -0
  49. package/dist/lib/types.d.ts.map +1 -0
  50. package/dist/lib/types.js +2 -0
  51. package/dist/lib/types.js.map +1 -0
  52. package/dist/prompts/index.d.ts +4 -0
  53. package/dist/prompts/index.d.ts.map +1 -0
  54. package/dist/prompts/index.js +156 -0
  55. package/dist/prompts/index.js.map +1 -0
  56. package/dist/resources/index.d.ts +4 -0
  57. package/dist/resources/index.d.ts.map +1 -0
  58. package/dist/resources/index.js +248 -0
  59. package/dist/resources/index.js.map +1 -0
  60. package/dist/schemas/inputs.d.ts +13 -0
  61. package/dist/schemas/inputs.d.ts.map +1 -0
  62. package/dist/schemas/inputs.js +39 -0
  63. package/dist/schemas/inputs.js.map +1 -0
  64. package/dist/schemas/outputs.d.ts +76 -0
  65. package/dist/schemas/outputs.d.ts.map +1 -0
  66. package/dist/schemas/outputs.js +59 -0
  67. package/dist/schemas/outputs.js.map +1 -0
  68. package/dist/server.d.ts +3 -0
  69. package/dist/server.d.ts.map +1 -0
  70. package/dist/server.js +169 -0
  71. package/dist/server.js.map +1 -0
  72. package/dist/tools/index.d.ts +7 -0
  73. package/dist/tools/index.d.ts.map +1 -0
  74. package/dist/tools/index.js +8 -0
  75. package/dist/tools/index.js.map +1 -0
  76. package/dist/tools/reasoning-think.d.ts +9 -0
  77. package/dist/tools/reasoning-think.d.ts.map +1 -0
  78. package/dist/tools/reasoning-think.js +298 -0
  79. package/dist/tools/reasoning-think.js.map +1 -0
  80. package/package.json +75 -0
@@ -0,0 +1,14 @@
1
+ import { readFileSync } from 'node:fs';
2
+ /**
3
+ * Loads the instructions from the instructions.md file. If the file cannot be read or is empty, returns a fallback message.
4
+ */
5
+ export function loadInstructions(fallback = '(Instructions not available)') {
6
+ try {
7
+ const text = readFileSync(new URL('../instructions.md', import.meta.url), 'utf8').trim();
8
+ return text.length > 0 ? text : fallback;
9
+ }
10
+ catch {
11
+ return fallback;
12
+ }
13
+ }
14
+ //# sourceMappingURL=instructions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../src/lib/instructions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAAQ,GAAG,8BAA8B;IAEzC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,YAAY,CACvB,IAAI,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAC9C,MAAM,CACP,CAAC,IAAI,EAAE,CAAC;QACT,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Creates an Intl.Segmenter instance if available in the environment.
3
+ * gracefully handles missing Intl support or specific locale issues.
4
+ */
5
+ export declare function createSegmenter(granularity: 'grapheme' | 'sentence'): Intl.Segmenter | undefined;
6
+ /**
7
+ * Truncates a string to a maximum byte length, respecting grapheme clusters if a segmenter is provided.
8
+ * Appends a suffix '...' if truncation occurs.
9
+ *
10
+ * @param str The string to truncate.
11
+ * @param maxLength The maximum length in bytes.
12
+ * @param segmenter Optional Intl.Segmenter for grapheme-aware truncation.
13
+ */
14
+ export declare function truncate(str: string, maxLength: number, segmenter?: Intl.Segmenter): string;
15
+ /**
16
+ * Truncates a string to fit within maxBytes, ensuring no partial UTF-8 characters are included.
17
+ * Drops incomplete characters at the end rather than using replacement characters.
18
+ */
19
+ export declare function truncateByUtf8Boundary(str: string, maxBytes: number): string;
20
+ //# sourceMappingURL=text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/lib/text.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,UAAU,GAAG,UAAU,GACnC,IAAI,CAAC,SAAS,GAAG,SAAS,CAS5B;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,IAAI,CAAC,SAAS,GACzB,MAAM,CAkBR;AAyBD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAY5E"}
@@ -0,0 +1,74 @@
1
+ import { Buffer } from 'node:buffer';
2
+ import { StringDecoder } from 'node:string_decoder';
3
+ /**
4
+ * Creates an Intl.Segmenter instance if available in the environment.
5
+ * gracefully handles missing Intl support or specific locale issues.
6
+ */
7
+ export function createSegmenter(granularity) {
8
+ if (typeof Intl !== 'object' || typeof Intl.Segmenter !== 'function') {
9
+ return undefined;
10
+ }
11
+ try {
12
+ return new Intl.Segmenter(undefined, { granularity });
13
+ }
14
+ catch {
15
+ return undefined;
16
+ }
17
+ }
18
+ /**
19
+ * Truncates a string to a maximum byte length, respecting grapheme clusters if a segmenter is provided.
20
+ * Appends a suffix '...' if truncation occurs.
21
+ *
22
+ * @param str The string to truncate.
23
+ * @param maxLength The maximum length in bytes.
24
+ * @param segmenter Optional Intl.Segmenter for grapheme-aware truncation.
25
+ */
26
+ export function truncate(str, maxLength, segmenter) {
27
+ const suffix = '...';
28
+ // If maxLength is negative, treat as 0
29
+ const maxBytes = Math.max(0, maxLength);
30
+ const suffixBytes = Buffer.byteLength(suffix, 'utf8');
31
+ if (Buffer.byteLength(str, 'utf8') <= maxBytes) {
32
+ return str;
33
+ }
34
+ // If we can't even fit the suffix, just return the suffix truncated (e.g. "." or "..")
35
+ if (maxBytes <= suffixBytes) {
36
+ return suffix.slice(0, maxBytes);
37
+ }
38
+ const targetBytes = maxBytes - suffixBytes;
39
+ const truncated = truncateByGrapheme(str, targetBytes, segmenter);
40
+ return truncated + suffix;
41
+ }
42
+ function truncateByGrapheme(str, maxBytes, segmenter) {
43
+ if (!segmenter) {
44
+ return truncateByUtf8Boundary(str, maxBytes);
45
+ }
46
+ let result = '';
47
+ let usedBytes = 0;
48
+ for (const part of segmenter.segment(str)) {
49
+ const segmentBytes = Buffer.byteLength(part.segment, 'utf8');
50
+ if (usedBytes + segmentBytes > maxBytes) {
51
+ break;
52
+ }
53
+ result += part.segment;
54
+ usedBytes += segmentBytes;
55
+ }
56
+ return result;
57
+ }
58
+ /**
59
+ * Truncates a string to fit within maxBytes, ensuring no partial UTF-8 characters are included.
60
+ * Drops incomplete characters at the end rather than using replacement characters.
61
+ */
62
+ export function truncateByUtf8Boundary(str, maxBytes) {
63
+ const safeMaxBytes = Math.max(0, maxBytes);
64
+ const encoded = Buffer.from(str, 'utf8');
65
+ if (encoded.length <= safeMaxBytes) {
66
+ return str;
67
+ }
68
+ if (safeMaxBytes === 0) {
69
+ return '';
70
+ }
71
+ const decoder = new StringDecoder('utf8');
72
+ return decoder.write(encoded.subarray(0, safeMaxBytes));
73
+ }
74
+ //# sourceMappingURL=text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/lib/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,WAAoC;IAEpC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,SAAS,KAAK,UAAU,EAAE,CAAC;QACrE,OAAO,SAAS,CAAC;IACnB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AAM,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC7D,IAAI,SAAS,GAAG,YAAY,GAAG,QAAQ,EAAE,CAAC;YACxC,MAAM;QACR,CAAC;QACD,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC;QACvB,SAAS,IAAI,YAAY,CAAC;IAC5B,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAW,EAAE,QAAgB;IAClE,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACzC,IAAI,OAAO,CAAC,MAAM,IAAI,YAAY,EAAE,CAAC;QACnC,OAAO,GAAG,CAAC;IACb,CAAC;IACD,IAAI,YAAY,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { ContentBlock, TextResourceContents } from '@modelcontextprotocol/sdk/types.js';
2
+ export declare function createToolResponse<T extends object>(structured: T, embeddedResource?: TextResourceContents): {
3
+ content: ContentBlock[];
4
+ structuredContent: T;
5
+ };
6
+ //# sourceMappingURL=tool-response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-response.d.ts","sourceRoot":"","sources":["../../src/lib/tool-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,oBAAoB,EACrB,MAAM,oCAAoC,CAAC;AAE5C,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EACjD,UAAU,EAAE,CAAC,EACb,gBAAgB,CAAC,EAAE,oBAAoB,GACtC;IACD,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,iBAAiB,EAAE,CAAC,CAAC;CACtB,CAWA"}
@@ -0,0 +1,13 @@
1
+ export function createToolResponse(structured, embeddedResource) {
2
+ const content = [
3
+ { type: 'text', text: JSON.stringify(structured) },
4
+ ];
5
+ if (embeddedResource) {
6
+ content.push({ type: 'resource', resource: embeddedResource });
7
+ }
8
+ return {
9
+ content,
10
+ structuredContent: structured,
11
+ };
12
+ }
13
+ //# sourceMappingURL=tool-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-response.js","sourceRoot":"","sources":["../../src/lib/tool-response.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,kBAAkB,CAChC,UAAa,EACb,gBAAuC;IAKvC,MAAM,OAAO,GAAmB;QAC9B,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE;KACnD,CAAC;IACF,IAAI,gBAAgB,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC,CAAC;IACjE,CAAC;IACD,OAAO;QACL,OAAO;QACP,iBAAiB,EAAE,UAAU;KAC9B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,27 @@
1
+ export type ReasoningLevel = 'basic' | 'normal' | 'high';
2
+ export interface Thought {
3
+ index: number;
4
+ content: string;
5
+ revision: number;
6
+ }
7
+ export interface Session {
8
+ id: string;
9
+ level: ReasoningLevel;
10
+ thoughts: Thought[];
11
+ totalThoughts: number;
12
+ tokenBudget: number;
13
+ tokensUsed: number;
14
+ createdAt: number;
15
+ updatedAt: number;
16
+ }
17
+ export interface LevelConfig {
18
+ minThoughts: number;
19
+ maxThoughts: number;
20
+ tokenBudget: number;
21
+ }
22
+ export interface IconMeta {
23
+ src: string;
24
+ mimeType: string;
25
+ sizes?: string[];
26
+ }
27
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEzD,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { IconMeta } from '../lib/types.js';
3
+ export declare function registerAllPrompts(server: McpServer, iconMeta?: IconMeta): void;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAkEhD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,EACjB,QAAQ,CAAC,EAAE,QAAQ,GAClB,IAAI,CA2HN"}
@@ -0,0 +1,156 @@
1
+ import { z } from 'zod';
2
+ import { loadInstructions } from '../lib/instructions.js';
3
+ function levelTitle(level) {
4
+ return `${level.charAt(0).toUpperCase()}${level.slice(1)}`;
5
+ }
6
+ function formatTargetThoughts(targetThoughts) {
7
+ if (targetThoughts === undefined) {
8
+ return '';
9
+ }
10
+ return `, targetThoughts=${String(targetThoughts)}`;
11
+ }
12
+ function registerLevelPrompt(server, level, iconMeta) {
13
+ server.registerPrompt(`reasoning.${level}`, {
14
+ title: `Reasoning ${levelTitle(level)}`,
15
+ description: `Prepare a ${level}-depth reasoning request.`,
16
+ ...(iconMeta
17
+ ? {
18
+ icons: [iconMeta],
19
+ }
20
+ : {}),
21
+ argsSchema: {
22
+ query: z
23
+ .string()
24
+ .min(1)
25
+ .max(10000)
26
+ .describe('The question or problem to reason about'),
27
+ targetThoughts: z
28
+ .number()
29
+ .int()
30
+ .min(1)
31
+ .max(25)
32
+ .optional()
33
+ .describe('Optional exact step count within the selected level range (max 25)'),
34
+ },
35
+ }, ({ query, targetThoughts }) => {
36
+ // Create user message
37
+ const text = `Use tool "reasoning.think" with query=${JSON.stringify(query)}, level="${level}"${formatTargetThoughts(targetThoughts)}.`;
38
+ return {
39
+ messages: [
40
+ {
41
+ role: 'user',
42
+ content: {
43
+ type: 'text',
44
+ text,
45
+ },
46
+ },
47
+ ],
48
+ };
49
+ });
50
+ }
51
+ export function registerAllPrompts(server, iconMeta) {
52
+ registerLevelPrompt(server, 'basic', iconMeta);
53
+ registerLevelPrompt(server, 'normal', iconMeta);
54
+ registerLevelPrompt(server, 'high', iconMeta);
55
+ server.registerPrompt('reasoning.retry', {
56
+ title: 'Retry Reasoning',
57
+ description: 'Retry a failed reasoning task with modified parameters.',
58
+ ...(iconMeta
59
+ ? {
60
+ icons: [iconMeta],
61
+ }
62
+ : {}),
63
+ argsSchema: {
64
+ query: z
65
+ .string()
66
+ .min(1)
67
+ .max(10000)
68
+ .describe('The original or modified query'),
69
+ level: z
70
+ .enum(['basic', 'normal', 'high'])
71
+ .describe('The reasoning level to use'),
72
+ targetThoughts: z
73
+ .number()
74
+ .int()
75
+ .min(1)
76
+ .max(25)
77
+ .optional()
78
+ .describe('Optional exact step count'),
79
+ },
80
+ }, ({ query, level, targetThoughts }) => {
81
+ const text = `Use tool "reasoning.think" with query=${JSON.stringify(query)}, level="${level}"${formatTargetThoughts(targetThoughts)}.`;
82
+ return {
83
+ messages: [
84
+ {
85
+ role: 'user',
86
+ content: {
87
+ type: 'text',
88
+ text,
89
+ },
90
+ },
91
+ ],
92
+ };
93
+ });
94
+ const instructions = loadInstructions();
95
+ server.registerPrompt('get-help', {
96
+ title: 'Get Help',
97
+ description: 'Return the server usage instructions.',
98
+ ...(iconMeta
99
+ ? {
100
+ icons: [iconMeta],
101
+ }
102
+ : {}),
103
+ }, () => ({
104
+ messages: [
105
+ {
106
+ role: 'user',
107
+ content: { type: 'text', text: instructions },
108
+ },
109
+ ],
110
+ }));
111
+ server.registerPrompt('reasoning.continue', {
112
+ title: 'Continue Reasoning',
113
+ description: 'Continue an existing reasoning session with a follow-up query.',
114
+ ...(iconMeta
115
+ ? {
116
+ icons: [iconMeta],
117
+ }
118
+ : {}),
119
+ argsSchema: {
120
+ sessionId: z
121
+ .string()
122
+ .min(1)
123
+ .max(128)
124
+ .describe('Existing session ID to continue'),
125
+ query: z
126
+ .string()
127
+ .min(1)
128
+ .max(10000)
129
+ .describe('Follow-up query for the existing session'),
130
+ level: z
131
+ .enum(['basic', 'normal', 'high'])
132
+ .describe('Must match the session level'),
133
+ targetThoughts: z
134
+ .number()
135
+ .int()
136
+ .min(1)
137
+ .max(25)
138
+ .optional()
139
+ .describe('Optional exact step count within the selected level range (max 25)'),
140
+ },
141
+ }, ({ sessionId, query, level, targetThoughts }) => {
142
+ const text = `Use tool "reasoning.think" with sessionId=${JSON.stringify(sessionId)}, query=${JSON.stringify(query)}, level="${level}"${formatTargetThoughts(targetThoughts)}.`;
143
+ return {
144
+ messages: [
145
+ {
146
+ role: 'user',
147
+ content: {
148
+ type: 'text',
149
+ text,
150
+ },
151
+ },
152
+ ],
153
+ };
154
+ });
155
+ }
156
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAK1D,SAAS,UAAU,CAAC,KAAkB;IACpC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAC7D,CAAC;AAED,SAAS,oBAAoB,CAAC,cAAuB;IACnD,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QACjC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,oBAAoB,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC;AACtD,CAAC;AAED,SAAS,mBAAmB,CAC1B,MAAiB,EACjB,KAAkB,EAClB,QAAmB;IAEnB,MAAM,CAAC,cAAc,CACnB,aAAa,KAAK,EAAE,EACpB;QACE,KAAK,EAAE,aAAa,UAAU,CAAC,KAAK,CAAC,EAAE;QACvC,WAAW,EAAE,aAAa,KAAK,2BAA2B;QAC1D,GAAG,CAAC,QAAQ;YACV,CAAC,CAAC;gBACE,KAAK,EAAE,CAAC,QAAQ,CAAC;aAClB;YACH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1,4 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { IconMeta } from '../lib/types.js';
3
+ export declare function registerAllResources(server: McpServer, iconMeta?: IconMeta): void;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,OAAO,KAAK,EAAE,QAAQ,EAAW,MAAM,iBAAiB,CAAC;AAmGzD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,EACjB,QAAQ,CAAC,EAAE,QAAQ,GAClB,IAAI,CAgPN"}
@@ -0,0 +1,248 @@
1
+ import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { McpError } from '@modelcontextprotocol/sdk/types.js';
3
+ import { sessionStore } from '../engine/reasoner.js';
4
+ import { loadInstructions } from '../lib/instructions.js';
5
+ import { formatThoughtsToMarkdown } from '../tools/reasoning-think.js';
6
+ // --- Helpers ---
7
+ function extractStringVariable(variables, name, uri) {
8
+ const raw = variables[name];
9
+ const value = Array.isArray(raw) ? raw[0] : raw;
10
+ if (typeof value !== 'string' || value.length === 0) {
11
+ throw new McpError(-32602, `Invalid ${name} in URI: ${uri.toString()}`);
12
+ }
13
+ return value;
14
+ }
15
+ function resolveSession(sessionId, uri) {
16
+ const session = sessionStore.get(sessionId);
17
+ if (!session) {
18
+ throw new McpError(-32002, `Resource not found: ${uri.toString()}`);
19
+ }
20
+ return session;
21
+ }
22
+ function buildSessionSummary(sessionId) {
23
+ const session = sessionStore.get(sessionId);
24
+ if (!session) {
25
+ throw new McpError(-32002, `Resource not found: reasoning://sessions/${sessionId}`);
26
+ }
27
+ const ttlMs = sessionStore.getTtlMs();
28
+ const expiresAt = sessionStore.getExpiresAt(session.id) ?? session.updatedAt + ttlMs;
29
+ return {
30
+ id: session.id,
31
+ level: session.level,
32
+ totalThoughts: session.thoughts.length,
33
+ tokenBudget: session.tokenBudget,
34
+ tokensUsed: session.tokensUsed,
35
+ createdAt: session.createdAt,
36
+ updatedAt: session.updatedAt,
37
+ expiresAt,
38
+ };
39
+ }
40
+ const THOUGHT_NAME_PATTERN = /^Thought-(\d+)(?:-Revised)?$/;
41
+ function parseThoughtName(thoughtName, session) {
42
+ const match = THOUGHT_NAME_PATTERN.exec(thoughtName);
43
+ if (!match?.[1]) {
44
+ throw new McpError(-32602, `Invalid thought name format: ${thoughtName}. Expected "Thought-N" or "Thought-N-Revised".`);
45
+ }
46
+ const oneBasedIndex = parseInt(match[1], 10);
47
+ const zeroBasedIndex = oneBasedIndex - 1;
48
+ if (zeroBasedIndex < 0 || zeroBasedIndex >= session.thoughts.length) {
49
+ throw new McpError(-32002, `Thought not found: ${thoughtName}`);
50
+ }
51
+ return {
52
+ index: oneBasedIndex,
53
+ requestedRevised: thoughtName.endsWith('-Revised'),
54
+ };
55
+ }
56
+ function serializeJson(data) {
57
+ return JSON.stringify(data, null, 2);
58
+ }
59
+ const completionCache = new Map();
60
+ export function registerAllResources(server, iconMeta) {
61
+ const instructions = loadInstructions();
62
+ server.registerResource('server-instructions', 'internal://instructions', {
63
+ title: 'Server Instructions',
64
+ description: 'Usage instructions for the MCP server.',
65
+ mimeType: 'text/markdown',
66
+ annotations: { audience: ['assistant'], priority: 0.8 },
67
+ ...(iconMeta
68
+ ? {
69
+ icons: [
70
+ {
71
+ src: iconMeta.src,
72
+ mimeType: iconMeta.mimeType,
73
+ },
74
+ ],
75
+ }
76
+ : {}),
77
+ }, (uri) => ({
78
+ contents: [
79
+ { uri: uri.href, mimeType: 'text/markdown', text: instructions },
80
+ ],
81
+ }));
82
+ server.registerResource('reasoning.sessions', 'reasoning://sessions', {
83
+ title: 'Reasoning Sessions',
84
+ description: 'List of active reasoning sessions with summaries. Updated in real-time as sessions progress.',
85
+ mimeType: 'application/json',
86
+ annotations: {
87
+ audience: ['assistant', 'user'],
88
+ priority: 0.7,
89
+ },
90
+ ...(iconMeta
91
+ ? {
92
+ icons: [
93
+ {
94
+ src: iconMeta.src,
95
+ mimeType: iconMeta.mimeType,
96
+ },
97
+ ],
98
+ }
99
+ : {}),
100
+ }, () => {
101
+ const ttlMs = sessionStore.getTtlMs();
102
+ const sessions = sessionStore.list().map((session) => ({
103
+ ...buildSessionSummary(session.id),
104
+ }));
105
+ return {
106
+ contents: [
107
+ {
108
+ uri: 'reasoning://sessions',
109
+ mimeType: 'application/json',
110
+ text: serializeJson({
111
+ ttlMs,
112
+ totalSessions: sessions.length,
113
+ sessions,
114
+ }),
115
+ },
116
+ ],
117
+ };
118
+ });
119
+ // Template for full trace
120
+ server.registerResource('reasoning.trace', new ResourceTemplate('file:///cortex/sessions/{sessionId}/trace.md', {
121
+ list: undefined,
122
+ }), {
123
+ title: 'Reasoning Trace',
124
+ description: 'Markdown trace of a reasoning session (full content).',
125
+ mimeType: 'text/markdown',
126
+ ...(iconMeta
127
+ ? {
128
+ icons: [iconMeta],
129
+ }
130
+ : {}),
131
+ }, (uri, variables) => {
132
+ const sessionId = extractStringVariable(variables, 'sessionId', uri);
133
+ const session = resolveSession(sessionId, uri);
134
+ return {
135
+ contents: [
136
+ {
137
+ uri: uri.toString(),
138
+ mimeType: 'text/markdown',
139
+ text: formatThoughtsToMarkdown(session),
140
+ },
141
+ ],
142
+ };
143
+ });
144
+ // Template for individual thoughts
145
+ server.registerResource('reasoning.thought', new ResourceTemplate('file:///cortex/sessions/{sessionId}/{thoughtName}.md', {
146
+ list: undefined,
147
+ }), {
148
+ title: 'Reasoning Thought',
149
+ description: 'Markdown content of a single thought (e.g. Thought-1.md).',
150
+ mimeType: 'text/markdown',
151
+ ...(iconMeta
152
+ ? {
153
+ icons: [iconMeta],
154
+ }
155
+ : {}),
156
+ }, (uri, variables) => {
157
+ const sessionId = extractStringVariable(variables, 'sessionId', uri);
158
+ const session = resolveSession(sessionId, uri);
159
+ const thoughtName = extractStringVariable(variables, 'thoughtName', uri);
160
+ const { index, requestedRevised } = parseThoughtName(thoughtName, session);
161
+ const thought = session.thoughts[index - 1];
162
+ if (thought && requestedRevised && thought.revision === 0) {
163
+ throw new McpError(-32002, `Thought ${String(index)} has not been revised.`);
164
+ }
165
+ return {
166
+ contents: [
167
+ {
168
+ uri: uri.toString(),
169
+ mimeType: 'text/markdown',
170
+ text: formatThoughtsToMarkdown(session, {
171
+ start: index,
172
+ end: index,
173
+ }),
174
+ },
175
+ ],
176
+ };
177
+ });
178
+ const sessionTemplate = new ResourceTemplate('reasoning://sessions/{sessionId}', {
179
+ list: () => ({
180
+ resources: sessionStore.list().map((session) => ({
181
+ uri: `reasoning://sessions/${session.id}`,
182
+ name: `session-${session.id.slice(0, 8)}`,
183
+ title: `Reasoning Session ${session.id.slice(0, 8)}`,
184
+ description: `${session.level} session with ${String(session.thoughts.length)} thought(s).`,
185
+ mimeType: 'application/json',
186
+ annotations: {
187
+ audience: ['assistant', 'user'],
188
+ priority: 0.8,
189
+ lastModified: new Date(session.updatedAt).toISOString(),
190
+ },
191
+ })),
192
+ }),
193
+ complete: {
194
+ sessionId: (value) => {
195
+ const cacheKey = `sessionId:${value}`;
196
+ const cached = completionCache.get(cacheKey);
197
+ const now = Date.now();
198
+ // Cache for 1 second to prevent enumeration attacks
199
+ if (cached && now - cached.timestamp < 1000) {
200
+ return cached.results;
201
+ }
202
+ const results = sessionStore
203
+ .list()
204
+ .map((session) => session.id)
205
+ .filter((sessionId) => sessionId.startsWith(value))
206
+ .slice(0, 20);
207
+ completionCache.set(cacheKey, { results, timestamp: now });
208
+ return results;
209
+ },
210
+ },
211
+ });
212
+ server.registerResource('reasoning.session', sessionTemplate, {
213
+ title: 'Reasoning Session Detail',
214
+ description: 'Detailed view of a single reasoning session, including all thoughts and metadata.',
215
+ mimeType: 'application/json',
216
+ ...(iconMeta
217
+ ? {
218
+ icons: [
219
+ {
220
+ src: iconMeta.src,
221
+ mimeType: iconMeta.mimeType,
222
+ },
223
+ ],
224
+ }
225
+ : {}),
226
+ }, (uri, variables) => {
227
+ const sessionId = extractStringVariable(variables, 'sessionId', uri);
228
+ const session = resolveSession(sessionId, uri);
229
+ const summary = buildSessionSummary(sessionId);
230
+ return {
231
+ contents: [
232
+ {
233
+ uri: uri.toString(),
234
+ mimeType: 'application/json',
235
+ text: serializeJson({
236
+ ...summary,
237
+ thoughts: session.thoughts.map((thought) => ({
238
+ index: thought.index,
239
+ content: thought.content,
240
+ revision: thought.revision,
241
+ })),
242
+ }),
243
+ },
244
+ ],
245
+ };
246
+ });
247
+ }
248
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAG3E,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,kBAAkB;AAElB,SAAS,qBAAqB,CAC5B,SAAoB,EACpB,IAAY,EACZ,GAAQ;IAER,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC5B,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,QAAQ,CAAC,CAAC,KAAK,EAAE,WAAW,IAAI,YAAY,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,KAAK,CAAC;A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C5B;iBACF;aACF;YACH,CAAC,CAAC,EAAE,CAAC;KACR,EACD,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE;QACjB,MAAM,SAAS,GAAG,qBAAqB,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC;QACrE,MAAM,OAAO,GAAG,cAAc,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAC/C,MAAM,OAAO,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;QAE/C,OAAO;YACL,QAAQ,EAAE;gBACR;oBACE,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE;oBACnB,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,aAAa,CAAC;wBAClB,GAAG,OAAO;wBACV,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;4BAC3C,KAAK,EAAE,OAAO,CAAC,KAAK;4BACpB,OAAO,EAAE,OAAO,CAAC,OAAO;4BACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;yBAC3B,CAAC,CAAC;qBACJ,CAAC;iBACH;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ export declare const ReasoningThinkInputSchema: z.ZodObject<{
3
+ query: z.ZodString;
4
+ level: z.ZodEnum<{
5
+ basic: "basic";
6
+ normal: "normal";
7
+ high: "high";
8
+ }>;
9
+ targetThoughts: z.ZodOptional<z.ZodNumber>;
10
+ sessionId: z.ZodOptional<z.ZodString>;
11
+ }, z.core.$strict>;
12
+ export type ReasoningThinkInput = z.infer<typeof ReasoningThinkInputSchema>;
13
+ //# sourceMappingURL=inputs.d.ts.map