@jotx-labs/mcp 2.4.246 → 2.4.248
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/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/tools/context-tools.d.ts +33 -1
- package/dist/tools/context-tools.d.ts.map +1 -1
- package/dist/tools/context-tools.js +74 -54
- package/dist/tools/context-tools.js.map +1 -1
- package/dist/tools/file-tools.d.ts +20 -1
- package/dist/tools/file-tools.d.ts.map +1 -1
- package/dist/tools/file-tools.js +127 -109
- package/dist/tools/file-tools.js.map +1 -1
- package/dist/tools/graph-tools.d.ts +32 -1
- package/dist/tools/graph-tools.d.ts.map +1 -1
- package/dist/tools/graph-tools.js +207 -188
- package/dist/tools/graph-tools.js.map +1 -1
- package/dist/tools/search-tools.d.ts +13 -1
- package/dist/tools/search-tools.d.ts.map +1 -1
- package/dist/tools/search-tools.js +59 -43
- package/dist/tools/search-tools.js.map +1 -1
- package/dist/tools/validation-tools.d.ts +20 -1
- package/dist/tools/validation-tools.d.ts.map +1 -1
- package/dist/tools/validation-tools.js +141 -121
- package/dist/tools/validation-tools.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -20,4 +20,9 @@
|
|
|
20
20
|
export { createJotxMCPServer } from './server';
|
|
21
21
|
export type { JotxMCPConfig, FileOps, SearchResult, ValidationError, ValidationResult, EditorError, } from './types';
|
|
22
22
|
export { loadSyntaxGuide, getSyntaxGuideByTopic } from './syntax-guide';
|
|
23
|
+
export { getFileTools } from './tools/file-tools';
|
|
24
|
+
export { getSearchTools } from './tools/search-tools';
|
|
25
|
+
export { getContextTools } from './tools/context-tools';
|
|
26
|
+
export { getGraphTools } from './tools/graph-tools';
|
|
27
|
+
export { getValidationTools } from './tools/validation-tools';
|
|
23
28
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAG9C,YAAY,EACR,aAAa,EACb,OAAO,EACP,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,WAAW,GACd,MAAM,SAAS,CAAA;AAGhB,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAG9C,YAAY,EACR,aAAa,EACb,OAAO,EACP,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,WAAW,GACd,MAAM,SAAS,CAAA;AAGhB,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAGvE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.getSyntaxGuideByTopic = exports.loadSyntaxGuide = exports.createJotxMCPServer = void 0;
|
|
22
|
+
exports.getValidationTools = exports.getGraphTools = exports.getContextTools = exports.getSearchTools = exports.getFileTools = exports.getSyntaxGuideByTopic = exports.loadSyntaxGuide = exports.createJotxMCPServer = void 0;
|
|
23
23
|
// ─── Main API ────────────────────────────────────────────────────────
|
|
24
24
|
var server_1 = require("./server");
|
|
25
25
|
Object.defineProperty(exports, "createJotxMCPServer", { enumerable: true, get: function () { return server_1.createJotxMCPServer; } });
|
|
@@ -27,4 +27,15 @@ Object.defineProperty(exports, "createJotxMCPServer", { enumerable: true, get: f
|
|
|
27
27
|
var syntax_guide_1 = require("./syntax-guide");
|
|
28
28
|
Object.defineProperty(exports, "loadSyntaxGuide", { enumerable: true, get: function () { return syntax_guide_1.loadSyntaxGuide; } });
|
|
29
29
|
Object.defineProperty(exports, "getSyntaxGuideByTopic", { enumerable: true, get: function () { return syntax_guide_1.getSyntaxGuideByTopic; } });
|
|
30
|
+
// ─── Direct Tool Access (for in-process usage) ───────────────────────
|
|
31
|
+
var file_tools_1 = require("./tools/file-tools");
|
|
32
|
+
Object.defineProperty(exports, "getFileTools", { enumerable: true, get: function () { return file_tools_1.getFileTools; } });
|
|
33
|
+
var search_tools_1 = require("./tools/search-tools");
|
|
34
|
+
Object.defineProperty(exports, "getSearchTools", { enumerable: true, get: function () { return search_tools_1.getSearchTools; } });
|
|
35
|
+
var context_tools_1 = require("./tools/context-tools");
|
|
36
|
+
Object.defineProperty(exports, "getContextTools", { enumerable: true, get: function () { return context_tools_1.getContextTools; } });
|
|
37
|
+
var graph_tools_1 = require("./tools/graph-tools");
|
|
38
|
+
Object.defineProperty(exports, "getGraphTools", { enumerable: true, get: function () { return graph_tools_1.getGraphTools; } });
|
|
39
|
+
var validation_tools_1 = require("./tools/validation-tools");
|
|
40
|
+
Object.defineProperty(exports, "getValidationTools", { enumerable: true, get: function () { return validation_tools_1.getValidationTools; } });
|
|
30
41
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAEH,wEAAwE;AACxE,mCAA8C;AAArC,6GAAA,mBAAmB,OAAA;AAY5B,wEAAwE;AACxE,+CAAuE;AAA9D,+GAAA,eAAe,OAAA;AAAE,qHAAA,qBAAqB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAEH,wEAAwE;AACxE,mCAA8C;AAArC,6GAAA,mBAAmB,OAAA;AAY5B,wEAAwE;AACxE,+CAAuE;AAA9D,+GAAA,eAAe,OAAA;AAAE,qHAAA,qBAAqB,OAAA;AAE/C,wEAAwE;AACxE,iDAAiD;AAAxC,0GAAA,YAAY,OAAA;AACrB,qDAAqD;AAA5C,8GAAA,cAAc,OAAA;AACvB,uDAAuD;AAA9C,gHAAA,eAAe,OAAA;AACxB,mDAAmD;AAA1C,4GAAA,aAAa,OAAA;AACtB,6DAA6D;AAApD,sHAAA,kBAAkB,OAAA"}
|
|
@@ -3,8 +3,40 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Tools: jotx_get_current_doc, jotx_report_errors
|
|
5
5
|
*/
|
|
6
|
+
import { z } from 'zod';
|
|
6
7
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
|
-
import { JotxMCPConfig } from '../types';
|
|
8
|
+
import { JotxMCPConfig, McpToolResult } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* Get context tools definitions.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getContextTools(config: JotxMCPConfig): ({
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
schema: {};
|
|
16
|
+
handler: () => Promise<McpToolResult>;
|
|
17
|
+
} | {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
schema: {
|
|
21
|
+
errors: z.ZodArray<z.ZodObject<{
|
|
22
|
+
message: z.ZodString;
|
|
23
|
+
filePath: z.ZodOptional<z.ZodString>;
|
|
24
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
blockId: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
message: string;
|
|
28
|
+
filePath?: string | undefined;
|
|
29
|
+
line?: number | undefined;
|
|
30
|
+
blockId?: string | undefined;
|
|
31
|
+
}, {
|
|
32
|
+
message: string;
|
|
33
|
+
filePath?: string | undefined;
|
|
34
|
+
line?: number | undefined;
|
|
35
|
+
blockId?: string | undefined;
|
|
36
|
+
}>, "many">;
|
|
37
|
+
};
|
|
38
|
+
handler: (args: any) => Promise<McpToolResult>;
|
|
39
|
+
})[];
|
|
8
40
|
/**
|
|
9
41
|
* Register context tools on the MCP server.
|
|
10
42
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-tools.d.ts","sourceRoot":"","sources":["../../src/tools/context-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"context-tools.d.ts","sourceRoot":"","sources":["../../src/tools/context-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,aAAa,EAAe,aAAa,EAAE,MAAM,UAAU,CAAA;AAYpE;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa;;;;mBAMtB,OAAO,CAAC,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;oBAkCnB,GAAG,KAAG,OAAO,CAAC,aAAa,CAAC;KA+B7D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAYnF"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Tools: jotx_get_current_doc, jotx_report_errors
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.getContextTools = getContextTools;
|
|
8
9
|
exports.registerContextTools = registerContextTools;
|
|
9
10
|
const zod_1 = require("zod");
|
|
10
11
|
// Define schemas explicitly to avoid TS2589
|
|
@@ -17,66 +18,85 @@ const ReportErrorsSchema = {
|
|
|
17
18
|
})).describe('Array of validation errors from the editor'),
|
|
18
19
|
};
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
+
* Get context tools definitions.
|
|
21
22
|
*/
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
function getContextTools(config) {
|
|
24
|
+
return [
|
|
25
|
+
{
|
|
26
|
+
name: 'jotx_get_current_doc',
|
|
27
|
+
description: 'Get the full content of the document currently open in the editor. Use this instead of jotx_read_file when the user asks about their current/active document.',
|
|
28
|
+
schema: {},
|
|
29
|
+
handler: async () => {
|
|
30
|
+
try {
|
|
31
|
+
const context = config.getCurrentContext?.();
|
|
32
|
+
if (!context || !context.content) {
|
|
33
|
+
return {
|
|
34
|
+
content: [{
|
|
35
|
+
type: 'text',
|
|
36
|
+
text: 'No document is currently open in the editor.',
|
|
37
|
+
}],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const info = context.filePath
|
|
41
|
+
? `Currently open: ${context.filePath}\n\n`
|
|
42
|
+
: '';
|
|
43
|
+
return {
|
|
44
|
+
content: [{
|
|
45
|
+
type: 'text',
|
|
46
|
+
text: `${info}${context.content}`,
|
|
47
|
+
}],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
return {
|
|
52
|
+
content: [{ type: 'text', text: `Error getting current document: ${err.message}` }],
|
|
53
|
+
isError: true,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'jotx_report_errors',
|
|
60
|
+
description: 'Receive validation errors from the editor. Use these errors to understand what is wrong with the current document and suggest fixes. The errors come from the Jotx parser/validator.',
|
|
61
|
+
schema: ReportErrorsSchema,
|
|
62
|
+
handler: async (args) => {
|
|
63
|
+
const editorErrors = args.errors; // Explicit cast for complex object array
|
|
64
|
+
if (editorErrors.length === 0) {
|
|
65
|
+
return {
|
|
66
|
+
content: [{
|
|
67
|
+
type: 'text',
|
|
68
|
+
text: '✅ No errors reported. The document appears to be valid.',
|
|
69
|
+
}],
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const formatted = editorErrors.map((err, i) => {
|
|
73
|
+
const location = [
|
|
74
|
+
err.filePath ? `File: ${err.filePath}` : null,
|
|
75
|
+
err.line ? `Line: ${err.line}` : null,
|
|
76
|
+
err.blockId ? `Block: ${err.blockId}` : null,
|
|
77
|
+
].filter(Boolean).join(', ');
|
|
78
|
+
return `${i + 1}. ${err.message}${location ? ` (${location})` : ''}`;
|
|
79
|
+
});
|
|
28
80
|
return {
|
|
29
81
|
content: [{
|
|
30
82
|
type: 'text',
|
|
31
|
-
text:
|
|
83
|
+
text: `⚠️ ${editorErrors.length} error(s) reported from the editor:\n\n${formatted.join('\n')}\n\nTo fix these, I can read the affected file(s) with jotx_read_file, make corrections, validate with jotx_validate, and write back with jotx_write_file.`,
|
|
32
84
|
}],
|
|
33
85
|
};
|
|
34
|
-
}
|
|
35
|
-
const info = context.filePath
|
|
36
|
-
? `Currently open: ${context.filePath}\n\n`
|
|
37
|
-
: '';
|
|
38
|
-
return {
|
|
39
|
-
content: [{
|
|
40
|
-
type: 'text',
|
|
41
|
-
text: `${info}${context.content}`,
|
|
42
|
-
}],
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
catch (err) {
|
|
46
|
-
return {
|
|
47
|
-
content: [{ type: 'text', text: `Error getting current document: ${err.message}` }],
|
|
48
|
-
isError: true,
|
|
49
|
-
};
|
|
86
|
+
},
|
|
50
87
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
const formatted = editorErrors.map((err, i) => {
|
|
67
|
-
const location = [
|
|
68
|
-
err.filePath ? `File: ${err.filePath}` : null,
|
|
69
|
-
err.line ? `Line: ${err.line}` : null,
|
|
70
|
-
err.blockId ? `Block: ${err.blockId}` : null,
|
|
71
|
-
].filter(Boolean).join(', ');
|
|
72
|
-
return `${i + 1}. ${err.message}${location ? ` (${location})` : ''}`;
|
|
73
|
-
});
|
|
74
|
-
return {
|
|
75
|
-
content: [{
|
|
76
|
-
type: 'text',
|
|
77
|
-
text: `⚠️ ${editorErrors.length} error(s) reported from the editor:\n\n${formatted.join('\n')}\n\nTo fix these, I can read the affected file(s) with jotx_read_file, make corrections, validate with jotx_validate, and write back with jotx_write_file.`,
|
|
78
|
-
}],
|
|
79
|
-
};
|
|
80
|
-
});
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Register context tools on the MCP server.
|
|
92
|
+
*/
|
|
93
|
+
function registerContextTools(server, config) {
|
|
94
|
+
const tools = getContextTools(config);
|
|
95
|
+
for (const tool of tools) {
|
|
96
|
+
server.registerTool(tool.name, {
|
|
97
|
+
description: tool.description,
|
|
98
|
+
inputSchema: tool.schema,
|
|
99
|
+
}, tool.handler);
|
|
100
|
+
}
|
|
81
101
|
}
|
|
82
102
|
//# sourceMappingURL=context-tools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-tools.js","sourceRoot":"","sources":["../../src/tools/context-tools.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAmBH,
|
|
1
|
+
{"version":3,"file":"context-tools.js","sourceRoot":"","sources":["../../src/tools/context-tools.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAmBH,0CAuEC;AAKD,oDAYC;AAzGD,6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,KAAK,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;gBACxE,CAAC,CAAC,CAAA;gBAEF,OAAO;oBACH,OAAO,EAAE,CAAC;4BACN,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,MAAM,YAAY,CAAC,MAAM,0CAA0C,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,4JAA4J;yBAC5P,CAAC;iBACL,CAAA;YACL,CAAC;SACJ;KACJ,CAAA;AACL,CAAC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAAC,MAAiB,EAAE,MAAqB;IACzE,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;IACrC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,CAAC,YAAY,CACf,IAAI,CAAC,IAAI,EACT;YACI,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,IAAI,CAAC,MAAa;SAClC,EACD,IAAI,CAAC,OAAO,CACf,CAAA;IACL,CAAC;AACL,CAAC"}
|
|
@@ -3,8 +3,27 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Tools: jotx_list_files, jotx_read_file, jotx_write_file
|
|
5
5
|
*/
|
|
6
|
+
import { z } from 'zod';
|
|
6
7
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
|
-
import { JotxMCPConfig } from '../types';
|
|
8
|
+
import { JotxMCPConfig, McpToolResult } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* Get file operation tools definitions.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getFileTools(config: JotxMCPConfig): ({
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
schema: {
|
|
16
|
+
directory: z.ZodOptional<z.ZodString>;
|
|
17
|
+
};
|
|
18
|
+
handler: (args: any) => Promise<McpToolResult>;
|
|
19
|
+
} | {
|
|
20
|
+
name: string;
|
|
21
|
+
description: string;
|
|
22
|
+
schema: {
|
|
23
|
+
filePath: z.ZodString;
|
|
24
|
+
};
|
|
25
|
+
handler: (args: any) => Promise<McpToolResult>;
|
|
26
|
+
})[];
|
|
8
27
|
/**
|
|
9
28
|
* Register file operation tools on the MCP server.
|
|
10
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-tools.d.ts","sourceRoot":"","sources":["../../src/tools/file-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"file-tools.d.ts","sourceRoot":"","sources":["../../src/tools/file-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAgBvD;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa;;;;;;oBAQhB,GAAG,KAAG,OAAO,CAAC,aAAa,CAAC;;;;;;;oBA2C5B,GAAG,KAAG,OAAO,CAAC,aAAa,CAAC;KA2E7D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAYhF"}
|
package/dist/tools/file-tools.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Tools: jotx_list_files, jotx_read_file, jotx_write_file
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.getFileTools = getFileTools;
|
|
8
9
|
exports.registerFileTools = registerFileTools;
|
|
9
10
|
const zod_1 = require("zod");
|
|
10
11
|
// Define schemas explicitly to avoid TS2589
|
|
@@ -19,125 +20,142 @@ const WriteFileSchema = {
|
|
|
19
20
|
content: zod_1.z.string().describe('The full .jot file content to write. Must be valid Jotx format.'),
|
|
20
21
|
};
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
+
* Get file operation tools definitions.
|
|
23
24
|
*/
|
|
24
|
-
function
|
|
25
|
+
function getFileTools(config) {
|
|
25
26
|
const { fileOps, workspacePath } = config;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// Get file sizes if available
|
|
40
|
-
const fileEntries = [];
|
|
41
|
-
for (const file of files) {
|
|
42
|
-
if (fileOps.getFileSize) {
|
|
43
|
-
try {
|
|
44
|
-
const size = await fileOps.getFileSize(file);
|
|
45
|
-
fileEntries.push(` - ${file} (${formatBytes(size)})`);
|
|
27
|
+
return [
|
|
28
|
+
{
|
|
29
|
+
name: 'jotx_list_files',
|
|
30
|
+
description: 'List all .jot files in the workspace directory recursively. Returns object with `files` array containing paths and sizes.',
|
|
31
|
+
schema: ListFilesSchema,
|
|
32
|
+
handler: async (args) => {
|
|
33
|
+
const { directory } = args;
|
|
34
|
+
try {
|
|
35
|
+
const files = await fileOps.listFiles(directory);
|
|
36
|
+
if (files.length === 0) {
|
|
37
|
+
return {
|
|
38
|
+
content: [{ type: 'text', text: 'No .jot files found in the workspace.' }],
|
|
39
|
+
};
|
|
46
40
|
}
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
// Get file sizes if available
|
|
42
|
+
const fileEntries = [];
|
|
43
|
+
for (const file of files) {
|
|
44
|
+
if (fileOps.getFileSize) {
|
|
45
|
+
try {
|
|
46
|
+
const size = await fileOps.getFileSize(file);
|
|
47
|
+
fileEntries.push(` - ${file} (${formatBytes(size)})`);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
fileEntries.push(` - ${file}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
fileEntries.push(` - ${file}`);
|
|
55
|
+
}
|
|
49
56
|
}
|
|
57
|
+
return {
|
|
58
|
+
content: [{
|
|
59
|
+
type: 'text',
|
|
60
|
+
text: `Found ${files.length} .jot file(s) in ${workspacePath}:\n${fileEntries.join('\n')}`,
|
|
61
|
+
}],
|
|
62
|
+
};
|
|
50
63
|
}
|
|
51
|
-
|
|
52
|
-
|
|
64
|
+
catch (err) {
|
|
65
|
+
return {
|
|
66
|
+
content: [{ type: 'text', text: `Error listing files: ${err.message}` }],
|
|
67
|
+
isError: true,
|
|
68
|
+
};
|
|
53
69
|
}
|
|
54
70
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return {
|
|
93
|
-
content: [{
|
|
94
|
-
type: 'text',
|
|
95
|
-
text: `File: ${filePath} (${formatBytes(byteCount)})\n\n${content}`,
|
|
96
|
-
}],
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
catch (err) {
|
|
100
|
-
return {
|
|
101
|
-
content: [{ type: 'text', text: `Error reading file: ${err.message}` }],
|
|
102
|
-
isError: true,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
// ─── jotx_write_file ─────────────────────────────────────────────
|
|
107
|
-
server.registerTool('jotx_write_file', {
|
|
108
|
-
description: 'Create a new .jot file or overwrite an existing one. The content MUST be valid Jotx .jot format (use jotx_validate first to check). File path must end in .jot.',
|
|
109
|
-
inputSchema: WriteFileSchema,
|
|
110
|
-
}, async (args) => {
|
|
111
|
-
const { filePath, content } = args;
|
|
112
|
-
try {
|
|
113
|
-
// Security: validate path
|
|
114
|
-
if (filePath.includes('..') || filePath.startsWith('/')) {
|
|
115
|
-
return {
|
|
116
|
-
content: [{ type: 'text', text: 'Error: Cannot write files outside the workspace.' }],
|
|
117
|
-
isError: true,
|
|
118
|
-
};
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'jotx_read_file',
|
|
74
|
+
description: 'Read the full contents of a .jot file in the workspace. Use this to understand existing documents before modifying them.',
|
|
75
|
+
schema: ReadFileSchema,
|
|
76
|
+
handler: async (args) => {
|
|
77
|
+
const { filePath } = args;
|
|
78
|
+
try {
|
|
79
|
+
// Security: validate path doesn't escape workspace
|
|
80
|
+
if (filePath.includes('..') || filePath.startsWith('/')) {
|
|
81
|
+
return {
|
|
82
|
+
content: [{ type: 'text', text: 'Error: Cannot read files outside the workspace.' }],
|
|
83
|
+
isError: true,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const exists = await fileOps.fileExists(filePath);
|
|
87
|
+
if (!exists) {
|
|
88
|
+
return {
|
|
89
|
+
content: [{ type: 'text', text: `Error: File not found: ${filePath}` }],
|
|
90
|
+
isError: true,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
const content = await fileOps.readFile(filePath);
|
|
94
|
+
const byteCount = Buffer.byteLength(content, 'utf-8');
|
|
95
|
+
return {
|
|
96
|
+
content: [{
|
|
97
|
+
type: 'text',
|
|
98
|
+
text: `File: ${filePath} (${formatBytes(byteCount)})\n\n${content}`,
|
|
99
|
+
}],
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
return {
|
|
104
|
+
content: [{ type: 'text', text: `Error reading file: ${err.message}` }],
|
|
105
|
+
isError: true,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
119
108
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'jotx_write_file',
|
|
112
|
+
description: 'Create a new .jot file or overwrite an existing one. The content MUST be valid Jotx .jot format (use jotx_validate first to check). File path must end in .jot.',
|
|
113
|
+
schema: WriteFileSchema,
|
|
114
|
+
handler: async (args) => {
|
|
115
|
+
const { filePath, content } = args;
|
|
116
|
+
try {
|
|
117
|
+
// Security: validate path
|
|
118
|
+
if (filePath.includes('..') || filePath.startsWith('/')) {
|
|
119
|
+
return {
|
|
120
|
+
content: [{ type: 'text', text: 'Error: Cannot write files outside the workspace.' }],
|
|
121
|
+
isError: true,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
if (!filePath.endsWith('.jot')) {
|
|
125
|
+
return {
|
|
126
|
+
content: [{ type: 'text', text: 'Error: File path must end in .jot' }],
|
|
127
|
+
isError: true,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
await fileOps.writeFile(filePath, content);
|
|
131
|
+
return {
|
|
132
|
+
content: [{
|
|
133
|
+
type: 'text',
|
|
134
|
+
text: `✅ File written successfully: ${filePath}`,
|
|
135
|
+
}],
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
catch (err) {
|
|
139
|
+
return {
|
|
140
|
+
content: [{ type: 'text', text: `Error writing file: ${err.message}` }],
|
|
141
|
+
isError: true,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
125
144
|
}
|
|
126
|
-
await fileOps.writeFile(filePath, content);
|
|
127
|
-
return {
|
|
128
|
-
content: [{
|
|
129
|
-
type: 'text',
|
|
130
|
-
text: `✅ File written successfully: ${filePath}`,
|
|
131
|
-
}],
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
catch (err) {
|
|
135
|
-
return {
|
|
136
|
-
content: [{ type: 'text', text: `Error writing file: ${err.message}` }],
|
|
137
|
-
isError: true,
|
|
138
|
-
};
|
|
139
145
|
}
|
|
140
|
-
|
|
146
|
+
];
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Register file operation tools on the MCP server.
|
|
150
|
+
*/
|
|
151
|
+
function registerFileTools(server, config) {
|
|
152
|
+
const tools = getFileTools(config);
|
|
153
|
+
for (const tool of tools) {
|
|
154
|
+
server.registerTool(tool.name, {
|
|
155
|
+
description: tool.description,
|
|
156
|
+
inputSchema: tool.schema,
|
|
157
|
+
}, tool.handler);
|
|
158
|
+
}
|
|
141
159
|
}
|
|
142
160
|
// ─── Helpers ─────────────────────────────────────────────────────────
|
|
143
161
|
function formatBytes(bytes) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-tools.js","sourceRoot":"","sources":["../../src/tools/file-tools.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAuBH,
|
|
1
|
+
{"version":3,"file":"file-tools.js","sourceRoot":"","sources":["../../src/tools/file-tools.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAuBH,oCA8HC;AAKD,8CAYC;AApKD,6BAAuB;AAIvB,4CAA4C;AAC5C,MAAM,eAAe,GAAG;IACpB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sEAAsE,CAAC;CACpH,CAAA;AAED,MAAM,cAAc,GAAG;IACnB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC;CACrF,CAAA;AAED,MAAM,eAAe,GAAG;IACpB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iEAAiE,CAAC;IAChG,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iEAAiE,CAAC;CAClG,CAAA;AAED;;GAEG;AACH,SAAgB,YAAY,CAAC,MAAqB;IAC9C,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,MAAM,CAAA;IAEzC,OAAO;QACH;YACI,IAAI,EA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,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,uBAAwB,GAAa,CAAC,OAAO,EAAE,EAAE,CAAC;wBAC3F,OAAO,EAAE,IAAI;qBAChB,CAAA;gBACL,CAAC;YACL,CAAC;SACJ;KACJ,CAAA;AACL,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAC,MAAiB,EAAE,MAAqB;IACtE,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,CAAA;IAClC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,CAAC,YAAY,CACf,IAAI,CAAC,IAAI,EACT;YACI,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,IAAI,CAAC,MAAa;SAClC,EACD,IAAI,CAAC,OAAO,CACf,CAAA;IACL,CAAC;AACL,CAAC;AAED,wEAAwE;AAExE,SAAS,WAAW,CAAC,KAAa;IAC9B,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,GAAG,KAAK,IAAI,CAAA;IACrC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAA;IACjE,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAA;AACrD,CAAC"}
|
|
@@ -3,8 +3,39 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Tools: jotx_get_graph, jotx_get_document_info, jotx_get_workspace_stats, jotx_get_backlinks
|
|
5
5
|
*/
|
|
6
|
+
import { z } from 'zod';
|
|
6
7
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
|
-
import { JotxMCPConfig } from '../types';
|
|
8
|
+
import { JotxMCPConfig, McpToolResult } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* Get graph tools definitions.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getGraphTools(config: JotxMCPConfig): ({
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
schema: {
|
|
16
|
+
directory: z.ZodOptional<z.ZodString>;
|
|
17
|
+
};
|
|
18
|
+
handler: (args: any) => Promise<McpToolResult>;
|
|
19
|
+
} | {
|
|
20
|
+
name: string;
|
|
21
|
+
description: string;
|
|
22
|
+
schema: {
|
|
23
|
+
filePath: z.ZodString;
|
|
24
|
+
};
|
|
25
|
+
handler: (args: any) => Promise<McpToolResult>;
|
|
26
|
+
} | {
|
|
27
|
+
name: string;
|
|
28
|
+
description: string;
|
|
29
|
+
schema: {};
|
|
30
|
+
handler: () => Promise<McpToolResult>;
|
|
31
|
+
} | {
|
|
32
|
+
name: string;
|
|
33
|
+
description: string;
|
|
34
|
+
schema: {
|
|
35
|
+
nodeId: z.ZodString;
|
|
36
|
+
};
|
|
37
|
+
handler: (args: any) => Promise<McpToolResult>;
|
|
38
|
+
})[];
|
|
8
39
|
/**
|
|
9
40
|
* Register graph tools on the MCP server.
|
|
10
41
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-tools.d.ts","sourceRoot":"","sources":["../../src/tools/graph-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"graph-tools.d.ts","sourceRoot":"","sources":["../../src/tools/graph-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAEnE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAkBvD;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa;;;;;;oBAQjB,GAAG,KAAG,OAAO,CAAC,aAAa,CAAC;;;;;;;oBAoD5B,GAAG,KAAG,OAAO,CAAC,aAAa,CAAC;;;;;mBAiE/B,OAAO,CAAC,aAAa,CAAC;;;;;;;oBAkDnB,GAAG,KAAG,OAAO,CAAC,aAAa,CAAC;KA0C7D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAYjF"}
|