@agiflowai/scaffold-mcp 1.0.27 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/dist/{ListScaffoldingMethodsTool-DBwZzJTA.cjs → ListScaffoldingMethodsTool-CYZtpU-W.cjs} +109 -126
- package/dist/{ListScaffoldingMethodsTool-D6BkKQyK.mjs → ListScaffoldingMethodsTool-DxdrPlcb.mjs} +32 -44
- package/dist/{claudeCode-Dozuzn4S.mjs → claudeCode-DbKOy8W8.mjs} +7 -10
- package/dist/{claudeCode-B6CWgRYJ.cjs → claudeCode-g1eRidPR.cjs} +54 -57
- package/dist/cli.cjs +329 -157
- package/dist/cli.mjs +202 -30
- package/dist/{geminiCli-COS3X1P7.cjs → geminiCli--s1Qy7ZP.cjs} +35 -37
- package/dist/{geminiCli-CzgQDDMl.mjs → geminiCli-CcrZEqsz.mjs} +3 -5
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +3 -12
- package/dist/index.d.mts +3 -14
- package/dist/index.mjs +4 -5
- package/dist/{shared-oDx2Btq0.mjs → shared-BVYIN3Is.mjs} +4 -10
- package/dist/{shared-fkWett9D.cjs → shared-QxPXh-L-.cjs} +17 -23
- package/dist/{src-DuOmlC4n.cjs → src-BG_X82dw.cjs} +59 -77
- package/dist/{src-CSfEg-8i.mjs → src-DnVktdhD.mjs} +12 -30
- package/dist/{tools-DsnQImJ1.cjs → tools-COb9iBtt.cjs} +132 -130
- package/dist/{tools-t-HMGLVh.mjs → tools-Dn5KgBUI.mjs} +38 -41
- package/package.json +22 -22
package/dist/index.d.mts
CHANGED
|
@@ -2,8 +2,6 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
|
2
2
|
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { JsonSchema } from "@composio/json-schema-to-zod";
|
|
5
|
-
import "express";
|
|
6
|
-
|
|
7
5
|
//#region src/server/index.d.ts
|
|
8
6
|
interface ServerOptions {
|
|
9
7
|
adminEnabled?: boolean;
|
|
@@ -22,7 +20,7 @@ declare enum TransportMode {
|
|
|
22
20
|
STDIO = "stdio",
|
|
23
21
|
HTTP = "http",
|
|
24
22
|
SSE = "sse",
|
|
25
|
-
CLI = "cli"
|
|
23
|
+
CLI = "cli"
|
|
26
24
|
}
|
|
27
25
|
/**
|
|
28
26
|
* Transport configuration options
|
|
@@ -268,15 +266,10 @@ declare class UseBoilerplateTool {
|
|
|
268
266
|
//#region src/tools/UseScaffoldMethodTool.d.ts
|
|
269
267
|
declare class UseScaffoldMethodTool {
|
|
270
268
|
static readonly TOOL_NAME = "use-scaffold-method";
|
|
271
|
-
private static readonly TEMP_LOG_DIR;
|
|
272
269
|
private fileSystemService;
|
|
273
270
|
private scaffoldingMethodsService;
|
|
274
271
|
private isMonolith;
|
|
275
272
|
constructor(templatesPath: string, isMonolith?: boolean);
|
|
276
|
-
/**
|
|
277
|
-
* Write scaffold execution info to temp log file for hook processing
|
|
278
|
-
*/
|
|
279
|
-
private writePendingScaffoldLog;
|
|
280
273
|
/**
|
|
281
274
|
* Get the tool definition for MCP
|
|
282
275
|
*/
|
|
@@ -292,6 +285,7 @@ declare class WriteToFileTool {
|
|
|
292
285
|
static readonly TOOL_NAME = "write-to-file";
|
|
293
286
|
private fileSystemService;
|
|
294
287
|
constructor();
|
|
288
|
+
private resolveWorkspaceFilePath;
|
|
295
289
|
/**
|
|
296
290
|
* Get the tool definition for MCP
|
|
297
291
|
*/
|
|
@@ -713,7 +707,6 @@ declare class FileSystemService implements IFileSystemService {
|
|
|
713
707
|
}
|
|
714
708
|
//#endregion
|
|
715
709
|
//#region src/services/ScaffoldConfigLoader.d.ts
|
|
716
|
-
|
|
717
710
|
declare class ScaffoldConfigLoader implements IScaffoldConfigLoader {
|
|
718
711
|
private fileSystem;
|
|
719
712
|
private templateService;
|
|
@@ -938,11 +931,7 @@ declare class VariableReplacementService implements IVariableReplacementService
|
|
|
938
931
|
//#region src/types/tools.d.ts
|
|
939
932
|
declare const scaffoldArgsSchema: z.ZodObject<{
|
|
940
933
|
appName: z.ZodString;
|
|
941
|
-
},
|
|
942
|
-
appName: string;
|
|
943
|
-
}, {
|
|
944
|
-
appName: string;
|
|
945
|
-
}>;
|
|
934
|
+
}, z.core.$strip>;
|
|
946
935
|
type ScaffoldArgs = z.infer<typeof scaffoldArgsSchema>;
|
|
947
936
|
interface Tool {
|
|
948
937
|
name: string;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { a as createServer, i as StdioTransportHandler, n as HttpTransportHandler, r as SseTransportHandler, t as TransportMode } from "./src-
|
|
2
|
-
import { a as ScaffoldProcessingService, i as ScaffoldService, l as TemplateService, n as ScaffoldingMethodsService, o as ScaffoldConfigLoader, r as VariableReplacementService, s as FileSystemService, t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-
|
|
3
|
-
import { a as
|
|
4
|
-
|
|
5
|
-
export { BoilerplateGeneratorService, BoilerplateService, FileSystemService, GenerateBoilerplateFileTool, GenerateBoilerplateTool, GenerateFeatureScaffoldTool, HttpTransportHandler, ListBoilerplatesTool, ListScaffoldingMethodsTool, ScaffoldConfigLoader, ScaffoldGeneratorService, ScaffoldProcessingService, ScaffoldService, ScaffoldingMethodsService, SseTransportHandler, StdioTransportHandler, TemplateService, TransportMode, UseBoilerplateTool, UseScaffoldMethodTool, VariableReplacementService, WriteToFileTool, createServer };
|
|
1
|
+
import { a as createServer, i as StdioTransportHandler, n as HttpTransportHandler, r as SseTransportHandler, t as TransportMode } from "./src-DnVktdhD.mjs";
|
|
2
|
+
import { a as ScaffoldProcessingService, i as ScaffoldService, l as TemplateService, n as ScaffoldingMethodsService, o as ScaffoldConfigLoader, r as VariableReplacementService, s as FileSystemService, t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-DxdrPlcb.mjs";
|
|
3
|
+
import { a as ListBoilerplatesTool, c as GenerateBoilerplateFileTool, d as BoilerplateGeneratorService, i as UseBoilerplateTool, l as ScaffoldGeneratorService, n as UseScaffoldMethodTool, o as GenerateFeatureScaffoldTool, s as GenerateBoilerplateTool, t as WriteToFileTool, u as BoilerplateService } from "./tools-Dn5KgBUI.mjs";
|
|
4
|
+
export { BoilerplateGeneratorService, BoilerplateService, FileSystemService, GenerateBoilerplateFileTool, GenerateBoilerplateTool, GenerateFeatureScaffoldTool, HttpTransportHandler, ListBoilerplatesTool, ListScaffoldingMethodsTool, ScaffoldConfigLoader, ScaffoldGeneratorService, ScaffoldProcessingService, ScaffoldService, ScaffoldingMethodsService, SseTransportHandler, StdioTransportHandler, TemplateService, TransportMode, UseBoilerplateTool, UseScaffoldMethodTool, VariableReplacementService, WriteToFileTool, createServer };
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
|
-
|
|
4
|
-
//#region src/hooks/shared.ts
|
|
5
|
-
const MAX_SCAFFOLD_METHODS_IN_HOOK = 5;
|
|
6
|
-
const MAX_REQUIRED_VARS_IN_HOOK = 3;
|
|
7
|
-
const REQUIRED_VARS_METHOD_LIMIT = 2;
|
|
8
3
|
async function resolveNewFileWriteTarget(cwd, toolName, filePath) {
|
|
9
4
|
if (!filePath || toolName.toLowerCase() !== "write") return null;
|
|
10
5
|
const absoluteFilePath = path.isAbsolute(filePath) ? filePath : path.join(cwd, filePath);
|
|
@@ -18,9 +13,9 @@ async function resolveNewFileWriteTarget(cwd, toolName, filePath) {
|
|
|
18
13
|
}
|
|
19
14
|
}
|
|
20
15
|
function formatScaffoldMethodsHookMessage(methods, options) {
|
|
21
|
-
const maxMethods = options?.maxMethods ??
|
|
22
|
-
const requiredVarsMethodLimit = options?.requiredVarsMethodLimit ??
|
|
23
|
-
const maxRequiredVars = options?.maxRequiredVars ??
|
|
16
|
+
const maxMethods = options?.maxMethods ?? 5;
|
|
17
|
+
const requiredVarsMethodLimit = options?.requiredVarsMethodLimit ?? 2;
|
|
18
|
+
const maxRequiredVars = options?.maxRequiredVars ?? 3;
|
|
24
19
|
const visibleMethods = methods.slice(0, maxMethods);
|
|
25
20
|
const hiddenCount = Math.max(methods.length - visibleMethods.length, 0);
|
|
26
21
|
let message = "Before writing this new file, use `use-scaffold-method` if any of these fit:\n\n";
|
|
@@ -39,6 +34,5 @@ function formatScaffoldMethodsHookMessage(methods, options) {
|
|
|
39
34
|
if (hiddenCount > 0) message += `\n...and ${hiddenCount} more methods. Call \`list-scaffolding-methods\` for the full list.\n`;
|
|
40
35
|
return message.trimEnd();
|
|
41
36
|
}
|
|
42
|
-
|
|
43
37
|
//#endregion
|
|
44
|
-
export { resolveNewFileWriteTarget as n, formatScaffoldMethodsHookMessage as t };
|
|
38
|
+
export { resolveNewFileWriteTarget as n, formatScaffoldMethodsHookMessage as t };
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
const require_ListScaffoldingMethodsTool = require(
|
|
1
|
+
const require_ListScaffoldingMethodsTool = require("./ListScaffoldingMethodsTool-CYZtpU-W.cjs");
|
|
2
2
|
let node_path = require("node:path");
|
|
3
|
-
node_path = require_ListScaffoldingMethodsTool.__toESM(node_path);
|
|
3
|
+
node_path = require_ListScaffoldingMethodsTool.__toESM(node_path, 1);
|
|
4
4
|
let node_fs_promises = require("node:fs/promises");
|
|
5
|
-
node_fs_promises = require_ListScaffoldingMethodsTool.__toESM(node_fs_promises);
|
|
6
|
-
|
|
7
|
-
//#region src/hooks/shared.ts
|
|
8
|
-
const MAX_SCAFFOLD_METHODS_IN_HOOK = 5;
|
|
9
|
-
const MAX_REQUIRED_VARS_IN_HOOK = 3;
|
|
10
|
-
const REQUIRED_VARS_METHOD_LIMIT = 2;
|
|
5
|
+
node_fs_promises = require_ListScaffoldingMethodsTool.__toESM(node_fs_promises, 1);
|
|
11
6
|
async function resolveNewFileWriteTarget(cwd, toolName, filePath) {
|
|
12
7
|
if (!filePath || toolName.toLowerCase() !== "write") return null;
|
|
13
8
|
const absoluteFilePath = node_path.default.isAbsolute(filePath) ? filePath : node_path.default.join(cwd, filePath);
|
|
@@ -21,9 +16,9 @@ async function resolveNewFileWriteTarget(cwd, toolName, filePath) {
|
|
|
21
16
|
}
|
|
22
17
|
}
|
|
23
18
|
function formatScaffoldMethodsHookMessage(methods, options) {
|
|
24
|
-
const maxMethods = options?.maxMethods ??
|
|
25
|
-
const requiredVarsMethodLimit = options?.requiredVarsMethodLimit ??
|
|
26
|
-
const maxRequiredVars = options?.maxRequiredVars ??
|
|
19
|
+
const maxMethods = options?.maxMethods ?? 5;
|
|
20
|
+
const requiredVarsMethodLimit = options?.requiredVarsMethodLimit ?? 2;
|
|
21
|
+
const maxRequiredVars = options?.maxRequiredVars ?? 3;
|
|
27
22
|
const visibleMethods = methods.slice(0, maxMethods);
|
|
28
23
|
const hiddenCount = Math.max(methods.length - visibleMethods.length, 0);
|
|
29
24
|
let message = "Before writing this new file, use `use-scaffold-method` if any of these fit:\n\n";
|
|
@@ -42,17 +37,16 @@ function formatScaffoldMethodsHookMessage(methods, options) {
|
|
|
42
37
|
if (hiddenCount > 0) message += `\n...and ${hiddenCount} more methods. Call \`list-scaffolding-methods\` for the full list.\n`;
|
|
43
38
|
return message.trimEnd();
|
|
44
39
|
}
|
|
45
|
-
|
|
46
40
|
//#endregion
|
|
47
|
-
Object.defineProperty(exports,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
Object.defineProperty(exports, "formatScaffoldMethodsHookMessage", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function() {
|
|
44
|
+
return formatScaffoldMethodsHookMessage;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(exports, "resolveNewFileWriteTarget", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function() {
|
|
50
|
+
return resolveNewFileWriteTarget;
|
|
51
|
+
}
|
|
52
52
|
});
|
|
53
|
-
Object.defineProperty(exports, 'resolveNewFileWriteTarget', {
|
|
54
|
-
enumerable: true,
|
|
55
|
-
get: function () {
|
|
56
|
-
return resolveNewFileWriteTarget;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
const require_ListScaffoldingMethodsTool = require(
|
|
2
|
-
const require_tools = require(
|
|
3
|
-
let
|
|
4
|
-
let
|
|
5
|
-
let
|
|
1
|
+
const require_ListScaffoldingMethodsTool = require("./ListScaffoldingMethodsTool-CYZtpU-W.cjs");
|
|
2
|
+
const require_tools = require("./tools-COb9iBtt.cjs");
|
|
3
|
+
let _agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
|
|
4
|
+
let _modelcontextprotocol_sdk_server_index_js = require("@modelcontextprotocol/sdk/server/index.js");
|
|
5
|
+
let _modelcontextprotocol_sdk_types_js = require("@modelcontextprotocol/sdk/types.js");
|
|
6
6
|
let zod = require("zod");
|
|
7
|
-
let
|
|
8
|
-
let
|
|
7
|
+
let _modelcontextprotocol_sdk_server_stdio_js = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
8
|
+
let _modelcontextprotocol_sdk_server_sse_js = require("@modelcontextprotocol/sdk/server/sse.js");
|
|
9
9
|
let express = require("express");
|
|
10
|
-
express = require_ListScaffoldingMethodsTool.__toESM(express);
|
|
10
|
+
express = require_ListScaffoldingMethodsTool.__toESM(express, 1);
|
|
11
11
|
let node_crypto = require("node:crypto");
|
|
12
|
-
let
|
|
13
|
-
|
|
12
|
+
let _modelcontextprotocol_sdk_server_streamableHttp_js = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
|
|
14
13
|
//#region package.json
|
|
15
|
-
var version = "1.0
|
|
16
|
-
|
|
14
|
+
var version = "1.1.0";
|
|
17
15
|
//#endregion
|
|
18
16
|
//#region src/instructions/server.md?raw
|
|
19
17
|
var server_default = "Use this MCP server to {% if isMonolith %}create your monolith project and add features (pages, components, services, etc.){% else %}create new projects and add features (pages, components, services, etc.){% endif %}.\n\n## Workflow:\n{% if not isMonolith %}\n1. **Creating New Project**: Use `list-boilerplates` → `use-boilerplate`\n2. **Adding Features**: Use `list-scaffolding-methods` → `use-scaffold-method`\n{% else %}\n1. **Creating Project**: Use `use-boilerplate` (boilerplateName auto-detected from `.toolkit/settings.yaml`)\n2. **Adding Features**: Use `list-scaffolding-methods` → `use-scaffold-method`\n{% endif %}\n\n## AI Usage Guidelines:\n{% if not isMonolith %}\n- Always call `list-boilerplates` first when creating new projects to see available options\n{% endif %}\n- Always call `list-scaffolding-methods` first when adding features to understand what's available\n- Follow the exact variable schema provided - validation will fail if required fields are missing\n{% if not isMonolith %}\n- Use kebab-case for project names (e.g., \"my-new-app\")\n{% else %}\n- In monolith mode, parameters like `boilerplateName` and `templateName` are auto-detected from `.toolkit/settings.yaml`\n- You only need to provide `variables` when calling `use-boilerplate` or `use-scaffold-method`\n{% endif %}\n- The tools automatically handle file placement, imports, and code generation\n- Check the returned JSON schemas to understand required vs optional variables\n{% if adminEnabled %}\n\n## Admin Mode (Template Generation):\n\nWhen creating custom boilerplate templates for frameworks not yet supported:\n\n1. **Create Boilerplate Configuration**: Use `generate-boilerplate` to add a new boilerplate entry to a template's scaffold.yaml\n - Specify template name, boilerplate name, description, target folder, and variable schema\n - This creates the scaffold.yaml structure following the nextjs-15 pattern\n - Optional: Add detailed instruction about file purposes and design patterns\n\n2. **Create Feature Configuration**: Use `generate-feature-scaffold` to add a new feature entry to a template's scaffold.yaml\n - Specify template name, feature name, generator, description, and variable schema\n - This creates the scaffold.yaml structure for feature scaffolds (pages, components, etc.)\n - Optional: Add detailed instruction about file purposes and design patterns\n - Optional: Specify patterns to match existing files this feature works with\n\n3. **Create Template Files**: Use `generate-boilerplate-file` to create the actual template files\n - Create files referenced in the boilerplate's or feature's includes array\n - Use {{ variableName }} syntax for Liquid variable placeholders\n - Can copy from existing source files or provide content directly\n - Files automatically get .liquid extension\n\n4. **Test the Template**: Use `list-boilerplates`/`list-scaffolding-methods` and `use-boilerplate`/`use-scaffold-method` to verify your template works\n\nExample workflow for boilerplate:\n```\n1. generate-boilerplate { templateName: \"react-vite\", boilerplateName: \"scaffold-vite-app\", ... }\n2. generate-boilerplate-file { templateName: \"react-vite\", filePath: \"package.json\", content: \"...\" }\n3. generate-boilerplate-file { templateName: \"react-vite\", filePath: \"src/App.tsx\", content: \"...\" }\n4. list-boilerplates (verify it appears)\n5. use-boilerplate { boilerplateName: \"scaffold-vite-app\", variables: {...} }\n```\n\nExample workflow for feature:\n```\n1. generate-feature-scaffold { templateName: \"nextjs-15\", featureName: \"scaffold-nextjs-component\", generator: \"componentGenerator.ts\", ... }\n2. generate-boilerplate-file { templateName: \"nextjs-15\", filePath: \"src/components/Component.tsx\", content: \"...\" }\n3. list-scaffolding-methods (verify it appears)\n4. use-scaffold-method { scaffoldName: \"scaffold-nextjs-component\", variables: {...} }\n```\n{% endif %}\n";
|
|
20
|
-
|
|
21
18
|
//#endregion
|
|
22
19
|
//#region src/instructions/prompts/generate-boilerplate.md?raw
|
|
23
20
|
var generate_boilerplate_default = "{% if promptAsSkill %}---\nname: generate-boilerplate\ndescription: Create a new boilerplate template configuration for scaffolding new projects. Use this skill when the user wants to define a reusable project template (e.g., React app, Express API, Next.js starter) that can be used to bootstrap future projects. This is an admin/developer tool for creating the template definitions themselves, not for using existing templates. It generates scaffold.yaml configuration and template files with Liquid syntax for variable substitution.\n---\n\n{% endif %}You are helping create a new boilerplate template configuration using the scaffold-mcp MCP tools.\n\n{% if request %}User request: {{ request }}\n{% endif %}\nYour task:\n\n1. **Gather Information**: Ask for any missing details:\n - Framework/technology (e.g., \"React Vite\", \"Express API\", \"Next.js 15\")\n - Template name (kebab-case, e.g., \"react-vite\", \"nextjs-15\")\n - Boilerplate name (prefixed with \"scaffold-\", e.g., \"scaffold-vite-app\")\n {% if not isMonolith %}- Target folder (e.g., \"apps\", \"packages\"){% else %}- Target folder (defaults to \".\" for monolith mode){% endif %}\n - Project type (app, library, service, etc.)\n - Required variables (at minimum: appName or packageName)\n - Files to include in the template\n\n2. **Use MCP Tools** in order:\n - `generate-boilerplate` - Creates the boilerplate configuration\n - `generate-boilerplate-file` - Creates each template file\n {% if not isMonolith %}- `list-boilerplates` - Verify it appears{% endif %}\n - `use-boilerplate` - Test the boilerplate\n\nImportant:\n- Template naming: Use kebab-case (e.g., \"react-vite\", \"express-api\")\n- Boilerplate naming: Prefix with \"scaffold-\" (e.g., \"scaffold-vite-app\")\n{% if not isMonolith %}- Target folder: \"apps\" for applications, \"packages\" for libraries{% else %}- Target folder: \".\" for monolith projects (creates files at workspace root){% endif %}\n- Include files explicitly - avoid wildcards\n- Template syntax: use {{ variableName }}\n\n**Description Field Guidelines (CRITICAL)**:\nThe description should be a comprehensive multi-paragraph overview (3-5 sentences):\n- Paragraph 1: Core technology stack and primary value proposition\n- Paragraph 2: Target use cases and ideal project types\n- Paragraph 3: Key integrations or special features (if applicable)\n\nExample:\n\"A modern React SPA template powered by Vite for lightning-fast HMR, featuring TanStack Router for type-safe routing and TanStack Query for server state management.\nPerfect for building data-driven dashboards, admin panels, and interactive web applications requiring client-side routing and real-time data synchronization.\n\nIncludes Agiflow Config Management System integration with systematic environment variable naming (VITE_{CATEGORY}_{SUBCATEGORY}_{PROPERTY}) and auto-generated configuration templates for cloud deployment.\"\n\n**Instruction Field Guidelines (CRITICAL)**:\nThe instruction should be a detailed multi-section guide that helps AI understand the codebase:\n\n1. **File purposes** section: List each major file/directory with its purpose\n Format: \"- path/to/file: Description of what this file does\"\n\n2. **How to use the scaffolded code** section: Step-by-step workflows\n Format: Numbered list with specific examples\n - How to add routes/pages\n - How to fetch data\n - How to handle authentication\n - How to configure environment variables\n\n3. **Design patterns to follow** section: Key architectural decisions\n Format: \"- Pattern Name: Explanation and when to use it\"\n - Routing patterns\n - State management patterns\n - Data fetching patterns\n - Error handling patterns\n - Performance optimization patterns\n\nExample structure:\n\"[Framework] application template with [key technologies].\n\nFile purposes:\n- package.json: NPM package configuration with [framework] and dependencies\n- src/main.tsx: Application entry point with [setup details]\n- src/routes/: Route definitions following [pattern]\n[... list all major files ...]\n\nHow to use the scaffolded code:\n1. Routes: Create new routes by [specific instructions with example]\n2. Data Fetching: Use [specific pattern] for [use case]\n3. Authentication: Use [specific components/modules] for user management\n[... numbered steps for common tasks ...]\n\nDesign patterns to follow:\n- File-based Routing: Use directory structure in src/routes/ to define URL paths\n- Type-safe Routes: Leverage [framework] type inference for params\n- State Management: Use [library] for server state, [library] for client state\n[... list key patterns with explanations ...]\"\n\nTemplate File Content Guidelines:\n- Keep content MINIMAL and business-agnostic\n- Focus on structure and patterns, not business logic\n- Use placeholder/generic examples only\n- Include essential boilerplate code only\n- Let AI fill in specific logic later\n- Add clear headers with design patterns and coding standards\n";
|
|
24
|
-
|
|
25
21
|
//#endregion
|
|
26
22
|
//#region src/prompts/GenerateBoilerplatePrompt.ts
|
|
27
23
|
/**
|
|
@@ -77,11 +73,9 @@ var GenerateBoilerplatePrompt = class GenerateBoilerplatePrompt {
|
|
|
77
73
|
}];
|
|
78
74
|
}
|
|
79
75
|
};
|
|
80
|
-
|
|
81
76
|
//#endregion
|
|
82
77
|
//#region src/instructions/prompts/generate-feature-scaffold.md?raw
|
|
83
78
|
var generate_feature_scaffold_default = "{% if promptAsSkill %}---\nname: generate-feature-scaffold\ndescription: Create a new feature scaffold configuration for adding features to existing projects. Use this skill when the user wants to define a reusable feature template (e.g., page, component, service, API route) that can be used to add functionality to projects of a specific type. This is an admin/developer tool for creating the feature scaffold definitions themselves, not for using existing scaffolds. It generates feature configurations in scaffold.yaml and template files with Liquid syntax and conditional includes.\n---\n\n{% endif %}You are helping create a new feature scaffold configuration using the scaffold-mcp MCP tools.\n\n{% if request %}User request: {{ request }}\n{% endif %}\nYour task:\n\n1. **Gather Information**: Ask for any missing details:\n {% if not isMonolith %}- Template name (e.g., \"nextjs-15\", \"react-vite\"){% else %}- Template name (will be auto-detected from `.toolkit/settings.yaml`){% endif %}\n - Feature name (prefixed with \"scaffold-\", e.g., \"scaffold-nextjs-page\")\n - Feature type (page, component, service, etc.)\n - Variables needed\n - Files to include\n\n2. **Use MCP Tools** in order:\n - `generate-feature-scaffold` - Creates the feature configuration\n - `generate-boilerplate-file` - Creates each template file\n - `list-scaffolding-methods` - Verify it appears\n - `use-scaffold-method` - Test the feature\n\nImportant:\n- Feature names: prefix with \"scaffold-\"\n- Conditional includes: use \"file.tsx?withLayout=true\"\n- Template syntax: use {{ variableName }}\n{% if isMonolith %}- Template name will be auto-detected from `.toolkit/settings.yaml`{% endif %}\n\n**Description Field Guidelines (CRITICAL)**:\nThe description should explain what the feature scaffold generates (2-3 sentences):\n- Sentence 1: What type of code it generates (component, page, service, etc.)\n- Sentence 2: Key features or capabilities included\n- Sentence 3: Primary use cases or when to use it\n\nExample:\n\"Generate a new service class for TypeScript libraries following best practices. Creates a service class with interface, implementation, and unit tests. Perfect for creating reusable service modules with dependency injection patterns.\"\n\n**Instruction Field Guidelines (CRITICAL)**:\nThe instruction should provide specific guidance for using the generated feature:\n\n1. **Pattern explanation**: Describe the architectural pattern used\n2. **File organization**: Where files should be placed\n3. **Naming conventions**: How to name things (PascalCase, camelCase, etc.)\n4. **Usage guidelines**: How to use the generated code\n5. **Testing approach**: How to test the feature\n\nExample structure:\n\"[Feature type] follow a [pattern name] pattern with [key characteristics].\n[Explanation of how it works and integrates with the project].\nPlace [files] in [directory].\nFor [features with X], define [Y] in [Z] for better separation of concerns.\n[Feature names] should be [case style] and [suffix/prefix rules].\nWrite comprehensive [tests/docs] for all [public methods/exports].\"\n\nKeep it concise but informative - focus on the patterns and conventions that AI needs to understand to work with the generated code effectively.\n\nTemplate File Content Guidelines:\n- Keep content MINIMAL and business-agnostic\n- Focus on structure and patterns, not business logic\n- Use placeholder/generic examples only\n- Include essential boilerplate code only\n- Let AI fill in specific logic later\n- Add clear headers with design patterns and coding standards\n";
|
|
84
|
-
|
|
85
79
|
//#endregion
|
|
86
80
|
//#region src/prompts/GenerateFeatureScaffoldPrompt.ts
|
|
87
81
|
/**
|
|
@@ -137,11 +131,9 @@ var GenerateFeatureScaffoldPrompt = class GenerateFeatureScaffoldPrompt {
|
|
|
137
131
|
}];
|
|
138
132
|
}
|
|
139
133
|
};
|
|
140
|
-
|
|
141
134
|
//#endregion
|
|
142
135
|
//#region src/instructions/prompts/scaffold-application.md?raw
|
|
143
136
|
var scaffold_application_default = "{% if promptAsSkill %}---\nname: scaffold-application\ndescription: Create a new application or project from a boilerplate template. Use this skill when the user wants to start a new project, create a new app, or bootstrap a new codebase from scratch. This skill lists available boilerplate templates (React, Next.js, Express, etc.), gathers required configuration variables, generates the complete project structure, and provides guidance on next steps including adding features.\n---\n\n{% endif %}You are helping create a new {% if isMonolith %}monolith application{% else %}application{% endif %} using the scaffold-mcp MCP tools.\n\n{% if request %}User request: {{ request }}\n{% endif %}\nYour task is to scaffold a new application by following this workflow:\n\n## Step 1: {% if isMonolith %}Prepare to Create Application{% else %}List Available Boilerplates{% endif %}\n{% if isMonolith %}You will use the `use-boilerplate` tool to create your monolith application. The boilerplate name will be auto-detected from your `.toolkit/settings.yaml` file (or legacy `toolkit.yaml` if present).{% else %}Use the `list-boilerplates` tool to see all available project templates.\n\n**What to look for:**\n- Boilerplate name (e.g., \"scaffold-nextjs-app\", \"scaffold-vite-app\")\n- Description of what the boilerplate creates\n- Target folder where projects will be created (e.g., \"apps\", \"packages\")\n- Required and optional variables in the variables_schema{% endif %}\n\n## Step 2: Gather Required Information\nBased on the {% if isMonolith %}`.toolkit/settings.yaml` sourceTemplate{% else %}selected boilerplate's variables_schema{% endif %}, collect:\n{% if not isMonolith %}- **Project name**: Must be kebab-case (e.g., \"my-new-app\", not \"MyNewApp\")\n{% endif %}- **Required variables**: All variables marked as required: true\n- **Optional variables**: Variables with required: false (ask user if needed)\n\nCommon variables:\n- `appName` or `packageName`: The project name (kebab-case)\n- `description`: Brief description of what the project does\n- `author`: Author name\n\n## Step 3: Execute the Boilerplate\nUse the `use-boilerplate` tool with:\n{% if not isMonolith %}- `boilerplateName`: Exact name from list-boilerplates response\n{% endif %}- `variables`: Object matching the variables_schema exactly\n\n**Example:**\n```json\n{\n{% if not isMonolith %} \"boilerplateName\": \"scaffold-nextjs-app\",\n{% endif %} \"variables\": {\n \"appName\": \"my-dashboard\",\n \"description\": \"Admin dashboard for managing users\",\n \"author\": \"John Doe\"\n }\n}\n```\n\n## Important Guidelines:\n{% if not isMonolith %}- **Always call `list-boilerplates` first** to see available options and their schemas{% else %}- The boilerplate name is auto-detected from `.toolkit/settings.yaml` (or legacy `toolkit.yaml`){% endif %}\n- **Use exact variable names** from the schema (case-sensitive)\n- **Provide all required variables** - the tool will fail if any are missing\n{% if not isMonolith %}- **Use kebab-case for project names** (e.g., \"user-dashboard\", not \"UserDashboard\")\n- The tool will create the project in the appropriate directory automatically{% else %}- The tool will create files at the workspace root{% endif %}\n- After creation, inform the user {% if isMonolith %}what files were created{% else %}where the project was created{% endif %}\n\n## Step 4: Review and Add Features (If Needed)\nAfter the boilerplate is created, **consider if additional features are needed**:\n1. **READ** the generated {% if isMonolith %}application{% else %}project{% endif %} structure to understand what was created\n2. **REVIEW** the user's request to see if they asked for specific features (e.g., \"with tool for X\", \"with prompt for Y\")\n3. **If features are needed**:\n - Use `list-scaffolding-methods`{% if not isMonolith %} with the new project path{% endif %}\n - Use `use-scaffold-method` to add tools, services, prompts, etc.\n - **IMPLEMENT** the actual logic in the scaffolded feature files\n - **REMOVE the `// @scaffold-generated` marker** from each file after implementing it (see below)\n - **REGISTER** the features in `src/server/index.ts`\n4. **Install dependencies**: Remind user to run `pnpm install`\n5. **Report** the complete setup including any features added\n\n## Scaffold Marker — Remove After Implementing\nGenerated `.ts`/`.tsx`/`.js`/`.jsx` files contain `// @scaffold-generated` at the top. This comment flags unimplemented boilerplate files.\n\n**You MUST delete this line once a file is fully implemented.** Leaving it in place marks the file as a \"phantom\" — a scaffolded file whose logic was never written. The marker is checked at session boundaries to catch files that were accidentally left as empty templates.\n\n## Example Workflow:\n{% if not isMonolith %}1. Call `list-boilerplates` → See available templates\n2. Ask user which template to use (or infer from request)\n3. Collect required variables based on schema\n4. Call `use-boilerplate` with boilerplateName and variables{% else %}1. Collect required variables based on the monolith template's variables_schema from `.toolkit/settings.yaml`\n2. Call `use-boilerplate` with variables (boilerplateName auto-detected){% endif %}\n5. **Review if user requested specific features (tools, prompts, etc.)**\n6. **If features needed**: Add them using `list-scaffolding-methods` and `use-scaffold-method`\n7. **READ and IMPLEMENT** the scaffolded feature files with actual logic\n8. **REMOVE `// @scaffold-generated`** from each file once implemented\n9. Report success and next steps to the user\n";
|
|
144
|
-
|
|
145
137
|
//#endregion
|
|
146
138
|
//#region src/prompts/ScaffoldApplicationPrompt.ts
|
|
147
139
|
/**
|
|
@@ -197,11 +189,9 @@ var ScaffoldApplicationPrompt = class ScaffoldApplicationPrompt {
|
|
|
197
189
|
}];
|
|
198
190
|
}
|
|
199
191
|
};
|
|
200
|
-
|
|
201
192
|
//#endregion
|
|
202
193
|
//#region src/instructions/prompts/scaffold-feature.md?raw
|
|
203
194
|
var scaffold_feature_default = "{% if promptAsSkill %}---\nname: scaffold-feature\ndescription: Add a new feature to an existing project such as service, route, page, component, or API endpoint. Use this skill when the user wants to add functionality to an existing codebase using predefined scaffolding templates. This skill lists available scaffolding methods for the project's template type, gathers required variables, generates boilerplate files, and guides implementation of the actual business logic.\n---\n\n{% endif %}You are helping add a new feature to an existing project using the scaffold-mcp MCP tools.\n\n{% if request %}User request: {{ request }}\n{% endif %}{% if projectPath %}Project path: {{ projectPath }}\n{% endif %}\nYour task is to scaffold a new feature by following this workflow:\n\n## Step 1: Identify the Project\nDetermine the project path where the feature will be added:\n- If projectPath is provided, use it\n- Otherwise, ask the user or infer from context (e.g., \"apps/my-app\", \"packages/my-lib\")\n{% if isMonolith %}- In monolith mode, you can use the current working directory (no projectPath needed){% else %}- The path should point to a directory containing a `project.json` file{% endif %}\n\n## Step 2: List Available Scaffolding Methods\nUse the `list-scaffolding-methods` tool{% if not isMonolith %} with the projectPath{% endif %}.\n\n**What to look for:**\n- Feature name (e.g., \"scaffold-nextjs-page\", \"scaffold-react-component\")\n- Description of what files/code it generates\n- Required and optional variables in the variables_schema\n- The template type (derived from project's sourceTemplate)\n\n**Example:**\n```json\n{% if isMonolith %}{}{% else %}{\n \"projectPath\": \"apps/my-dashboard\"\n}{% endif %}\n```\n\n## Step 3: Gather Required Information\nBased on the selected scaffolding method's variables_schema, collect:\n- **Feature-specific variables**: Name, path, type, etc.\n- **Required variables**: All variables marked as required: true\n- **Optional variables**: Variables with required: false (ask user if needed)\n\nCommon variables:\n- `componentName` / `pageName` / `serviceName`: Name in PascalCase\n- `componentPath` / `pagePath`: Where to place the file (may use kebab-case)\n- Boolean flags: `withTests`, `withLayout`, `withStyles`, etc.\n\n## Step 4: Execute the Scaffolding Method\nUse the `use-scaffold-method` tool with:\n{% if not isMonolith %}- `projectPath`: Same path from step 1\n{% endif %}- `scaffold_feature_name`: Exact name from list-scaffolding-methods response\n- `variables`: Object matching the variables_schema exactly\n\n**Example:**\n```json\n{\n{% if not isMonolith %} \"projectPath\": \"apps/my-dashboard\",\n{% endif %} \"scaffold_feature_name\": \"scaffold-nextjs-page\",\n \"variables\": {\n \"pageName\": \"UserProfile\",\n \"pagePath\": \"user/profile\",\n \"withLayout\": true,\n \"withTests\": false\n }\n}\n```\n\n## Important Guidelines:\n- **Always call `list-scaffolding-methods` first**{% if not isMonolith %} with the projectPath{% endif %}\n- **Use exact variable names** from the schema (case-sensitive)\n- **Provide all required variables** - the tool will fail if any are missing\n- **Follow naming conventions**:\n - Component/Page/Service names: PascalCase (e.g., \"UserProfile\")\n - File paths: kebab-case or as specified in schema (e.g., \"user/profile\")\n- **Conditional files**: Files with `?condition=true` are only included when the variable is true\n- The tool will create files in the appropriate locations automatically\n- After creation, inform the user what files were created\n\n## Step 5: Review and Implement Generated Files\nAfter scaffolding completes, **you MUST**:\n1. **READ** all generated files to understand their structure\n2. **IMPLEMENT** the actual business logic:\n - Replace TODO comments with real code\n - Replace template placeholders with actual implementation\n - Add the specific functionality described in the user's request\n3. **REMOVE the `// @scaffold-generated` marker** from each file after you finish implementing it:\n - Generated `.ts`/`.tsx`/`.js`/`.jsx` files will have `// @scaffold-generated` at the top\n - This marker flags files that still contain unimplemented boilerplate\n - **Delete this comment line** once a file is fully implemented\n - Leaving the marker in place signals that the file is a \"phantom\" — unimplemented boilerplate\n4. **REGISTER** the feature in appropriate files:\n - Import and register tools in `src/server/index.ts`\n - Export new modules from `index.ts` files\n - Update any necessary configuration files\n5. **TEST** to ensure the implementation works correctly\n6. **DO NOT SKIP** this step - scaffolded files are templates that need actual code\n\n## Example Workflow:\n1. Identify project path (provided or ask user){% if not isMonolith %}\n2. Call `list-scaffolding-methods` → See available features for this project{% else %}\n2. Call `list-scaffolding-methods` → See available features for your template{% endif %}\n3. Ask user which feature to add (or infer from request)\n4. Collect required variables based on schema\n5. Call `use-scaffold-method` with {% if not isMonolith %}projectPath, {% endif %}scaffold_feature_name, and variables\n6. **READ the generated files and IMPLEMENT the actual logic**\n7. **REMOVE `// @scaffold-generated` from each file once implemented**\n8. **REGISTER the feature in server/index.ts and other config files**\n9. Report success and list created files with implementation details\n";
|
|
204
|
-
|
|
205
195
|
//#endregion
|
|
206
196
|
//#region src/prompts/ScaffoldFeaturePrompt.ts
|
|
207
197
|
/**
|
|
@@ -263,11 +253,9 @@ var ScaffoldFeaturePrompt = class ScaffoldFeaturePrompt {
|
|
|
263
253
|
}];
|
|
264
254
|
}
|
|
265
255
|
};
|
|
266
|
-
|
|
267
256
|
//#endregion
|
|
268
257
|
//#region src/instructions/prompts/sync-template-patterns.md?raw
|
|
269
258
|
var sync_template_patterns_default = "{% if promptAsSkill %}---\nname: sync-template-patterns\ndescription: Update scaffold template files when design patterns have changed and there are discrepancies between templates and current coding standards. Use this skill when architect.yaml or RULES.yaml have been updated and existing .liquid template files need to be brought in line with the new patterns.\n---\n\n{% endif %}You are helping synchronize scaffold template files with the latest design patterns using architect-mcp and scaffold-mcp tools.\n\n{% if request %}User request: {{ request }}\n{% endif %}{% if templateName %}Template to sync: {{ templateName }}\n{% endif %}{% if filePath %}Focus on file type: {{ filePath }}\n{% endif %}\nYour task is to detect discrepancies between current design patterns and scaffold template files, then update the templates to match.\n\n## Step 1: Gather Context\n\nDetermine scope:\n- If `templateName` is provided, scope the work to that template\n- If `filePath` is provided, focus on templates that generate files matching that path pattern\n- Otherwise, ask the user which template or file type to update\n\n{% if not isMonolith %}Use `list-boilerplates` and `list-scaffolding-methods` to discover available templates and their file includes.{% else %}Use `list-scaffolding-methods` to discover available features and their file includes.{% endif %}\n\n## Step 2: Get Current Design Patterns\n\nFor each file type the template generates, use `get-file-design-pattern` from architect-mcp:\n\n```\nget-file-design-pattern({ file_path: \"<path matching the template's target file>\" })\n```\n\n**What to capture from the response:**\n- `must_do` rules — patterns that MUST appear in generated code\n- `must_not_do` rules — anti-patterns to eliminate from templates\n- `should_do` rules — best practices to incorporate\n- Code examples showing the expected structure\n- Naming conventions and architectural decisions\n\n**Important**: Use the TARGET file path (what the template generates), not the `.liquid` template file path.\nFor example, if a template generates `src/tools/MyTool.ts`, call `get-file-design-pattern` with `src/tools/ExistingTool.ts`.\n\n## Step 3: Read Existing Template Files\n\nFor each `.liquid` template file that corresponds to the file types you checked:\n- Read the current template content\n- Note what patterns, imports, class structures, and boilerplate it contains\n- Identify the Liquid variables in use (e.g., `{{ toolName }}`, `{{ serviceName }}`)\n\nTemplate files live in the templates directory under the template name folder with `.liquid` extension\n(e.g., `templates/nextjs-15/src/tools/Tool.ts.liquid`).\n\n## Step 4: Identify Discrepancies\n\nCompare template content against the design patterns. Look for:\n\n**Critical discrepancies (must fix):**\n- Missing required imports or base classes (`must_do` violations)\n- Presence of forbidden patterns (`must_not_do` violations)\n- Wrong class/function structure that contradicts current patterns\n- Outdated error handling, typing, or interface patterns\n\n**Important discrepancies (should fix):**\n- Missing `should_do` best practices\n- Outdated code examples in template headers\n- Stale design pattern documentation in the file header comment\n\n**Document each discrepancy before making changes:**\n- Which template file is affected\n- What the current template does\n- What the design pattern requires\n- What change is needed\n\n## Step 5: Update Template Files\n\nFor each discrepancy, use `generate-boilerplate-file` to update the template:\n\n```json\n{\n {% if not isMonolith %}\"templateName\": \"<the template name>\",{% endif %}\n \"filePath\": \"<relative path without .liquid extension>\",\n \"content\": \"<updated template content with Liquid variables preserved>\",\n \"header\": \"<updated design pattern summary reflecting the new patterns>\"\n}\n```\n\n**Critical rules when updating templates:**\n- **Preserve all Liquid variables** — `{{ variableName }}`, `{% if condition %}`, filter chains like `{{ name | pascalCase }}` must remain intact\n- **Keep templates minimal and business-agnostic** — structural/boilerplate code only, not specific logic\n- **Update the header comment** to reflect the new design patterns, coding standards, and things to avoid\n- **Do NOT hardcode business logic** — use placeholder examples only\n- **Do NOT overwrite variables with literals** — `{{ toolName }}` must never become a hardcoded string\n\n## Step 6: Update scaffold.yaml Instruction (If Needed)\n\nIf the design pattern changes affect the architectural guidance documented in the boilerplate/feature `instruction` field:\n\n1. Retrieve the current instruction via `list-boilerplates` or `list-scaffolding-methods`\n2. Update the entry using `generate-boilerplate` or `generate-feature-scaffold` with the revised `instruction`\n\n## Step 7: Verify\n\nAfter updating:\n1. Confirm all `must_do` patterns are present in the updated template\n2. Confirm all `must_not_do` patterns are removed\n3. Confirm Liquid syntax is valid (variables and tags intact)\n4. Optionally run `use-scaffold-method` or `use-boilerplate` to generate a sample and review output\n\n## Important Guidelines\n\n- **One file at a time** — work through discrepancies file by file\n- **Explain each change** — tell the user what was outdated and what you updated, and why\n- **Preserve variable placeholders** — never replace `{{ toolName }}` with a literal string\n- **Be conservative** — only change what the design patterns explicitly require\n- **Report skipped files** — if a template file has no discrepancies, say so explicitly\n\n## Example Workflow\n\n{% if not isMonolith %}1. Call `list-scaffolding-methods` with `{ \"templateName\": \"nextjs-15\" }` to see features and their includes\n{% else %}1. Call `list-scaffolding-methods` to see available features and their includes\n{% endif %}2. For each feature's included files, call `get-file-design-pattern` with a matching real file path\n3. Read the corresponding `.liquid` template files\n4. Document all discrepancies found\n5. Call `generate-boilerplate-file` for each file that needs updating\n6. Report a summary: which files were updated, what changed, and why\n";
|
|
270
|
-
|
|
271
259
|
//#endregion
|
|
272
260
|
//#region src/prompts/SyncTemplatePatterns.ts
|
|
273
261
|
const syncTemplatePatternsPromptOptionsSchema = zod.z.object({
|
|
@@ -328,7 +316,6 @@ var SyncTemplatePatternsPrompt = class SyncTemplatePatternsPrompt {
|
|
|
328
316
|
}
|
|
329
317
|
}
|
|
330
318
|
};
|
|
331
|
-
|
|
332
319
|
//#endregion
|
|
333
320
|
//#region src/server/index.ts
|
|
334
321
|
const TOOL_CAPABILITIES_META_KEY = "agiflowai/capabilities";
|
|
@@ -343,7 +330,7 @@ function withCapabilities(definition, capabilities) {
|
|
|
343
330
|
}
|
|
344
331
|
function createServer(options = {}) {
|
|
345
332
|
const { adminEnabled = false, isMonolith = false, promptAsSkill = false, fallbackTool, fallbackToolConfig } = options;
|
|
346
|
-
const templatesPath =
|
|
333
|
+
const templatesPath = _agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPathSync();
|
|
347
334
|
if (!templatesPath) throw new Error("Templates folder not found. Please create a \"templates\" folder in your workspace root, or specify \"templatesPath\" in toolkit.yaml to point to your templates directory.");
|
|
348
335
|
const listBoilerplatesTool = !isMonolith ? new require_tools.ListBoilerplatesTool(templatesPath, isMonolith) : null;
|
|
349
336
|
const useBoilerplateTool = !isMonolith ? new require_tools.UseBoilerplateTool(templatesPath, isMonolith) : null;
|
|
@@ -379,7 +366,7 @@ function createServer(options = {}) {
|
|
|
379
366
|
fallbackTool,
|
|
380
367
|
fallbackToolConfig
|
|
381
368
|
});
|
|
382
|
-
const server = new
|
|
369
|
+
const server = new _modelcontextprotocol_sdk_server_index_js.Server({
|
|
383
370
|
name: "scaffold-mcp",
|
|
384
371
|
version
|
|
385
372
|
}, {
|
|
@@ -389,7 +376,7 @@ function createServer(options = {}) {
|
|
|
389
376
|
prompts: {}
|
|
390
377
|
}
|
|
391
378
|
});
|
|
392
|
-
server.setRequestHandler(
|
|
379
|
+
server.setRequestHandler(_modelcontextprotocol_sdk_types_js.ListToolsRequestSchema, async () => {
|
|
393
380
|
try {
|
|
394
381
|
const tools = [
|
|
395
382
|
withCapabilities(listScaffoldingMethodsTool.getDefinition(), [
|
|
@@ -442,7 +429,7 @@ function createServer(options = {}) {
|
|
|
442
429
|
throw new Error(`Failed to list tools: ${error instanceof Error ? error.message : String(error)}`);
|
|
443
430
|
}
|
|
444
431
|
});
|
|
445
|
-
server.setRequestHandler(
|
|
432
|
+
server.setRequestHandler(_modelcontextprotocol_sdk_types_js.CallToolRequestSchema, async (request) => {
|
|
446
433
|
const { name, arguments: args } = request.params;
|
|
447
434
|
try {
|
|
448
435
|
if (name === require_tools.ListBoilerplatesTool.TOOL_NAME) {
|
|
@@ -473,7 +460,7 @@ function createServer(options = {}) {
|
|
|
473
460
|
throw new Error(`Tool '${name}' execution failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
474
461
|
}
|
|
475
462
|
});
|
|
476
|
-
server.setRequestHandler(
|
|
463
|
+
server.setRequestHandler(_modelcontextprotocol_sdk_types_js.ListPromptsRequestSchema, async () => {
|
|
477
464
|
try {
|
|
478
465
|
const prompts = [scaffoldApplicationPrompt.getDefinition(), scaffoldFeaturePrompt.getDefinition()];
|
|
479
466
|
if (adminEnabled) {
|
|
@@ -486,7 +473,7 @@ function createServer(options = {}) {
|
|
|
486
473
|
throw new Error(`Failed to list prompts: ${error instanceof Error ? error.message : String(error)}`);
|
|
487
474
|
}
|
|
488
475
|
});
|
|
489
|
-
server.setRequestHandler(
|
|
476
|
+
server.setRequestHandler(_modelcontextprotocol_sdk_types_js.GetPromptRequestSchema, async (request) => {
|
|
490
477
|
const { name, arguments: args } = request.params;
|
|
491
478
|
try {
|
|
492
479
|
if (name === ScaffoldApplicationPrompt.PROMPT_NAME) return { messages: scaffoldApplicationPrompt.getMessages(args) };
|
|
@@ -510,7 +497,6 @@ function createServer(options = {}) {
|
|
|
510
497
|
});
|
|
511
498
|
return server;
|
|
512
499
|
}
|
|
513
|
-
|
|
514
500
|
//#endregion
|
|
515
501
|
//#region src/transports/stdio.ts
|
|
516
502
|
/**
|
|
@@ -524,7 +510,7 @@ var StdioTransportHandler = class {
|
|
|
524
510
|
this.server = server;
|
|
525
511
|
}
|
|
526
512
|
async start() {
|
|
527
|
-
this.transport = new
|
|
513
|
+
this.transport = new _modelcontextprotocol_sdk_server_stdio_js.StdioServerTransport();
|
|
528
514
|
await this.server.connect(this.transport);
|
|
529
515
|
console.error("Scaffolding MCP server started on stdio");
|
|
530
516
|
}
|
|
@@ -535,7 +521,6 @@ var StdioTransportHandler = class {
|
|
|
535
521
|
}
|
|
536
522
|
}
|
|
537
523
|
};
|
|
538
|
-
|
|
539
524
|
//#endregion
|
|
540
525
|
//#region src/transports/sse.ts
|
|
541
526
|
/**
|
|
@@ -608,7 +593,7 @@ var SseTransportHandler = class {
|
|
|
608
593
|
async handleSseConnection(_req, res) {
|
|
609
594
|
try {
|
|
610
595
|
const mcpServer = this.serverFactory();
|
|
611
|
-
const transport = new
|
|
596
|
+
const transport = new _modelcontextprotocol_sdk_server_sse_js.SSEServerTransport("/messages", res);
|
|
612
597
|
this.sessionManager.setSession(transport.sessionId, transport, mcpServer);
|
|
613
598
|
res.on("close", () => {
|
|
614
599
|
this.sessionManager.deleteSession(transport.sessionId);
|
|
@@ -677,7 +662,6 @@ var SseTransportHandler = class {
|
|
|
677
662
|
return this.config.host;
|
|
678
663
|
}
|
|
679
664
|
};
|
|
680
|
-
|
|
681
665
|
//#endregion
|
|
682
666
|
//#region src/transports/http.ts
|
|
683
667
|
/**
|
|
@@ -753,13 +737,13 @@ var HttpTransportHandler = class {
|
|
|
753
737
|
const sessionId = req.headers["mcp-session-id"];
|
|
754
738
|
let transport;
|
|
755
739
|
if (sessionId && this.sessionManager.hasSession(sessionId)) transport = this.sessionManager.getSession(sessionId).transport;
|
|
756
|
-
else if (!sessionId && (0,
|
|
740
|
+
else if (!sessionId && (0, _modelcontextprotocol_sdk_types_js.isInitializeRequest)(req.body)) {
|
|
757
741
|
const mcpServer = this.serverFactory();
|
|
758
|
-
transport = new
|
|
742
|
+
transport = new _modelcontextprotocol_sdk_server_streamableHttp_js.StreamableHTTPServerTransport({
|
|
759
743
|
sessionIdGenerator: () => (0, node_crypto.randomUUID)(),
|
|
760
744
|
enableJsonResponse: true,
|
|
761
|
-
onsessioninitialized: (sessionId
|
|
762
|
-
this.sessionManager.setSession(sessionId
|
|
745
|
+
onsessioninitialized: (sessionId) => {
|
|
746
|
+
this.sessionManager.setSession(sessionId, transport, mcpServer);
|
|
763
747
|
}
|
|
764
748
|
});
|
|
765
749
|
transport.onclose = () => {
|
|
@@ -833,54 +817,52 @@ var HttpTransportHandler = class {
|
|
|
833
817
|
return this.config.host;
|
|
834
818
|
}
|
|
835
819
|
};
|
|
836
|
-
|
|
837
820
|
//#endregion
|
|
838
821
|
//#region src/transports/types.ts
|
|
839
822
|
/**
|
|
840
823
|
* Transport mode types
|
|
841
824
|
*/
|
|
842
|
-
let TransportMode = /* @__PURE__ */ function(TransportMode
|
|
843
|
-
TransportMode
|
|
844
|
-
TransportMode
|
|
845
|
-
TransportMode
|
|
846
|
-
TransportMode
|
|
847
|
-
return TransportMode
|
|
825
|
+
let TransportMode = /* @__PURE__ */ function(TransportMode) {
|
|
826
|
+
TransportMode["STDIO"] = "stdio";
|
|
827
|
+
TransportMode["HTTP"] = "http";
|
|
828
|
+
TransportMode["SSE"] = "sse";
|
|
829
|
+
TransportMode["CLI"] = "cli";
|
|
830
|
+
return TransportMode;
|
|
848
831
|
}({});
|
|
849
|
-
|
|
850
832
|
//#endregion
|
|
851
|
-
Object.defineProperty(exports,
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
833
|
+
Object.defineProperty(exports, "HttpTransportHandler", {
|
|
834
|
+
enumerable: true,
|
|
835
|
+
get: function() {
|
|
836
|
+
return HttpTransportHandler;
|
|
837
|
+
}
|
|
856
838
|
});
|
|
857
|
-
Object.defineProperty(exports,
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
839
|
+
Object.defineProperty(exports, "SseTransportHandler", {
|
|
840
|
+
enumerable: true,
|
|
841
|
+
get: function() {
|
|
842
|
+
return SseTransportHandler;
|
|
843
|
+
}
|
|
862
844
|
});
|
|
863
|
-
Object.defineProperty(exports,
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
845
|
+
Object.defineProperty(exports, "StdioTransportHandler", {
|
|
846
|
+
enumerable: true,
|
|
847
|
+
get: function() {
|
|
848
|
+
return StdioTransportHandler;
|
|
849
|
+
}
|
|
868
850
|
});
|
|
869
|
-
Object.defineProperty(exports,
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
851
|
+
Object.defineProperty(exports, "TransportMode", {
|
|
852
|
+
enumerable: true,
|
|
853
|
+
get: function() {
|
|
854
|
+
return TransportMode;
|
|
855
|
+
}
|
|
874
856
|
});
|
|
875
|
-
Object.defineProperty(exports,
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
857
|
+
Object.defineProperty(exports, "createServer", {
|
|
858
|
+
enumerable: true,
|
|
859
|
+
get: function() {
|
|
860
|
+
return createServer;
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
Object.defineProperty(exports, "version", {
|
|
864
|
+
enumerable: true,
|
|
865
|
+
get: function() {
|
|
866
|
+
return version;
|
|
867
|
+
}
|
|
880
868
|
});
|
|
881
|
-
Object.defineProperty(exports, 'version', {
|
|
882
|
-
enumerable: true,
|
|
883
|
-
get: function () {
|
|
884
|
-
return version;
|
|
885
|
-
}
|
|
886
|
-
});
|