@vinkius-core/mcp-fusion 3.0.0 → 3.1.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/README.md +161 -0
- package/dist/cli/fusion.js +47 -47
- package/dist/cli/fusion.js.map +1 -1
- package/dist/cli/templates/config.js +28 -28
- package/dist/cli/templates/config.js.map +1 -1
- package/dist/cli/templates/core.js +127 -127
- package/dist/cli/templates/middleware.js +25 -25
- package/dist/cli/templates/readme.js +142 -142
- package/dist/cli/templates/readme.js.map +1 -1
- package/dist/cli/templates/testing.js +84 -84
- package/dist/cli/templates/tools.js +46 -46
- package/dist/cli/templates/vectors/database.js +69 -69
- package/dist/cli/templates/vectors/oauth.js +63 -63
- package/dist/cli/templates/vectors/openapi.js +97 -97
- package/dist/exposition/ExpositionCompiler.js +8 -1
- package/dist/exposition/ExpositionCompiler.js.map +1 -1
- package/dist/introspection/SemanticProbe.js +49 -49
- package/dist/prompt/FluentPromptBuilder.d.ts.map +1 -1
- package/package.json +148 -147
|
@@ -1,106 +1,106 @@
|
|
|
1
1
|
/** Generate `openapi.yaml` — Sample OpenAPI spec */
|
|
2
2
|
export function openapiYaml(config) {
|
|
3
|
-
return `# OpenAPI 3.0 Specification — Sample
|
|
4
|
-
#
|
|
5
|
-
# Replace this with your actual API spec, then run:
|
|
6
|
-
# npx @vinkius-core/mcp-fusion-openapi-gen ./openapi.yaml --outDir ./src/generated
|
|
7
|
-
#
|
|
8
|
-
# The generator creates Presenters, Tools, Registry, and server
|
|
9
|
-
# bootstrap — all configurable via YAML annotations.
|
|
10
|
-
|
|
11
|
-
openapi: '3.0.3'
|
|
12
|
-
info:
|
|
13
|
-
title: '${config.name} API'
|
|
14
|
-
version: '0.1.0'
|
|
15
|
-
description: Sample API for MCP Fusion OpenAPI generation
|
|
16
|
-
|
|
17
|
-
servers:
|
|
18
|
-
- url: http://localhost:3000/api
|
|
19
|
-
|
|
20
|
-
paths:
|
|
21
|
-
/health:
|
|
22
|
-
get:
|
|
23
|
-
operationId: getHealth
|
|
24
|
-
summary: Health check endpoint
|
|
25
|
-
responses:
|
|
26
|
-
'200':
|
|
27
|
-
description: Server health status
|
|
28
|
-
content:
|
|
29
|
-
application/json:
|
|
30
|
-
schema:
|
|
31
|
-
type: object
|
|
32
|
-
properties:
|
|
33
|
-
status:
|
|
34
|
-
type: string
|
|
35
|
-
example: healthy
|
|
36
|
-
uptime:
|
|
37
|
-
type: number
|
|
38
|
-
example: 12345.67
|
|
39
|
-
|
|
40
|
-
/users:
|
|
41
|
-
get:
|
|
42
|
-
operationId: listUsers
|
|
43
|
-
summary: List all users
|
|
44
|
-
parameters:
|
|
45
|
-
- name: limit
|
|
46
|
-
in: query
|
|
47
|
-
schema:
|
|
48
|
-
type: integer
|
|
49
|
-
minimum: 1
|
|
50
|
-
maximum: 100
|
|
51
|
-
default: 10
|
|
52
|
-
responses:
|
|
53
|
-
'200':
|
|
54
|
-
description: List of users
|
|
55
|
-
content:
|
|
56
|
-
application/json:
|
|
57
|
-
schema:
|
|
58
|
-
type: array
|
|
59
|
-
items:
|
|
60
|
-
$ref: '#/components/schemas/User'
|
|
61
|
-
|
|
62
|
-
components:
|
|
63
|
-
schemas:
|
|
64
|
-
User:
|
|
65
|
-
type: object
|
|
66
|
-
properties:
|
|
67
|
-
id:
|
|
68
|
-
type: string
|
|
69
|
-
name:
|
|
70
|
-
type: string
|
|
71
|
-
email:
|
|
72
|
-
type: string
|
|
3
|
+
return `# OpenAPI 3.0 Specification — Sample
|
|
4
|
+
#
|
|
5
|
+
# Replace this with your actual API spec, then run:
|
|
6
|
+
# npx @vinkius-core/mcp-fusion-openapi-gen ./openapi.yaml --outDir ./src/generated
|
|
7
|
+
#
|
|
8
|
+
# The generator creates Presenters, Tools, Registry, and server
|
|
9
|
+
# bootstrap — all configurable via YAML annotations.
|
|
10
|
+
|
|
11
|
+
openapi: '3.0.3'
|
|
12
|
+
info:
|
|
13
|
+
title: '${config.name} API'
|
|
14
|
+
version: '0.1.0'
|
|
15
|
+
description: Sample API for MCP Fusion OpenAPI generation
|
|
16
|
+
|
|
17
|
+
servers:
|
|
18
|
+
- url: http://localhost:3000/api
|
|
19
|
+
|
|
20
|
+
paths:
|
|
21
|
+
/health:
|
|
22
|
+
get:
|
|
23
|
+
operationId: getHealth
|
|
24
|
+
summary: Health check endpoint
|
|
25
|
+
responses:
|
|
26
|
+
'200':
|
|
27
|
+
description: Server health status
|
|
28
|
+
content:
|
|
29
|
+
application/json:
|
|
30
|
+
schema:
|
|
31
|
+
type: object
|
|
32
|
+
properties:
|
|
33
|
+
status:
|
|
34
|
+
type: string
|
|
35
|
+
example: healthy
|
|
36
|
+
uptime:
|
|
37
|
+
type: number
|
|
38
|
+
example: 12345.67
|
|
39
|
+
|
|
40
|
+
/users:
|
|
41
|
+
get:
|
|
42
|
+
operationId: listUsers
|
|
43
|
+
summary: List all users
|
|
44
|
+
parameters:
|
|
45
|
+
- name: limit
|
|
46
|
+
in: query
|
|
47
|
+
schema:
|
|
48
|
+
type: integer
|
|
49
|
+
minimum: 1
|
|
50
|
+
maximum: 100
|
|
51
|
+
default: 10
|
|
52
|
+
responses:
|
|
53
|
+
'200':
|
|
54
|
+
description: List of users
|
|
55
|
+
content:
|
|
56
|
+
application/json:
|
|
57
|
+
schema:
|
|
58
|
+
type: array
|
|
59
|
+
items:
|
|
60
|
+
$ref: '#/components/schemas/User'
|
|
61
|
+
|
|
62
|
+
components:
|
|
63
|
+
schemas:
|
|
64
|
+
User:
|
|
65
|
+
type: object
|
|
66
|
+
properties:
|
|
67
|
+
id:
|
|
68
|
+
type: string
|
|
69
|
+
name:
|
|
70
|
+
type: string
|
|
71
|
+
email:
|
|
72
|
+
type: string
|
|
73
73
|
`;
|
|
74
74
|
}
|
|
75
75
|
/** Generate `SETUP.md` — OpenAPI generation instructions */
|
|
76
76
|
export function openapiSetupMd() {
|
|
77
|
-
return `# OpenAPI Generator Setup
|
|
78
|
-
|
|
79
|
-
This project is configured for the **Legacy API Proxy** ingestion vector.
|
|
80
|
-
|
|
81
|
-
## Steps
|
|
82
|
-
|
|
83
|
-
1. Replace \`openapi.yaml\` with your actual OpenAPI 3.x spec
|
|
84
|
-
|
|
85
|
-
2. Generate the MCP server from the spec:
|
|
86
|
-
\`\`\`bash
|
|
87
|
-
npx @vinkius-core/mcp-fusion-openapi-gen ./openapi.yaml --outDir ./src/generated
|
|
88
|
-
\`\`\`
|
|
89
|
-
|
|
90
|
-
3. The generator creates:
|
|
91
|
-
- Presenters with Zod schemas (Egress Firewall)
|
|
92
|
-
- Tool builders with typed handlers
|
|
93
|
-
- Registry setup with all endpoints
|
|
94
|
-
|
|
95
|
-
4. Import and register in \`src/server.ts\`:
|
|
96
|
-
\`\`\`typescript
|
|
97
|
-
import { generatedTools } from './generated/registry.js';
|
|
98
|
-
registry.registerAll(...generatedTools);
|
|
99
|
-
\`\`\`
|
|
100
|
-
|
|
101
|
-
## Documentation
|
|
102
|
-
|
|
103
|
-
See: [OpenAPI Generator](https://mcp-fusion.vinkius.com/openapi-gen)
|
|
77
|
+
return `# OpenAPI Generator Setup
|
|
78
|
+
|
|
79
|
+
This project is configured for the **Legacy API Proxy** ingestion vector.
|
|
80
|
+
|
|
81
|
+
## Steps
|
|
82
|
+
|
|
83
|
+
1. Replace \`openapi.yaml\` with your actual OpenAPI 3.x spec
|
|
84
|
+
|
|
85
|
+
2. Generate the MCP server from the spec:
|
|
86
|
+
\`\`\`bash
|
|
87
|
+
npx @vinkius-core/mcp-fusion-openapi-gen ./openapi.yaml --outDir ./src/generated
|
|
88
|
+
\`\`\`
|
|
89
|
+
|
|
90
|
+
3. The generator creates:
|
|
91
|
+
- Presenters with Zod schemas (Egress Firewall)
|
|
92
|
+
- Tool builders with typed handlers
|
|
93
|
+
- Registry setup with all endpoints
|
|
94
|
+
|
|
95
|
+
4. Import and register in \`src/server.ts\`:
|
|
96
|
+
\`\`\`typescript
|
|
97
|
+
import { generatedTools } from './generated/registry.js';
|
|
98
|
+
registry.registerAll(...generatedTools);
|
|
99
|
+
\`\`\`
|
|
100
|
+
|
|
101
|
+
## Documentation
|
|
102
|
+
|
|
103
|
+
See: [OpenAPI Generator](https://mcp-fusion.vinkius.com/openapi-gen)
|
|
104
104
|
`;
|
|
105
105
|
}
|
|
106
106
|
//# sourceMappingURL=openapi.js.map
|
|
@@ -66,8 +66,15 @@ function compileFlat(builders, separator) {
|
|
|
66
66
|
tools.push(builder.buildToolDefinition());
|
|
67
67
|
continue;
|
|
68
68
|
}
|
|
69
|
+
const isSingleAction = actions.length === 1;
|
|
69
70
|
for (const action of actions) {
|
|
70
|
-
|
|
71
|
+
// Single-action builders with 'default' key use bare tool name
|
|
72
|
+
// (no _default suffix). This covers standalone f.query/f.mutation/f.action
|
|
73
|
+
// tools created via the Fluent API which always use 'default' as the key.
|
|
74
|
+
// Multi-action builders and named single actions retain toolName_actionKey.
|
|
75
|
+
const flatName = (isSingleAction && action.key === 'default')
|
|
76
|
+
? toolName
|
|
77
|
+
: `${toolName}${separator}${action.key}`;
|
|
71
78
|
// ── Schema Purification ──────────────────────────
|
|
72
79
|
const inputSchema = buildAtomicSchema(action, commonSchema, selectEnabled);
|
|
73
80
|
// ── Boundary Isolation (Annotations) ─────────────
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpositionCompiler.js","sourceRoot":"","sources":["../../src/exposition/ExpositionCompiler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAwB,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAoC,MAAM,KAAK,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAyC,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAuB,MAAM,YAAY,CAAC;AAkCjD,4DAA4D;AAE5D;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB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C,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,GAAG,QAAQ,MAAM,WAAW,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,wCAAwC;IACxC,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;QACrB,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QAClB,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC;AAED,4DAA4D;AAE5D;;;GAGG;AACH,SAAS,iBAAiB,CACtB,OAA8B;IAE9B,OAAO,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;AAClC,CAAC;AAED;;;GAGG;AACH,SAAS,uBAAuB,CAAW,OAA8B;IACrE,OAAO,OAAO,CAAC,gBAAgB,EAAE,EAAE,IAAI,QAAQ,CAAC;AACpD,CAAC;AAED;;;GAGG;AACH,SAAS,sBAAsB,CAAW,OAA8B;IACpE,OAAO,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;AACvC,CAAC;AAED;;;GAGG;AACF,SAAS,uBAAuB,CAAW,OAA8B;IACtE,OAAO,OAAO,CAAC,gBAAgB,EAAE,EAAE,IAAI,KAAK,CAAC;AACjD,CAAC"}
|
|
@@ -62,57 +62,57 @@ export function createProbe(toolName, actionKey, input, expectedOutput, actualOu
|
|
|
62
62
|
* @returns Complete evaluation prompt
|
|
63
63
|
*/
|
|
64
64
|
export function buildJudgePrompt(probe) {
|
|
65
|
-
return `You are a semantic evaluation judge for an MCP (Model Context Protocol) tool.
|
|
66
|
-
|
|
67
|
-
Your task is to compare two outputs from the same tool handler and determine:
|
|
68
|
-
1. Whether they are semantically equivalent
|
|
69
|
-
2. Whether the current output violates the tool's behavioral contract
|
|
70
|
-
|
|
71
|
-
## Tool Information
|
|
72
|
-
- **Tool**: ${probe.toolName}
|
|
73
|
-
- **Action**: ${probe.actionKey}
|
|
74
|
-
- **Description**: ${probe.contractContext.description ?? 'No description'}
|
|
75
|
-
- **Read-Only**: ${probe.contractContext.readOnly}
|
|
76
|
-
- **Destructive**: ${probe.contractContext.destructive}
|
|
77
|
-
|
|
78
|
-
## Behavioral Contract
|
|
65
|
+
return `You are a semantic evaluation judge for an MCP (Model Context Protocol) tool.
|
|
66
|
+
|
|
67
|
+
Your task is to compare two outputs from the same tool handler and determine:
|
|
68
|
+
1. Whether they are semantically equivalent
|
|
69
|
+
2. Whether the current output violates the tool's behavioral contract
|
|
70
|
+
|
|
71
|
+
## Tool Information
|
|
72
|
+
- **Tool**: ${probe.toolName}
|
|
73
|
+
- **Action**: ${probe.actionKey}
|
|
74
|
+
- **Description**: ${probe.contractContext.description ?? 'No description'}
|
|
75
|
+
- **Read-Only**: ${probe.contractContext.readOnly}
|
|
76
|
+
- **Destructive**: ${probe.contractContext.destructive}
|
|
77
|
+
|
|
78
|
+
## Behavioral Contract
|
|
79
79
|
${probe.contractContext.systemRules.length > 0
|
|
80
80
|
? `### System Rules\n${probe.contractContext.systemRules.map((r, i) => `${i + 1}. ${r}`).join('\n')}`
|
|
81
|
-
: 'No system rules declared.'}
|
|
82
|
-
|
|
83
|
-
### Expected Output Schema Fields
|
|
84
|
-
${probe.contractContext.schemaKeys.join(', ') || 'No schema declared'}
|
|
85
|
-
|
|
86
|
-
## Input Arguments
|
|
87
|
-
\`\`\`json
|
|
88
|
-
${JSON.stringify(probe.input, null, 2)}
|
|
89
|
-
\`\`\`
|
|
90
|
-
|
|
91
|
-
## Expected Output (Baseline)
|
|
92
|
-
\`\`\`json
|
|
93
|
-
${JSON.stringify(probe.expectedOutput, null, 2)}
|
|
94
|
-
\`\`\`
|
|
95
|
-
|
|
96
|
-
## Actual Output (Current)
|
|
97
|
-
\`\`\`json
|
|
98
|
-
${JSON.stringify(probe.actualOutput, null, 2)}
|
|
99
|
-
\`\`\`
|
|
100
|
-
|
|
101
|
-
## Evaluation Instructions
|
|
102
|
-
Compare the Expected Output with the Actual Output. Consider:
|
|
103
|
-
- Are the outputs semantically equivalent (same meaning, even if format differs)?
|
|
104
|
-
- Does the Actual Output violate any system rules?
|
|
105
|
-
- Does the Actual Output return fields not in the expected schema?
|
|
106
|
-
- Has the behavior meaningfully changed from the baseline?
|
|
107
|
-
|
|
108
|
-
Respond with ONLY a JSON object in this exact format:
|
|
109
|
-
\`\`\`json
|
|
110
|
-
{
|
|
111
|
-
"similarityScore": <number 0.0-1.0>,
|
|
112
|
-
"contractViolated": <boolean>,
|
|
113
|
-
"violations": [<string descriptions of violations>],
|
|
114
|
-
"reasoning": "<brief explanation of your assessment>"
|
|
115
|
-
}
|
|
81
|
+
: 'No system rules declared.'}
|
|
82
|
+
|
|
83
|
+
### Expected Output Schema Fields
|
|
84
|
+
${probe.contractContext.schemaKeys.join(', ') || 'No schema declared'}
|
|
85
|
+
|
|
86
|
+
## Input Arguments
|
|
87
|
+
\`\`\`json
|
|
88
|
+
${JSON.stringify(probe.input, null, 2)}
|
|
89
|
+
\`\`\`
|
|
90
|
+
|
|
91
|
+
## Expected Output (Baseline)
|
|
92
|
+
\`\`\`json
|
|
93
|
+
${JSON.stringify(probe.expectedOutput, null, 2)}
|
|
94
|
+
\`\`\`
|
|
95
|
+
|
|
96
|
+
## Actual Output (Current)
|
|
97
|
+
\`\`\`json
|
|
98
|
+
${JSON.stringify(probe.actualOutput, null, 2)}
|
|
99
|
+
\`\`\`
|
|
100
|
+
|
|
101
|
+
## Evaluation Instructions
|
|
102
|
+
Compare the Expected Output with the Actual Output. Consider:
|
|
103
|
+
- Are the outputs semantically equivalent (same meaning, even if format differs)?
|
|
104
|
+
- Does the Actual Output violate any system rules?
|
|
105
|
+
- Does the Actual Output return fields not in the expected schema?
|
|
106
|
+
- Has the behavior meaningfully changed from the baseline?
|
|
107
|
+
|
|
108
|
+
Respond with ONLY a JSON object in this exact format:
|
|
109
|
+
\`\`\`json
|
|
110
|
+
{
|
|
111
|
+
"similarityScore": <number 0.0-1.0>,
|
|
112
|
+
"contractViolated": <boolean>,
|
|
113
|
+
"violations": [<string descriptions of violations>],
|
|
114
|
+
"reasoning": "<brief explanation of your assessment>"
|
|
115
|
+
}
|
|
116
116
|
\`\`\``;
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FluentPromptBuilder.d.ts","sourceRoot":"","sources":["../../src/prompt/FluentPromptBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,KAAK,CAAC;AACvD,OAAO,EACH,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,eAAe,EACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOrD;;;;;;;;;GASG;AACH,qBAAa,mBAAmB,CAAC,QAAQ,GAAG,IAAI,EAAE,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC7G,YAAW,aAAa,CAAC,QAAQ,CAAC;IAElC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,MAAM,CAAC,CAAoC;IACnD,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,YAAY,CAAgC;IACpD,OAAO,CAAC,KAAK,CAAC,CAA2C;IACzD,OAAO,CAAC,iBAAiB,CAAC,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,CAA0E;IAE3F,+EAA+E;IAC/E,OAAO,CAAC,SAAS,CAAsC;gBAE3C,IAAI,EAAE,MAAM;IAM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