@modyo/mcp 0.1.0 → 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 (94) hide show
  1. package/README.md +204 -77
  2. package/build/shared/McpServerBase.d.ts.map +1 -1
  3. package/build/shared/McpServerBase.js +3 -25
  4. package/build/shared/McpServerBase.js.map +1 -1
  5. package/build/shared/ToolBase.d.ts +0 -13
  6. package/build/shared/ToolBase.d.ts.map +1 -1
  7. package/build/shared/ToolBase.js +0 -12
  8. package/build/shared/ToolBase.js.map +1 -1
  9. package/build/shared/index.d.ts +0 -1
  10. package/build/shared/index.d.ts.map +1 -1
  11. package/build/shared/index.js +0 -2
  12. package/build/shared/index.js.map +1 -1
  13. package/build/tools/channels/navigation/ManageItem.d.ts +1 -1
  14. package/build/tools/content/types/List.d.ts +1 -1
  15. package/build/tools/core/team/Manage.d.ts +1 -1
  16. package/build/tools/core/teamMembers/Manage.d.ts +1 -1
  17. package/build/tools/customers/forms/FormsManage.d.ts +1 -1
  18. package/build/tools/customers/originations/Manage.d.ts +1 -1
  19. package/build/tools/customers/segments/SegmentsManage.d.ts +1 -1
  20. package/build/tools/customers/settings/DataSetsManage.d.ts +1 -1
  21. package/build/tools/customers/submissions/Manage.d.ts +1 -1
  22. package/package.json +1 -1
  23. package/build/resources/channels/global/PlatformsClass.d.ts +0 -25
  24. package/build/resources/channels/global/PlatformsClass.d.ts.map +0 -1
  25. package/build/resources/channels/global/PlatformsClass.js +0 -34
  26. package/build/resources/channels/global/PlatformsClass.js.map +0 -1
  27. package/build/resources/channels/global/registerGlobalResources.d.ts +0 -2
  28. package/build/resources/channels/global/registerGlobalResources.d.ts.map +0 -1
  29. package/build/resources/channels/global/registerGlobalResources.js +0 -5
  30. package/build/resources/channels/global/registerGlobalResources.js.map +0 -1
  31. package/build/resources/channels/tools/ChannelsDocsToolsResource.d.ts +0 -46
  32. package/build/resources/channels/tools/ChannelsDocsToolsResource.d.ts.map +0 -1
  33. package/build/resources/channels/tools/ChannelsDocsToolsResource.js +0 -160
  34. package/build/resources/channels/tools/ChannelsDocsToolsResource.js.map +0 -1
  35. package/build/resources/content/global/PlatformsClass.d.ts +0 -25
  36. package/build/resources/content/global/PlatformsClass.d.ts.map +0 -1
  37. package/build/resources/content/global/PlatformsClass.js +0 -34
  38. package/build/resources/content/global/PlatformsClass.js.map +0 -1
  39. package/build/resources/content/global/registerGlobalResources.d.ts +0 -2
  40. package/build/resources/content/global/registerGlobalResources.d.ts.map +0 -1
  41. package/build/resources/content/global/registerGlobalResources.js +0 -5
  42. package/build/resources/content/global/registerGlobalResources.js.map +0 -1
  43. package/build/resources/content/tools/ContentDocsToolsResource.d.ts +0 -46
  44. package/build/resources/content/tools/ContentDocsToolsResource.d.ts.map +0 -1
  45. package/build/resources/content/tools/ContentDocsToolsResource.js +0 -160
  46. package/build/resources/content/tools/ContentDocsToolsResource.js.map +0 -1
  47. package/build/resources/content/tools/registerContentToolsResources.d.ts +0 -2
  48. package/build/resources/content/tools/registerContentToolsResources.d.ts.map +0 -1
  49. package/build/resources/content/tools/registerContentToolsResources.js +0 -5
  50. package/build/resources/content/tools/registerContentToolsResources.js.map +0 -1
  51. package/build/resources/core/tools/CoreDocsToolsResource.d.ts +0 -49
  52. package/build/resources/core/tools/CoreDocsToolsResource.d.ts.map +0 -1
  53. package/build/resources/core/tools/CoreDocsToolsResource.js +0 -165
  54. package/build/resources/core/tools/CoreDocsToolsResource.js.map +0 -1
  55. package/build/resources/core/tools/registerCoreToolsResources.d.ts +0 -2
  56. package/build/resources/core/tools/registerCoreToolsResources.d.ts.map +0 -1
  57. package/build/resources/core/tools/registerCoreToolsResources.js +0 -5
  58. package/build/resources/core/tools/registerCoreToolsResources.js.map +0 -1
  59. package/build/resources/customers/global/PlatformsClass.d.ts +0 -25
  60. package/build/resources/customers/global/PlatformsClass.d.ts.map +0 -1
  61. package/build/resources/customers/global/PlatformsClass.js +0 -34
  62. package/build/resources/customers/global/PlatformsClass.js.map +0 -1
  63. package/build/resources/customers/global/registerGlobalResources.d.ts +0 -2
  64. package/build/resources/customers/global/registerGlobalResources.d.ts.map +0 -1
  65. package/build/resources/customers/global/registerGlobalResources.js +0 -5
  66. package/build/resources/customers/global/registerGlobalResources.js.map +0 -1
  67. package/build/resources/customers/tools/CustomersDocsToolsResource.d.ts +0 -46
  68. package/build/resources/customers/tools/CustomersDocsToolsResource.d.ts.map +0 -1
  69. package/build/resources/customers/tools/CustomersDocsToolsResource.js +0 -160
  70. package/build/resources/customers/tools/CustomersDocsToolsResource.js.map +0 -1
  71. package/build/resources/customers/tools/registerCustomersToolsResources.d.ts +0 -2
  72. package/build/resources/customers/tools/registerCustomersToolsResources.d.ts.map +0 -1
  73. package/build/resources/customers/tools/registerCustomersToolsResources.js +0 -5
  74. package/build/resources/customers/tools/registerCustomersToolsResources.js.map +0 -1
  75. package/build/shared/helpers/deprecation.d.ts +0 -76
  76. package/build/shared/helpers/deprecation.d.ts.map +0 -1
  77. package/build/shared/helpers/deprecation.js +0 -97
  78. package/build/shared/helpers/deprecation.js.map +0 -1
  79. package/build/shared/test-utils/index.d.ts +0 -2
  80. package/build/shared/test-utils/index.d.ts.map +0 -1
  81. package/build/shared/test-utils/index.js +0 -2
  82. package/build/shared/test-utils/index.js.map +0 -1
  83. package/build/shared/test-utils/toolTestUtils.d.ts +0 -191
  84. package/build/shared/test-utils/toolTestUtils.d.ts.map +0 -1
  85. package/build/shared/test-utils/toolTestUtils.js +0 -304
  86. package/build/shared/test-utils/toolTestUtils.js.map +0 -1
  87. package/build/tools/channels/widgets/WidgetsTools.d.ts +0 -2
  88. package/build/tools/channels/widgets/WidgetsTools.d.ts.map +0 -1
  89. package/build/tools/channels/widgets/WidgetsTools.js +0 -4
  90. package/build/tools/channels/widgets/WidgetsTools.js.map +0 -1
  91. /package/build/tools/customers/submissions/{submissionsTools.d.ts → SubmissionsTools.d.ts} +0 -0
  92. /package/build/tools/customers/submissions/{submissionsTools.d.ts.map → SubmissionsTools.d.ts.map} +0 -0
  93. /package/build/tools/customers/submissions/{submissionsTools.js → SubmissionsTools.js} +0 -0
  94. /package/build/tools/customers/submissions/{submissionsTools.js.map → SubmissionsTools.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"ContentDocsToolsResource.js","sourceRoot":"","sources":["../../../../src/resources/content/tools/ContentDocsToolsResource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,KAAK,UAAU,wBAAwB;IAIrC,MAAM,QAAQ,GAAG,eAAe,CAAC;IAEjC,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE1C,KAAK,UAAU,aAAa,CAAC,GAAW,EAAE,MAAM,GAAG,EAAE;QACnD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;gBACpC,aAAa,EAAE,IAAI;aACpB,CAAC,CAAC;YAEH,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;gBAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC5C,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;gBAErE,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;oBACxB,MAAM,aAAa,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;gBAC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IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACtB,MAAM,IAAI,KAAK,CACb,sBAAsB,MAAM,CAAC,QAAQ,gBAAgB,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAClF,CAAC;YACJ,CAAC;YACD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;YACjE,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAExD,IAAI,CAAC,IAAI,CACP,UAAU,MAAM,CAAC,QAAQ,wBAAwB,OAAO,CAAC,MAAM,SAAS,CACzE,CAAC;YAEF,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;QACzD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,QAAQ,CAAC,kBAAkB,MAAM,CAAC,QAAQ,qBAAqB,EAAE;gBACpE,KAAK;aACN,CAAC,CAAC;YACH,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,wBAAwB,EAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const registerContentToolsResources: import("./ContentDocsToolsResource.js").ContentDocsToolsResource[];
2
- //# sourceMappingURL=registerContentToolsResources.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerContentToolsResources.d.ts","sourceRoot":"","sources":["../../../../src/resources/content/tools/registerContentToolsResources.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,6BAA6B,oEAEzC,CAAC"}
@@ -1,5 +0,0 @@
1
- import { contentDocsTools } from "./ContentDocsToolsResource.js";
2
- export const registerContentToolsResources = [
3
- contentDocsTools,
4
- ];
5
- //# sourceMappingURL=registerContentToolsResources.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerContentToolsResources.js","sourceRoot":"","sources":["../../../../src/resources/content/tools/registerContentToolsResources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,gBAAgB;CACjB,CAAC"}
@@ -1,49 +0,0 @@
1
- import type { ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
2
- import { ResourceBase } from "../../../shared/index.js";
3
- import { z } from "zod";
4
- /**
5
- * Core module tool documentation resource
6
- *
7
- * Serves tool-specific documentation from docs/tools/
8
- * Auto-discovers all markdown files.
9
- *
10
- * URI format: modyo://mcp-core/tools/{toolPath}
11
- *
12
- * Examples:
13
- * - modyo://mcp-core/tools/core-users-manage
14
- * - modyo://mcp-core/tools/core-groups-manage
15
- * - modyo://mcp-core/tools/settings-manage
16
- */
17
- export declare class CoreDocsToolsResource extends ResourceBase<{
18
- toolPath: string;
19
- }> {
20
- protected config: {
21
- name: string;
22
- uriTemplate: string;
23
- description: string;
24
- mimeType: string;
25
- annotations: {
26
- readOnlyHint: boolean;
27
- idempotentHint: boolean;
28
- destructiveHint: boolean;
29
- };
30
- isPublic: boolean;
31
- catchErrors: boolean;
32
- };
33
- protected getParamsSchema(): z.ZodObject<{
34
- toolPath: z.ZodEnum<{
35
- [x: string]: string;
36
- }>;
37
- }, z.core.$strip> | z.ZodObject<{
38
- toolPath: z.ZodString;
39
- }, z.core.$strip>;
40
- /**
41
- * Override registerResource to add completion support and auto-discover docs
42
- */
43
- registerResource(server: any, logger: any): Promise<void>;
44
- read(uri: URL, params: {
45
- toolPath: string;
46
- }): Promise<ReadResourceResult>;
47
- }
48
- export declare const coreDocsTools: CoreDocsToolsResource;
49
- //# sourceMappingURL=CoreDocsToolsResource.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CoreDocsToolsResource.d.ts","sourceRoot":"","sources":["../../../../src/resources/core/tools/CoreDocsToolsResource.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAmB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqDxB;;;;;;;;;;;;GAYG;AACH,qBAAa,qBAAsB,SAAQ,YAAY,CAAC;IACtD,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;IACA,SAAS,CAAC,MAAM;;;;;;;;;;;;MAad;IAEF,SAAS,CAAC,eAAe;;;;;;;IAuBzB;;OAEG;IACmB,gBAAgB,CACpC,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,GAAG,GACV,OAAO,CAAC,IAAI,CAAC;IAyEV,IAAI,CACR,GAAG,EAAE,GAAG,EACR,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;KAClB,GACA,OAAO,CAAC,kBAAkB,CAAC;CA0B/B;AAED,eAAO,MAAM,aAAa,uBAA8B,CAAC"}
@@ -1,165 +0,0 @@
1
- import fs from "node:fs/promises";
2
- import path from "node:path";
3
- import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
4
- import { DOCS_TOOLS_PATH, ResourceBase } from "../../../shared/index.js";
5
- import { z } from "zod";
6
- /**
7
- * Auto-discover core tool documentation
8
- * Scans docs/tools/**\/*.md files
9
- * Returns both flat paths and mapping to actual file paths
10
- */
11
- async function discoverCoreDocsTools() {
12
- const docsPath = DOCS_TOOLS_PATH;
13
- const flatPaths = [];
14
- const pathMap = new Map();
15
- async function scanDirectory(dir, prefix = "") {
16
- try {
17
- const entries = await fs.readdir(dir, {
18
- withFileTypes: true,
19
- });
20
- for (const entry of entries) {
21
- const fullPath = path.join(dir, entry.name);
22
- const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
23
- if (entry.isDirectory()) {
24
- await scanDirectory(fullPath, relativePath);
25
- }
26
- else if (entry.isFile() && entry.name.endsWith(".md")) {
27
- // Store actual file path (e.g., "team/security-best-practices.md")
28
- const filePath = relativePath;
29
- // Create flat path by replacing / with - (e.g., "team-security-best-practices")
30
- const flatPath = relativePath.replace(".md", "").replace(/\//g, "-");
31
- flatPaths.push(flatPath);
32
- pathMap.set(flatPath, filePath);
33
- }
34
- }
35
- }
36
- catch (error) {
37
- console.warn(`Could not scan directory ${dir}:`, error);
38
- }
39
- }
40
- await scanDirectory(docsPath);
41
- return {
42
- flatPaths: flatPaths.sort(),
43
- pathMap,
44
- };
45
- }
46
- // Cache discovered docs and path mapping
47
- let DISCOVERED_DOCS = [];
48
- let PATH_MAP = new Map();
49
- /**
50
- * Core module tool documentation resource
51
- *
52
- * Serves tool-specific documentation from docs/tools/
53
- * Auto-discovers all markdown files.
54
- *
55
- * URI format: modyo://mcp-core/tools/{toolPath}
56
- *
57
- * Examples:
58
- * - modyo://mcp-core/tools/core-users-manage
59
- * - modyo://mcp-core/tools/core-groups-manage
60
- * - modyo://mcp-core/tools/settings-manage
61
- */
62
- export class CoreDocsToolsResource extends ResourceBase {
63
- config = {
64
- name: "modyo-core-tools-docs",
65
- uriTemplate: "modyo://mcp-core/tools/{toolPath}",
66
- description: "Tool-specific documentation for Modyo Core module (user management, groups, security best practices). Auto-discovered from docs/tools/",
67
- mimeType: "text/markdown",
68
- annotations: {
69
- readOnlyHint: true,
70
- idempotentHint: true,
71
- destructiveHint: false,
72
- },
73
- isPublic: true,
74
- catchErrors: true,
75
- };
76
- getParamsSchema() {
77
- if (DISCOVERED_DOCS.length > 0) {
78
- return z.object({
79
- toolPath: z.enum(DISCOVERED_DOCS, {
80
- message: `Invalid tool path. Available docs can be discovered via autocomplete (${DISCOVERED_DOCS.length} total)`,
81
- }),
82
- });
83
- }
84
- return z.object({
85
- toolPath: z
86
- .string()
87
- .min(1)
88
- .describe("Tool documentation path (e.g., 'core-users-manage')"),
89
- });
90
- }
91
- /**
92
- * Override registerResource to add completion support and auto-discover docs
93
- */
94
- async registerResource(server, logger) {
95
- this.server = server;
96
- this.logger = logger;
97
- // Discover docs from filesystem
98
- if (DISCOVERED_DOCS.length === 0) {
99
- const { flatPaths, pathMap } = await discoverCoreDocsTools();
100
- DISCOVERED_DOCS = flatPaths;
101
- PATH_MAP = pathMap;
102
- logger(`Discovered ${DISCOVERED_DOCS.length} core documentation files`, {
103
- docs: DISCOVERED_DOCS,
104
- }, "info");
105
- }
106
- const schema = this.getParamsSchema();
107
- const rawInputSchema = this.extractRawSchema(schema);
108
- const resourceConfig = {
109
- description: this.config.description,
110
- mimeType: this.config.mimeType,
111
- inputSchema: rawInputSchema,
112
- annotations: this.config.annotations,
113
- };
114
- const readCallback = async (uri, params) => {
115
- try {
116
- const validatedParams = schema.parse(params);
117
- return await this.read(uri, validatedParams);
118
- }
119
- catch (error) {
120
- if (this.config.catchErrors) {
121
- return this.errorResponse(uri, error, {
122
- params,
123
- });
124
- }
125
- logger(`Resource ${this.config.name} failed`, {
126
- uri: uri.href,
127
- params,
128
- error,
129
- }, "error");
130
- throw error;
131
- }
132
- };
133
- // Register with ResourceTemplate including completion support
134
- server.registerResource(this.config.name, new ResourceTemplate(this.config.uriTemplate, {
135
- list: undefined,
136
- complete: {
137
- toolPath: (value) => {
138
- return DISCOVERED_DOCS.filter((doc) => doc.startsWith(value)).slice(0, 20); // Limit to 20 suggestions
139
- },
140
- },
141
- }), resourceConfig, readCallback);
142
- }
143
- async read(uri, params) {
144
- this.debug(`Reading core tool documentation: ${params.toolPath}`);
145
- try {
146
- // Look up actual file path from the mapping
147
- const relativeFilePath = PATH_MAP.get(params.toolPath);
148
- if (!relativeFilePath) {
149
- throw new Error(`Unknown tool path: ${params.toolPath}. Available: ${DISCOVERED_DOCS.join(", ")}`);
150
- }
151
- const docFilePath = path.join(DOCS_TOOLS_PATH, relativeFilePath);
152
- const content = await fs.readFile(docFilePath, "utf-8");
153
- this.info(`Served ${params.toolPath} tool documentation (${content.length} chars)`);
154
- return this.successText(uri, content, "text/markdown");
155
- }
156
- catch (error) {
157
- this.logError(`Failed to read ${params.toolPath} tool documentation`, {
158
- error,
159
- });
160
- throw error;
161
- }
162
- }
163
- }
164
- export const coreDocsTools = new CoreDocsToolsResource();
165
- //# sourceMappingURL=CoreDocsToolsResource.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CoreDocsToolsResource.js","sourceRoot":"","sources":["../../../../src/resources/core/tools/CoreDocsToolsResource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,KAAK,UAAU,qBAAqB;IAIlC,MAAM,QAAQ,GAAG,eAAe,CAAC;IAEjC,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE1C,KAAK,UAAU,aAAa,CAAC,GAAW,EAAE,MAAM,GAAG,EAAE;QACnD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;gBACpC,aAAa,EAAE,IAAI;aACpB,CAAC,CAAC;YAEH,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;gBAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC5C,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;gBAErE,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;oBACxB,MAAM,aAAa,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;gBAC9C,CAAC;qBAAM,IAAI,KAAK,CAAC,MAA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D,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACtB,MAAM,IAAI,KAAK,CACb,sBAAsB,MAAM,CAAC,QAAQ,gBAAgB,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAClF,CAAC;YACJ,CAAC;YACD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;YACjE,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAExD,IAAI,CAAC,IAAI,CACP,UAAU,MAAM,CAAC,QAAQ,wBAAwB,OAAO,CAAC,MAAM,SAAS,CACzE,CAAC;YAEF,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;QACzD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,QAAQ,CAAC,kBAAkB,MAAM,CAAC,QAAQ,qBAAqB,EAAE;gBACpE,KAAK;aACN,CAAC,CAAC;YACH,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,qBAAqB,EAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const registerCoreToolsResources: import("./CoreDocsToolsResource.js").CoreDocsToolsResource[];
2
- //# sourceMappingURL=registerCoreToolsResources.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerCoreToolsResources.d.ts","sourceRoot":"","sources":["../../../../src/resources/core/tools/registerCoreToolsResources.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B,8DAEtC,CAAC"}
@@ -1,5 +0,0 @@
1
- import { coreDocsTools } from "./CoreDocsToolsResource.js";
2
- export const registerCoreToolsResources = [
3
- coreDocsTools,
4
- ];
5
- //# sourceMappingURL=registerCoreToolsResources.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerCoreToolsResources.js","sourceRoot":"","sources":["../../../../src/resources/core/tools/registerCoreToolsResources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,aAAa;CACd,CAAC"}
@@ -1,25 +0,0 @@
1
- import type { ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
2
- import { ResourceBase } from "../../../shared/index.js";
3
- import { z } from "zod";
4
- /**
5
- * Static resource that shows the configured platform
6
- *
7
- * Returns information about the single configured platform.
8
- *
9
- * @example
10
- * URI: platforms://uri
11
- * Returns: Platform name and URL
12
- */
13
- export declare class PlatformsResource extends ResourceBase<void> {
14
- protected config: {
15
- name: string;
16
- uriTemplate: string;
17
- description: string;
18
- mimeType: string;
19
- isPublic: boolean;
20
- };
21
- protected getParamsSchema(): z.ZodVoid;
22
- read(uri: URL): Promise<ReadResourceResult>;
23
- }
24
- export declare const Platforms: Resource;
25
- //# sourceMappingURL=PlatformsClass.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformsClass.d.ts","sourceRoot":"","sources":["../../../../src/resources/customers/global/PlatformsClass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAA0B,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,qBAAa,iBAAkB,SAAQ,YAAY,CAAC,IAAI,CAAC;IACvD,SAAS,CAAC,MAAM;;;;;;MAMd;IAEF,SAAS,CAAC,eAAe;IAInB,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAmBlD;AAGD,eAAO,MAAM,SAAS,EAAE,QAAkC,CAAC"}
@@ -1,34 +0,0 @@
1
- import { ResourceBase, singlePlatformProvider } from "../../../shared/index.js";
2
- import { z } from "zod";
3
- /**
4
- * Static resource that shows the configured platform
5
- *
6
- * Returns information about the single configured platform.
7
- *
8
- * @example
9
- * URI: platforms://uri
10
- * Returns: Platform name and URL
11
- */
12
- export class PlatformsResource extends ResourceBase {
13
- config = {
14
- name: "platforms",
15
- uriTemplate: "platforms://uri",
16
- description: "Shows the configured platform",
17
- mimeType: "text/plain",
18
- isPublic: false,
19
- };
20
- getParamsSchema() {
21
- return z.void();
22
- }
23
- async read(uri) {
24
- const platform = singlePlatformProvider.getPlatform();
25
- if (!platform) {
26
- return this.successText(uri, "No platform configured. Set MODYO_URL and MODYO_TOKEN.", "text/plain");
27
- }
28
- this.debug(`Platform configured: ${platform.name}`);
29
- return this.successText(uri, `${platform.name}: ${platform.url}`, "text/plain");
30
- }
31
- }
32
- // Export instance for registration
33
- export const Platforms = new PlatformsResource();
34
- //# sourceMappingURL=PlatformsClass.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformsClass.js","sourceRoot":"","sources":["../../../../src/resources/customers/global/PlatformsClass.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAkB,SAAQ,YAAkB;IAC7C,MAAM,GAAG;QACjB,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,iBAAiB;QAC9B,WAAW,EAAE,+BAA+B;QAC5C,QAAQ,EAAE,YAAY;QACtB,QAAQ,EAAE,KAAK;KAChB,CAAC;IAEQ,eAAe;QACvB,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAQ;QACjB,MAAM,QAAQ,GAAG,sBAAsB,CAAC,WAAW,EAAE,CAAC;QAEtD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,IAAI,CAAC,WAAW,CACrB,GAAG,EACH,wDAAwD,EACxD,YAAY,CACb,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,wBAAwB,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAEpD,OAAO,IAAI,CAAC,WAAW,CACrB,GAAG,EACH,GAAG,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,GAAG,EAAE,EACnC,YAAY,CACb,CAAC;IACJ,CAAC;CACF;AAED,mCAAmC;AACnC,MAAM,CAAC,MAAM,SAAS,GAAa,IAAI,iBAAiB,EAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const registerGlobalResources: Resource[];
2
- //# sourceMappingURL=registerGlobalResources.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerGlobalResources.d.ts","sourceRoot":"","sources":["../../../../src/resources/customers/global/registerGlobalResources.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,YAEnC,CAAC"}
@@ -1,5 +0,0 @@
1
- import { Platforms } from "./PlatformsClass.js";
2
- export const registerGlobalResources = [
3
- Platforms,
4
- ];
5
- //# sourceMappingURL=registerGlobalResources.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerGlobalResources.js","sourceRoot":"","sources":["../../../../src/resources/customers/global/registerGlobalResources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,SAAS;CACV,CAAC"}
@@ -1,46 +0,0 @@
1
- import type { ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
2
- import { ResourceBase } from "../../../shared/index.js";
3
- import { z } from "zod";
4
- /**
5
- * Customers module tool documentation resource
6
- *
7
- * Serves tool-specific documentation from docs/tools/
8
- * Auto-discovers all markdown files.
9
- *
10
- * URI format: modyo://mcp-customers/tools/{toolPath}
11
- *
12
- * Examples:
13
- * - modyo://mcp-customers/tools/forms-manage
14
- * - modyo://mcp-customers/tools/realms-manage
15
- * - modyo://mcp-customers/tools/submissions-manage
16
- */
17
- export declare class CustomersDocsToolsResource extends ResourceBase<{
18
- toolPath: string;
19
- }> {
20
- protected config: {
21
- name: string;
22
- uriTemplate: string;
23
- description: string;
24
- mimeType: string;
25
- annotations: {
26
- readOnlyHint: boolean;
27
- idempotentHint: boolean;
28
- destructiveHint: boolean;
29
- };
30
- isPublic: boolean;
31
- catchErrors: boolean;
32
- };
33
- protected getParamsSchema(): z.ZodObject<{
34
- toolPath: z.ZodEnum<{
35
- [x: string]: string;
36
- }>;
37
- }, z.core.$strip> | z.ZodObject<{
38
- toolPath: z.ZodString;
39
- }, z.core.$strip>;
40
- registerResource(server: any, logger: any): Promise<void>;
41
- read(uri: URL, params: {
42
- toolPath: string;
43
- }): Promise<ReadResourceResult>;
44
- }
45
- export declare const customersDocsTools: CustomersDocsToolsResource;
46
- //# sourceMappingURL=CustomersDocsToolsResource.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CustomersDocsToolsResource.d.ts","sourceRoot":"","sources":["../../../../src/resources/customers/tools/CustomersDocsToolsResource.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAmB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqDxB;;;;;;;;;;;;GAYG;AACH,qBAAa,0BAA2B,SAAQ,YAAY,CAAC;IAC3D,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;IACA,SAAS,CAAC,MAAM;;;;;;;;;;;;MAad;IAEF,SAAS,CAAC,eAAe;;;;;;;IAuBH,gBAAgB,CACpC,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,GAAG,GACV,OAAO,CAAC,IAAI,CAAC;IAuEV,IAAI,CACR,GAAG,EAAE,GAAG,EACR,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;KAClB,GACA,OAAO,CAAC,kBAAkB,CAAC;CA0B/B;AAED,eAAO,MAAM,kBAAkB,4BAAmC,CAAC"}
@@ -1,160 +0,0 @@
1
- import fs from "node:fs/promises";
2
- import path from "node:path";
3
- import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
4
- import { DOCS_TOOLS_PATH, ResourceBase } from "../../../shared/index.js";
5
- import { z } from "zod";
6
- /**
7
- * Auto-discover customers tool documentation
8
- * Scans docs/tools/**\/*.md files
9
- * Returns both flat paths and mapping to actual file paths
10
- */
11
- async function discoverCustomersDocsTools() {
12
- const docsPath = DOCS_TOOLS_PATH;
13
- const flatPaths = [];
14
- const pathMap = new Map();
15
- async function scanDirectory(dir, prefix = "") {
16
- try {
17
- const entries = await fs.readdir(dir, {
18
- withFileTypes: true,
19
- });
20
- for (const entry of entries) {
21
- const fullPath = path.join(dir, entry.name);
22
- const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
23
- if (entry.isDirectory()) {
24
- await scanDirectory(fullPath, relativePath);
25
- }
26
- else if (entry.isFile() && entry.name.endsWith(".md")) {
27
- // Store actual file path (e.g., "forms/manage.md")
28
- const filePath = relativePath;
29
- // Create flat path by replacing / with - (e.g., "forms-manage")
30
- const flatPath = relativePath.replace(".md", "").replace(/\//g, "-");
31
- flatPaths.push(flatPath);
32
- pathMap.set(flatPath, filePath);
33
- }
34
- }
35
- }
36
- catch (error) {
37
- console.warn(`Could not scan directory ${dir}:`, error);
38
- }
39
- }
40
- await scanDirectory(docsPath);
41
- return {
42
- flatPaths: flatPaths.sort(),
43
- pathMap,
44
- };
45
- }
46
- // Cache discovered docs and path mapping
47
- let DISCOVERED_DOCS = [];
48
- let PATH_MAP = new Map();
49
- /**
50
- * Customers module tool documentation resource
51
- *
52
- * Serves tool-specific documentation from docs/tools/
53
- * Auto-discovers all markdown files.
54
- *
55
- * URI format: modyo://mcp-customers/tools/{toolPath}
56
- *
57
- * Examples:
58
- * - modyo://mcp-customers/tools/forms-manage
59
- * - modyo://mcp-customers/tools/realms-manage
60
- * - modyo://mcp-customers/tools/submissions-manage
61
- */
62
- export class CustomersDocsToolsResource extends ResourceBase {
63
- config = {
64
- name: "modyo-customers-tools-docs",
65
- uriTemplate: "modyo://mcp-customers/tools/{toolPath}",
66
- description: "Tool documentation for Modyo Customers module (realms, forms, originations, submissions, users)",
67
- mimeType: "text/markdown",
68
- annotations: {
69
- readOnlyHint: true,
70
- idempotentHint: true,
71
- destructiveHint: false,
72
- },
73
- isPublic: true,
74
- catchErrors: true,
75
- };
76
- getParamsSchema() {
77
- if (DISCOVERED_DOCS.length > 0) {
78
- return z.object({
79
- toolPath: z.enum(DISCOVERED_DOCS, {
80
- message: `Invalid tool path. Available: ${DISCOVERED_DOCS.join(", ")}`,
81
- }),
82
- });
83
- }
84
- return z.object({
85
- toolPath: z
86
- .string()
87
- .min(1)
88
- .describe("Tool documentation path (e.g., 'forms-manage')"),
89
- });
90
- }
91
- async registerResource(server, logger) {
92
- this.server = server;
93
- this.logger = logger;
94
- if (DISCOVERED_DOCS.length === 0) {
95
- const { flatPaths, pathMap } = await discoverCustomersDocsTools();
96
- DISCOVERED_DOCS = flatPaths;
97
- PATH_MAP = pathMap;
98
- logger(`Discovered ${DISCOVERED_DOCS.length} customers documentation files`, {
99
- docs: DISCOVERED_DOCS,
100
- }, "info");
101
- }
102
- const schema = this.getParamsSchema();
103
- const rawInputSchema = this.extractRawSchema(schema);
104
- const resourceConfig = {
105
- description: this.config.description,
106
- mimeType: this.config.mimeType,
107
- inputSchema: rawInputSchema,
108
- annotations: this.config.annotations,
109
- };
110
- const readCallback = async (uri, params) => {
111
- try {
112
- const validatedParams = schema.parse(params);
113
- return await this.read(uri, validatedParams);
114
- }
115
- catch (error) {
116
- if (this.config.catchErrors) {
117
- return this.errorResponse(uri, error, {
118
- params,
119
- });
120
- }
121
- logger(`Resource ${this.config.name} failed`, {
122
- uri: uri.href,
123
- params,
124
- error,
125
- }, "error");
126
- throw error;
127
- }
128
- };
129
- server.registerResource(this.config.name, new ResourceTemplate(this.config.uriTemplate, {
130
- list: undefined,
131
- complete: {
132
- toolPath: (value) => {
133
- return DISCOVERED_DOCS.filter((doc) => doc.startsWith(value)).slice(0, 20);
134
- },
135
- },
136
- }), resourceConfig, readCallback);
137
- }
138
- async read(uri, params) {
139
- this.debug(`Reading customers tool documentation: ${params.toolPath}`);
140
- try {
141
- // Look up actual file path from the mapping
142
- const relativeFilePath = PATH_MAP.get(params.toolPath);
143
- if (!relativeFilePath) {
144
- throw new Error(`Unknown tool path: ${params.toolPath}. Available: ${DISCOVERED_DOCS.join(", ")}`);
145
- }
146
- const docFilePath = path.join(DOCS_TOOLS_PATH, relativeFilePath);
147
- const content = await fs.readFile(docFilePath, "utf-8");
148
- this.info(`Served ${params.toolPath} tool documentation (${content.length} chars)`);
149
- return this.successText(uri, content, "text/markdown");
150
- }
151
- catch (error) {
152
- this.logError(`Failed to read ${params.toolPath} tool documentation`, {
153
- error,
154
- });
155
- throw error;
156
- }
157
- }
158
- }
159
- export const customersDocsTools = new CustomersDocsToolsResource();
160
- //# sourceMappingURL=CustomersDocsToolsResource.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CustomersDocsToolsResource.js","sourceRoot":"","sources":["../../../../src/resources/customers/tools/CustomersDocsToolsResource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,KAAK,UAAU,0BAA0B;IAIvC,MAAM,QAAQ,GAAG,eAAe,CAAC;IAEjC,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE1C,KAAK,UAAU,aAAa,CAAC,G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CAAC;CACF;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,0BAA0B,EAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const registerCustomersToolsResources: import("./CustomersDocsToolsResource.js").CustomersDocsToolsResource[];
2
- //# sourceMappingURL=registerCustomersToolsResources.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerCustomersToolsResources.d.ts","sourceRoot":"","sources":["../../../../src/resources/customers/tools/registerCustomersToolsResources.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,+BAA+B,wEAE3C,CAAC"}
@@ -1,5 +0,0 @@
1
- import { customersDocsTools } from "./CustomersDocsToolsResource.js";
2
- export const registerCustomersToolsResources = [
3
- customersDocsTools,
4
- ];
5
- //# sourceMappingURL=registerCustomersToolsResources.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerCustomersToolsResources.js","sourceRoot":"","sources":["../../../../src/resources/customers/tools/registerCustomersToolsResources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,kBAAkB;CACnB,CAAC"}