@mandujs/mcp 0.38.3 → 0.38.5
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 +3 -3
- package/package.json +2 -2
- package/src/index.ts +5 -5
- package/src/profiles.ts +112 -50
- package/src/prompts.ts +4 -4
- package/src/resources/skills/guides.ts +49 -49
- package/src/resources/skills/loader.ts +8 -8
- package/src/resources/skills/mandu-agent-workflow/SKILL.md +124 -124
- package/src/resources/skills/mandu-agent-workflow/metadata.json +7 -7
- package/src/resources/skills/mandu-composition/SKILL.md +47 -47
- package/src/resources/skills/mandu-deployment/SKILL.md +53 -53
- package/src/resources/skills/mandu-deployment/rules/db-provider-supabase.md +3 -3
- package/src/resources/skills/mandu-fs-routes/SKILL.md +47 -47
- package/src/resources/skills/mandu-guard/SKILL.md +58 -58
- package/src/resources/skills/mandu-hydration/SKILL.md +67 -67
- package/src/resources/skills/mandu-hydration/rules/hydration-island-setup.md +54 -54
- package/src/resources/skills/mandu-hydration/rules/hydration-priority-visible.md +60 -60
- package/src/resources/skills/mandu-performance/SKILL.md +47 -47
- package/src/resources/skills/mandu-security/SKILL.md +47 -47
- package/src/resources/skills/mandu-slot/SKILL.md +48 -48
- package/src/resources/skills/mandu-styling/SKILL.md +52 -52
- package/src/resources/skills/mandu-testing/SKILL.md +55 -55
- package/src/resources/skills/mandu-ui/SKILL.md +52 -52
- package/src/resources/skills/recipes.ts +28 -28
- package/src/server.ts +3 -3
- package/src/tools/agent.ts +443 -443
- package/src/tools/ate.ts +37 -37
- package/src/tools/composite.ts +13 -13
- package/src/tools/hydration.ts +197 -197
- package/src/tools/kitchen.ts +72 -72
- package/src/tools/runtime.ts +579 -579
- package/src/tools/slot-validation.ts +19 -19
package/src/tools/kitchen.ts
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* Enables any MCP-compatible agent to read client-side errors in real-time.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
8
|
-
import { loadManduConfig } from "@mandujs/core";
|
|
9
|
-
import { getDevServerState } from "./project.js";
|
|
10
|
-
import { readRuntimeControl } from "../utils/runtime-control.js";
|
|
7
|
+
import type { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
8
|
+
import { loadManduConfig } from "@mandujs/core";
|
|
9
|
+
import { getDevServerState } from "./project.js";
|
|
10
|
+
import { readRuntimeControl } from "../utils/runtime-control.js";
|
|
11
11
|
|
|
12
12
|
export const kitchenToolDefinitions: Tool[] = [
|
|
13
13
|
{
|
|
@@ -20,18 +20,18 @@ export const kitchenToolDefinitions: Tool[] = [
|
|
|
20
20
|
inputSchema: {
|
|
21
21
|
type: "object",
|
|
22
22
|
properties: {
|
|
23
|
-
clear: {
|
|
24
|
-
type: "boolean",
|
|
25
|
-
description: "Clear errors after reading (default: false)",
|
|
26
|
-
},
|
|
27
|
-
baseURL: {
|
|
28
|
-
type: "string",
|
|
29
|
-
description: "Explicit dev server URL. Overrides runtime-control/config discovery.",
|
|
30
|
-
},
|
|
31
|
-
port: {
|
|
32
|
-
type: "number",
|
|
33
|
-
description: "Explicit dev server port. Overrides runtime-control/config discovery.",
|
|
34
|
-
},
|
|
23
|
+
clear: {
|
|
24
|
+
type: "boolean",
|
|
25
|
+
description: "Clear errors after reading (default: false)",
|
|
26
|
+
},
|
|
27
|
+
baseURL: {
|
|
28
|
+
type: "string",
|
|
29
|
+
description: "Explicit dev server URL. Overrides runtime-control/config discovery.",
|
|
30
|
+
},
|
|
31
|
+
port: {
|
|
32
|
+
type: "number",
|
|
33
|
+
description: "Explicit dev server port. Overrides runtime-control/config discovery.",
|
|
34
|
+
},
|
|
35
35
|
},
|
|
36
36
|
required: [],
|
|
37
37
|
},
|
|
@@ -56,19 +56,19 @@ export const kitchenToolDefinitions: Tool[] = [
|
|
|
56
56
|
description:
|
|
57
57
|
"Include the extended diagnose report. Default true. Set false to lower latency when a11y_hints / package_export_gaps are noisy.",
|
|
58
58
|
},
|
|
59
|
-
includeDiff: {
|
|
60
|
-
type: "boolean",
|
|
61
|
-
description:
|
|
62
|
-
"Include git diff against MANDU_DIFF_BASE (default HEAD). Default true. Set false to skip when git is unavailable.",
|
|
63
|
-
},
|
|
64
|
-
baseURL: {
|
|
65
|
-
type: "string",
|
|
66
|
-
description: "Explicit dev server URL. Overrides runtime-control/config discovery.",
|
|
67
|
-
},
|
|
68
|
-
port: {
|
|
69
|
-
type: "number",
|
|
70
|
-
description: "Explicit dev server port. Overrides runtime-control/config discovery.",
|
|
71
|
-
},
|
|
59
|
+
includeDiff: {
|
|
60
|
+
type: "boolean",
|
|
61
|
+
description:
|
|
62
|
+
"Include git diff against MANDU_DIFF_BASE (default HEAD). Default true. Set false to skip when git is unavailable.",
|
|
63
|
+
},
|
|
64
|
+
baseURL: {
|
|
65
|
+
type: "string",
|
|
66
|
+
description: "Explicit dev server URL. Overrides runtime-control/config discovery.",
|
|
67
|
+
},
|
|
68
|
+
port: {
|
|
69
|
+
type: "number",
|
|
70
|
+
description: "Explicit dev server port. Overrides runtime-control/config discovery.",
|
|
71
|
+
},
|
|
72
72
|
},
|
|
73
73
|
required: [],
|
|
74
74
|
},
|
|
@@ -76,32 +76,32 @@ export const kitchenToolDefinitions: Tool[] = [
|
|
|
76
76
|
];
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
|
-
* Resolve the dev server base URL. Prefers explicit args, then
|
|
80
|
-
* `.mandu/runtime-control.json` from the running dev/start process, then
|
|
81
|
-
* captured stdout, then config/default 3333. Shared by every Kitchen-backed
|
|
82
|
-
* MCP tool so they all agree on where to fetch from.
|
|
79
|
+
* Resolve the dev server base URL. Prefers explicit args, then
|
|
80
|
+
* `.mandu/runtime-control.json` from the running dev/start process, then
|
|
81
|
+
* captured stdout, then config/default 3333. Shared by every Kitchen-backed
|
|
82
|
+
* MCP tool so they all agree on where to fetch from.
|
|
83
83
|
*/
|
|
84
|
-
async function resolveDevServerBaseUrl(
|
|
85
|
-
projectRoot: string,
|
|
86
|
-
args: { baseURL?: unknown; port?: unknown } = {},
|
|
87
|
-
): Promise<string> {
|
|
88
|
-
if (typeof args.baseURL === "string" && args.baseURL.trim()) {
|
|
89
|
-
return args.baseURL.trim().replace(/\/+$/, "");
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const explicitPort = normalizePort(args.port);
|
|
93
|
-
if (explicitPort) {
|
|
94
|
-
return `http://localhost:${explicitPort}`;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const control = await readRuntimeControl(projectRoot);
|
|
98
|
-
if (control?.baseUrl) {
|
|
99
|
-
return control.baseUrl.replace(/\/+$/, "");
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
let port: number | undefined;
|
|
103
|
-
|
|
104
|
-
const serverState = getDevServerState();
|
|
84
|
+
async function resolveDevServerBaseUrl(
|
|
85
|
+
projectRoot: string,
|
|
86
|
+
args: { baseURL?: unknown; port?: unknown } = {},
|
|
87
|
+
): Promise<string> {
|
|
88
|
+
if (typeof args.baseURL === "string" && args.baseURL.trim()) {
|
|
89
|
+
return args.baseURL.trim().replace(/\/+$/, "");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const explicitPort = normalizePort(args.port);
|
|
93
|
+
if (explicitPort) {
|
|
94
|
+
return `http://localhost:${explicitPort}`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const control = await readRuntimeControl(projectRoot);
|
|
98
|
+
if (control?.baseUrl) {
|
|
99
|
+
return control.baseUrl.replace(/\/+$/, "");
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
let port: number | undefined;
|
|
103
|
+
|
|
104
|
+
const serverState = getDevServerState();
|
|
105
105
|
if (serverState) {
|
|
106
106
|
for (const line of serverState.output) {
|
|
107
107
|
const portMatch = line.match(/https?:\/\/localhost:(\d+)/);
|
|
@@ -115,21 +115,21 @@ async function resolveDevServerBaseUrl(
|
|
|
115
115
|
const config = await loadManduConfig(projectRoot);
|
|
116
116
|
port = config.server?.port ?? 3333;
|
|
117
117
|
}
|
|
118
|
-
|
|
119
|
-
return `http://localhost:${port}`;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function normalizePort(value: unknown): number | undefined {
|
|
123
|
-
const raw = typeof value === "number" ? value : typeof value === "string" ? Number.parseInt(value, 10) : NaN;
|
|
124
|
-
if (!Number.isInteger(raw) || raw < 1 || raw > 65535) return undefined;
|
|
125
|
-
return raw;
|
|
126
|
-
}
|
|
118
|
+
|
|
119
|
+
return `http://localhost:${port}`;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function normalizePort(value: unknown): number | undefined {
|
|
123
|
+
const raw = typeof value === "number" ? value : typeof value === "string" ? Number.parseInt(value, 10) : NaN;
|
|
124
|
+
if (!Number.isInteger(raw) || raw < 1 || raw > 65535) return undefined;
|
|
125
|
+
return raw;
|
|
126
|
+
}
|
|
127
127
|
|
|
128
128
|
export function kitchenTools(projectRoot: string) {
|
|
129
129
|
const handlers: Record<string, (args: Record<string, unknown>) => Promise<unknown>> = {
|
|
130
|
-
"mandu.kitchen.errors": async (args: Record<string, unknown>) => {
|
|
131
|
-
const { clear = false } = args as { clear?: boolean };
|
|
132
|
-
const baseUrl = await resolveDevServerBaseUrl(projectRoot, args);
|
|
130
|
+
"mandu.kitchen.errors": async (args: Record<string, unknown>) => {
|
|
131
|
+
const { clear = false } = args as { clear?: boolean };
|
|
132
|
+
const baseUrl = await resolveDevServerBaseUrl(projectRoot, args);
|
|
133
133
|
|
|
134
134
|
try {
|
|
135
135
|
// Fetch errors from Kitchen API
|
|
@@ -185,12 +185,12 @@ export function kitchenTools(projectRoot: string) {
|
|
|
185
185
|
*/
|
|
186
186
|
"mandu.devtools.context": async (args: Record<string, unknown>) => {
|
|
187
187
|
const {
|
|
188
|
-
includeBundle = true,
|
|
189
|
-
includeDiagnose = true,
|
|
190
|
-
includeDiff = true,
|
|
191
|
-
} = args as { includeBundle?: boolean; includeDiagnose?: boolean; includeDiff?: boolean };
|
|
192
|
-
|
|
193
|
-
const baseUrl = await resolveDevServerBaseUrl(projectRoot, args);
|
|
188
|
+
includeBundle = true,
|
|
189
|
+
includeDiagnose = true,
|
|
190
|
+
includeDiff = true,
|
|
191
|
+
} = args as { includeBundle?: boolean; includeDiagnose?: boolean; includeDiff?: boolean };
|
|
192
|
+
|
|
193
|
+
const baseUrl = await resolveDevServerBaseUrl(projectRoot, args);
|
|
194
194
|
const params = new URLSearchParams();
|
|
195
195
|
if (!includeBundle) params.set("bundle", "0");
|
|
196
196
|
if (!includeDiagnose) params.set("diagnose", "0");
|