@mandujs/mcp 0.33.0 → 0.34.1
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/package.json +2 -2
- package/src/tools/deploy-plan.ts +51 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mandujs/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.1",
|
|
4
4
|
"description": "Mandu MCP Server - Agent-native interface for Mandu framework operations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@mandujs/core": "^0.
|
|
37
|
+
"@mandujs/core": "^0.49.0",
|
|
38
38
|
"@mandujs/ate": "^0.25.1",
|
|
39
39
|
"@mandujs/skills": "^0.19.0",
|
|
40
40
|
"@modelcontextprotocol/sdk": "^1.25.3"
|
package/src/tools/deploy-plan.ts
CHANGED
|
@@ -28,6 +28,7 @@ import type { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
|
28
28
|
import {
|
|
29
29
|
compileVercelJson,
|
|
30
30
|
emptyDeployIntentCache,
|
|
31
|
+
inferDeployIntentWithBrain,
|
|
31
32
|
isStaticIntentValidFor,
|
|
32
33
|
loadDeployIntentCache,
|
|
33
34
|
planDeploy,
|
|
@@ -39,7 +40,12 @@ import {
|
|
|
39
40
|
type PlanDiffEntry,
|
|
40
41
|
type VercelCompileResult,
|
|
41
42
|
} from "@mandujs/core/deploy";
|
|
42
|
-
import {
|
|
43
|
+
import {
|
|
44
|
+
generateManifest,
|
|
45
|
+
loadManifest,
|
|
46
|
+
resolveBrainAdapter,
|
|
47
|
+
type RoutesManifest,
|
|
48
|
+
} from "@mandujs/core";
|
|
43
49
|
import path from "node:path";
|
|
44
50
|
|
|
45
51
|
/**
|
|
@@ -87,13 +93,28 @@ interface DeployPlanInput {
|
|
|
87
93
|
apply?: boolean;
|
|
88
94
|
/** Force re-inference even on unchanged source hashes. */
|
|
89
95
|
reinfer?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Wrap the heuristic with the OAuth-backed brain adapter. Falls
|
|
98
|
+
* back to heuristic-only when no cloud token is available — the
|
|
99
|
+
* MCP response surfaces this in `brain_status`.
|
|
100
|
+
*/
|
|
101
|
+
use_brain?: boolean;
|
|
90
102
|
}
|
|
91
103
|
|
|
92
104
|
interface DeployPlanResultPayload {
|
|
93
105
|
/** ISO timestamp the inferer wrote into the next cache. */
|
|
94
106
|
generated_at: string;
|
|
95
|
-
/** Identifier of the inferer (`heuristic`
|
|
107
|
+
/** Identifier of the inferer (e.g. `heuristic`, `openai+heuristic`). */
|
|
96
108
|
brain_model: string;
|
|
109
|
+
/**
|
|
110
|
+
* Diagnostic for `use_brain: true` calls. Tells the agent whether
|
|
111
|
+
* the brain actually ran or the call fell back to heuristic.
|
|
112
|
+
* - `"used:openai"` / `"used:anthropic"` — brain ran.
|
|
113
|
+
* - `"unavailable:needs_login"` — call `mandu brain login` first.
|
|
114
|
+
* - `"unavailable:opted_out"` — telemetryOptOut is set in config.
|
|
115
|
+
* - `"not_requested"` — `use_brain: false` (default).
|
|
116
|
+
*/
|
|
117
|
+
brain_status: string;
|
|
97
118
|
/** Per-route diff suitable for rendering as a table. */
|
|
98
119
|
diff: Array<{
|
|
99
120
|
route_id: string;
|
|
@@ -137,12 +158,33 @@ async function deployPlanHandler(
|
|
|
137
158
|
};
|
|
138
159
|
}
|
|
139
160
|
|
|
161
|
+
// Resolve the inferer. `use_brain` opts into the cloud refinement
|
|
162
|
+
// path; on missing tokens or telemetryOptOut we fall back silently
|
|
163
|
+
// and tell the agent via `brain_status`.
|
|
164
|
+
let infer: Parameters<typeof planDeploy>[0]["infer"] | undefined;
|
|
165
|
+
let brainModel = "heuristic";
|
|
166
|
+
let brainStatus = "not_requested";
|
|
167
|
+
if (input.use_brain === true) {
|
|
168
|
+
const resolution = await resolveBrainAdapter({
|
|
169
|
+
adapter: "auto",
|
|
170
|
+
projectRoot,
|
|
171
|
+
});
|
|
172
|
+
if (resolution.resolved === "template") {
|
|
173
|
+
brainStatus = resolution.needsLogin ? "unavailable:needs_login" : "unavailable:opted_out";
|
|
174
|
+
} else {
|
|
175
|
+
infer = inferDeployIntentWithBrain({ adapter: resolution.adapter });
|
|
176
|
+
brainModel = `${resolution.resolved}+heuristic`;
|
|
177
|
+
brainStatus = `used:${resolution.resolved}`;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
140
181
|
const result = await planDeploy({
|
|
141
182
|
rootDir: projectRoot,
|
|
142
183
|
manifest,
|
|
143
184
|
previous,
|
|
144
185
|
reinfer,
|
|
145
|
-
brainModel
|
|
186
|
+
brainModel,
|
|
187
|
+
infer,
|
|
146
188
|
});
|
|
147
189
|
|
|
148
190
|
// Validate every entry against route shape so agents see the same
|
|
@@ -169,6 +211,7 @@ async function deployPlanHandler(
|
|
|
169
211
|
return {
|
|
170
212
|
generated_at: result.cache.generatedAt,
|
|
171
213
|
brain_model: result.cache.brainModel,
|
|
214
|
+
brain_status: brainStatus,
|
|
172
215
|
diff: result.diff.map((d) => ({
|
|
173
216
|
route_id: d.routeId,
|
|
174
217
|
pattern: d.pattern,
|
|
@@ -289,6 +332,11 @@ export const deployPlanToolDefinitions: Tool[] = [
|
|
|
289
332
|
type: "boolean",
|
|
290
333
|
description: "Force re-inference even on unchanged source hashes.",
|
|
291
334
|
},
|
|
335
|
+
use_brain: {
|
|
336
|
+
type: "boolean",
|
|
337
|
+
description:
|
|
338
|
+
"Wrap the heuristic with the OAuth-backed brain adapter (issue #250 M4). Falls back to heuristic when no cloud token is reachable; the response's `brain_status` tells you which path actually ran.",
|
|
339
|
+
},
|
|
292
340
|
},
|
|
293
341
|
required: [],
|
|
294
342
|
},
|