@mandujs/mcp 0.22.4 → 0.23.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/package.json +2 -2
- package/src/tools/ate-context.ts +96 -0
- package/src/tools/index.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mandujs/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "Mandu MCP Server - Agent-native interface for Mandu framework operations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@mandujs/core": "^0.37.0",
|
|
38
|
-
"@mandujs/ate": "^0.
|
|
38
|
+
"@mandujs/ate": "^0.20.0",
|
|
39
39
|
"@mandujs/skills": "^16.0.0",
|
|
40
40
|
"@modelcontextprotocol/sdk": "^1.25.3"
|
|
41
41
|
},
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mandu_ate_context` — Phase A.1 agent-native context tool.
|
|
3
|
+
*
|
|
4
|
+
* See `docs/ate/roadmap-v2-agent-native.md` §4.1 for the full design
|
|
5
|
+
* and §11 decision 4 for the naming convention (snake_case).
|
|
6
|
+
*
|
|
7
|
+
* Semantics: return a single JSON blob that an LLM-driven agent
|
|
8
|
+
* (Cursor / Claude Code / Codex) can read *before* generating a test.
|
|
9
|
+
* The blob fuses:
|
|
10
|
+
*
|
|
11
|
+
* 1. Route metadata (pattern, file, isRedirect, static params)
|
|
12
|
+
* 2. Contract surface (request/response schemas + examples)
|
|
13
|
+
* 3. Middleware chain (canonical name + options + file)
|
|
14
|
+
* 4. Guard preset + suggested data-route-id selectors
|
|
15
|
+
* 5. Fixture recommendations (createTestSession, createTestDb, ...)
|
|
16
|
+
* 6. Existing specs (user-written vs ate-generated, last-run status)
|
|
17
|
+
* 7. Related routes (siblings + ui-entry-point pairing)
|
|
18
|
+
*
|
|
19
|
+
* The handler itself is deliberately thin — almost all work is done
|
|
20
|
+
* inside `@mandujs/ate`'s `buildContext` so the same logic is
|
|
21
|
+
* importable from non-MCP callers (CLI, tests).
|
|
22
|
+
*/
|
|
23
|
+
import type { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
24
|
+
import { ateContext } from "@mandujs/ate";
|
|
25
|
+
|
|
26
|
+
export const ateContextToolDefinitions: Tool[] = [
|
|
27
|
+
{
|
|
28
|
+
name: "mandu_ate_context",
|
|
29
|
+
annotations: {
|
|
30
|
+
readOnlyHint: true,
|
|
31
|
+
},
|
|
32
|
+
description:
|
|
33
|
+
"Phase A.1 agent-native context. Returns a single JSON blob containing the " +
|
|
34
|
+
"Mandu-specific semantic context an LLM needs to write a correct test: " +
|
|
35
|
+
"route metadata, contract (with examples), middleware chain, guard preset + " +
|
|
36
|
+
"suggested [data-route-id] selectors, recommended @mandujs/core/testing fixtures, " +
|
|
37
|
+
"existing specs (with last-run status when .mandu/ate-last-run.json is present), " +
|
|
38
|
+
"and related routes (sibling + ui-entry-point pairing). " +
|
|
39
|
+
"Scope values: " +
|
|
40
|
+
"'project' = repo summary with route + coverage counts; " +
|
|
41
|
+
"'route' = single-route deep view (requires id or route); " +
|
|
42
|
+
"'filling' = server-handler view with middleware + actions (requires id); " +
|
|
43
|
+
"'contract' = request/response + examples for a contract definition. " +
|
|
44
|
+
"Run mandu.ate.extract first — this tool reads .mandu/interaction-graph.json.",
|
|
45
|
+
inputSchema: {
|
|
46
|
+
type: "object",
|
|
47
|
+
properties: {
|
|
48
|
+
repoRoot: {
|
|
49
|
+
type: "string",
|
|
50
|
+
description: "Absolute path to the Mandu project root",
|
|
51
|
+
},
|
|
52
|
+
scope: {
|
|
53
|
+
type: "string",
|
|
54
|
+
enum: ["project", "route", "filling", "contract"],
|
|
55
|
+
description:
|
|
56
|
+
"project (summary) | route (single route deep view) | filling (handler view) | contract (contract definition view)",
|
|
57
|
+
},
|
|
58
|
+
id: {
|
|
59
|
+
type: "string",
|
|
60
|
+
description:
|
|
61
|
+
"Route id ('api-signup'), filling id ('filling:api-signup'), or contract name. Optional — supply id OR route.",
|
|
62
|
+
},
|
|
63
|
+
route: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description:
|
|
66
|
+
"Route pattern match (e.g. '/api/signup'). Optional — supply id OR route.",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
required: ["repoRoot", "scope"],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
export function ateContextTools(_projectRoot: string) {
|
|
75
|
+
return {
|
|
76
|
+
mandu_ate_context: async (args: Record<string, unknown>) => {
|
|
77
|
+
const { repoRoot, scope, id, route } = args as {
|
|
78
|
+
repoRoot: string;
|
|
79
|
+
scope: "project" | "route" | "filling" | "contract";
|
|
80
|
+
id?: string;
|
|
81
|
+
route?: string;
|
|
82
|
+
};
|
|
83
|
+
// Minimal validation — the MCP SDK already enforces the schema,
|
|
84
|
+
// but we guard repoRoot explicitly so mis-invocations surface a
|
|
85
|
+
// loud error rather than a cascading filesystem failure.
|
|
86
|
+
if (!repoRoot || typeof repoRoot !== "string") {
|
|
87
|
+
return { ok: false, error: "repoRoot is required" };
|
|
88
|
+
}
|
|
89
|
+
if (!scope) {
|
|
90
|
+
return { ok: false, error: "scope is required" };
|
|
91
|
+
}
|
|
92
|
+
const blob = await ateContext({ repoRoot, scope, id, route });
|
|
93
|
+
return { ok: true, context: blob };
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
package/src/tools/index.ts
CHANGED
|
@@ -28,6 +28,7 @@ export { runtimeTools, runtimeToolDefinitions } from "./runtime.js";
|
|
|
28
28
|
export { seoTools, seoToolDefinitions } from "./seo.js";
|
|
29
29
|
export { projectTools, projectToolDefinitions, getDevServerState } from "./project.js";
|
|
30
30
|
export { ateTools, ateToolDefinitions, atePhase5ToolDefinitions, createAtePhase5Handlers } from "./ate.js";
|
|
31
|
+
export { ateContextTools, ateContextToolDefinitions } from "./ate-context.js";
|
|
31
32
|
export { resourceTools, resourceToolDefinitions } from "./resource.js";
|
|
32
33
|
export { componentTools, componentToolDefinitions } from "./component.js";
|
|
33
34
|
export { kitchenTools, kitchenToolDefinitions } from "./kitchen.js";
|
|
@@ -68,6 +69,7 @@ import { runtimeTools, runtimeToolDefinitions } from "./runtime.js";
|
|
|
68
69
|
import { seoTools, seoToolDefinitions } from "./seo.js";
|
|
69
70
|
import { projectTools, projectToolDefinitions } from "./project.js";
|
|
70
71
|
import { ateTools, ateToolDefinitions, atePhase5ToolDefinitions, createAtePhase5Handlers } from "./ate.js";
|
|
72
|
+
import { ateContextTools, ateContextToolDefinitions } from "./ate-context.js";
|
|
71
73
|
import { resourceTools, resourceToolDefinitions } from "./resource.js";
|
|
72
74
|
import { componentTools, componentToolDefinitions } from "./component.js";
|
|
73
75
|
import { kitchenTools, kitchenToolDefinitions } from "./kitchen.js";
|
|
@@ -125,6 +127,7 @@ const TOOL_MODULES: ToolModule[] = [
|
|
|
125
127
|
{ category: "project", definitions: projectToolDefinitions, handlers: projectTools as ToolModule["handlers"], requiresServer: true },
|
|
126
128
|
{ category: "ate", definitions: ateToolDefinitions, handlers: ateTools as ToolModule["handlers"] },
|
|
127
129
|
{ category: "ate-phase5", definitions: atePhase5ToolDefinitions, handlers: createAtePhase5Handlers as unknown as ToolModule["handlers"] },
|
|
130
|
+
{ category: "ate-context", definitions: ateContextToolDefinitions, handlers: ateContextTools },
|
|
128
131
|
{ category: "resource", definitions: resourceToolDefinitions, handlers: resourceTools },
|
|
129
132
|
{ category: "component", definitions: componentToolDefinitions, handlers: componentTools },
|
|
130
133
|
{ category: "kitchen", definitions: kitchenToolDefinitions, handlers: kitchenTools },
|