@vinkius-core/mcp-fusion 2.11.1 → 2.13.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.
Files changed (149) hide show
  1. package/dist/cli/fusion.d.ts +3 -0
  2. package/dist/cli/fusion.d.ts.map +1 -1
  3. package/dist/cli/fusion.js +150 -28
  4. package/dist/cli/fusion.js.map +1 -1
  5. package/dist/cli/templates/config.js +29 -29
  6. package/dist/cli/templates/config.js.map +1 -1
  7. package/dist/cli/templates/constants.d.ts +1 -1
  8. package/dist/cli/templates/constants.d.ts.map +1 -1
  9. package/dist/cli/templates/constants.js +1 -1
  10. package/dist/cli/templates/constants.js.map +1 -1
  11. package/dist/cli/templates/core.js +111 -111
  12. package/dist/cli/templates/middleware.d.ts +1 -1
  13. package/dist/cli/templates/middleware.d.ts.map +1 -1
  14. package/dist/cli/templates/middleware.js +26 -23
  15. package/dist/cli/templates/middleware.js.map +1 -1
  16. package/dist/cli/templates/readme.d.ts.map +1 -1
  17. package/dist/cli/templates/readme.js +142 -146
  18. package/dist/cli/templates/readme.js.map +1 -1
  19. package/dist/cli/templates/testing.js +83 -83
  20. package/dist/cli/templates/tools.d.ts +4 -0
  21. package/dist/cli/templates/tools.d.ts.map +1 -1
  22. package/dist/cli/templates/tools.js +50 -53
  23. package/dist/cli/templates/tools.js.map +1 -1
  24. package/dist/cli/templates/vectors/database.d.ts.map +1 -1
  25. package/dist/cli/templates/vectors/database.js +69 -74
  26. package/dist/cli/templates/vectors/database.js.map +1 -1
  27. package/dist/cli/templates/vectors/oauth.d.ts.map +1 -1
  28. package/dist/cli/templates/vectors/oauth.js +63 -64
  29. package/dist/cli/templates/vectors/oauth.js.map +1 -1
  30. package/dist/cli/templates/vectors/openapi.js +97 -97
  31. package/dist/cli/templates/vectors/workflow.js +1 -1
  32. package/dist/cli/templates/vectors/workflow.js.map +1 -1
  33. package/dist/client/FusionClient.d.ts +55 -0
  34. package/dist/client/FusionClient.d.ts.map +1 -1
  35. package/dist/client/FusionClient.js +30 -0
  36. package/dist/client/FusionClient.js.map +1 -1
  37. package/dist/client/index.d.ts +1 -1
  38. package/dist/client/index.d.ts.map +1 -1
  39. package/dist/client/index.js.map +1 -1
  40. package/dist/core/builder/ActionGroupBuilder.d.ts +86 -46
  41. package/dist/core/builder/ActionGroupBuilder.d.ts.map +1 -1
  42. package/dist/core/builder/ActionGroupBuilder.js +68 -26
  43. package/dist/core/builder/ActionGroupBuilder.js.map +1 -1
  44. package/dist/core/builder/ErrorBuilder.d.ts +59 -0
  45. package/dist/core/builder/ErrorBuilder.d.ts.map +1 -0
  46. package/dist/core/builder/ErrorBuilder.js +99 -0
  47. package/dist/core/builder/ErrorBuilder.js.map +1 -0
  48. package/dist/core/builder/FluentRouter.d.ts +91 -0
  49. package/dist/core/builder/FluentRouter.d.ts.map +1 -0
  50. package/dist/core/builder/FluentRouter.js +121 -0
  51. package/dist/core/builder/FluentRouter.js.map +1 -0
  52. package/dist/core/builder/FluentSchemaHelpers.d.ts +237 -0
  53. package/dist/core/builder/FluentSchemaHelpers.d.ts.map +1 -0
  54. package/dist/core/builder/FluentSchemaHelpers.js +227 -0
  55. package/dist/core/builder/FluentSchemaHelpers.js.map +1 -0
  56. package/dist/core/builder/FluentToolBuilder.d.ts +377 -0
  57. package/dist/core/builder/FluentToolBuilder.d.ts.map +1 -0
  58. package/dist/core/builder/FluentToolBuilder.js +568 -0
  59. package/dist/core/builder/FluentToolBuilder.js.map +1 -0
  60. package/dist/core/builder/GroupedToolBuilder.d.ts +77 -1
  61. package/dist/core/builder/GroupedToolBuilder.d.ts.map +1 -1
  62. package/dist/core/builder/GroupedToolBuilder.js +101 -0
  63. package/dist/core/builder/GroupedToolBuilder.js.map +1 -1
  64. package/dist/core/builder/index.d.ts +4 -0
  65. package/dist/core/builder/index.d.ts.map +1 -1
  66. package/dist/core/builder/index.js +7 -0
  67. package/dist/core/builder/index.js.map +1 -1
  68. package/dist/core/execution/EgressGuard.js +1 -1
  69. package/dist/core/execution/EgressGuard.js.map +1 -1
  70. package/dist/core/execution/PipelineHooks.d.ts +0 -6
  71. package/dist/core/execution/PipelineHooks.d.ts.map +1 -1
  72. package/dist/core/execution/PipelineHooks.js +7 -3
  73. package/dist/core/execution/PipelineHooks.js.map +1 -1
  74. package/dist/core/index.d.ts +6 -7
  75. package/dist/core/index.d.ts.map +1 -1
  76. package/dist/core/index.js +2 -4
  77. package/dist/core/index.js.map +1 -1
  78. package/dist/core/initFusion.d.ts +139 -86
  79. package/dist/core/initFusion.d.ts.map +1 -1
  80. package/dist/core/initFusion.js +60 -65
  81. package/dist/core/initFusion.js.map +1 -1
  82. package/dist/core/types.d.ts +17 -0
  83. package/dist/core/types.d.ts.map +1 -1
  84. package/dist/index.d.ts +8 -3
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js +8 -2
  87. package/dist/index.js.map +1 -1
  88. package/dist/introspection/CryptoAttestation.d.ts.map +1 -1
  89. package/dist/introspection/CryptoAttestation.js +6 -2
  90. package/dist/introspection/CryptoAttestation.js.map +1 -1
  91. package/dist/introspection/SemanticProbe.js +49 -49
  92. package/dist/introspection/canonicalize.d.ts.map +1 -1
  93. package/dist/introspection/canonicalize.js +8 -2
  94. package/dist/introspection/canonicalize.js.map +1 -1
  95. package/dist/presenter/PostProcessor.d.ts +1 -1
  96. package/dist/presenter/PostProcessor.d.ts.map +1 -1
  97. package/dist/presenter/PostProcessor.js +6 -7
  98. package/dist/presenter/PostProcessor.js.map +1 -1
  99. package/dist/presenter/Presenter.d.ts +94 -1
  100. package/dist/presenter/Presenter.d.ts.map +1 -1
  101. package/dist/presenter/Presenter.js +95 -25
  102. package/dist/presenter/Presenter.js.map +1 -1
  103. package/dist/presenter/index.d.ts +2 -0
  104. package/dist/presenter/index.d.ts.map +1 -1
  105. package/dist/presenter/index.js +4 -0
  106. package/dist/presenter/index.js.map +1 -1
  107. package/dist/presenter/suggest.d.ts +39 -0
  108. package/dist/presenter/suggest.d.ts.map +1 -0
  109. package/dist/presenter/suggest.js +41 -0
  110. package/dist/presenter/suggest.js.map +1 -0
  111. package/dist/presenter/typeHelpers.d.ts +147 -0
  112. package/dist/presenter/typeHelpers.d.ts.map +1 -0
  113. package/dist/presenter/typeHelpers.js +152 -0
  114. package/dist/presenter/typeHelpers.js.map +1 -0
  115. package/dist/prompt/FluentPromptBuilder.d.ts +155 -0
  116. package/dist/prompt/FluentPromptBuilder.d.ts.map +1 -0
  117. package/dist/prompt/FluentPromptBuilder.js +193 -0
  118. package/dist/prompt/FluentPromptBuilder.js.map +1 -0
  119. package/dist/prompt/index.d.ts +1 -0
  120. package/dist/prompt/index.d.ts.map +1 -1
  121. package/dist/prompt/index.js +1 -0
  122. package/dist/prompt/index.js.map +1 -1
  123. package/dist/sandbox/SandboxEngine.d.ts +188 -0
  124. package/dist/sandbox/SandboxEngine.d.ts.map +1 -0
  125. package/dist/sandbox/SandboxEngine.js +290 -0
  126. package/dist/sandbox/SandboxEngine.js.map +1 -0
  127. package/dist/sandbox/SandboxGuard.d.ts +47 -0
  128. package/dist/sandbox/SandboxGuard.d.ts.map +1 -0
  129. package/dist/sandbox/SandboxGuard.js +90 -0
  130. package/dist/sandbox/SandboxGuard.js.map +1 -0
  131. package/dist/sandbox/index.d.ts +23 -0
  132. package/dist/sandbox/index.d.ts.map +1 -0
  133. package/dist/sandbox/index.js +26 -0
  134. package/dist/sandbox/index.js.map +1 -0
  135. package/dist/server/DevServer.js +8 -8
  136. package/dist/server/DevServer.js.map +1 -1
  137. package/dist/server/ServerAttachment.d.ts.map +1 -1
  138. package/dist/server/ServerAttachment.js +54 -1
  139. package/dist/server/ServerAttachment.js.map +1 -1
  140. package/dist/state-sync/ResponseDecorator.d.ts +1 -1
  141. package/dist/state-sync/StateSyncBuilder.d.ts +75 -0
  142. package/dist/state-sync/StateSyncBuilder.d.ts.map +1 -0
  143. package/dist/state-sync/StateSyncBuilder.js +123 -0
  144. package/dist/state-sync/StateSyncBuilder.js.map +1 -0
  145. package/dist/state-sync/index.d.ts +1 -0
  146. package/dist/state-sync/index.d.ts.map +1 -1
  147. package/dist/state-sync/index.js +1 -0
  148. package/dist/state-sync/index.js.map +1 -1
  149. package/package.json +126 -118
@@ -1,130 +1,130 @@
1
1
  /** Generate `src/fusion.ts` — The one-file context center */
2
2
  export function fusionTs() {
3
- return `/**
4
- * Fusion Instance — Context Initialization
5
- *
6
- * Define your context type ONCE. Every f.tool(), f.presenter(),
7
- * f.prompt(), and f.middleware() call inherits AppContext —
8
- * zero generic repetition anywhere in the codebase.
9
- */
10
- import { initFusion } from '@vinkius-core/mcp-fusion';
11
- import type { AppContext } from './context.js';
12
-
13
- export const f = initFusion<AppContext>();
3
+ return `/**
4
+ * Fusion Instance — Context Initialization
5
+ *
6
+ * Define your context type ONCE. Every f.query(), f.mutation(),
7
+ * f.presenter(), f.prompt(), and f.middleware() call inherits
8
+ * AppContext — zero generic repetition anywhere in the codebase.
9
+ */
10
+ import { initFusion } from '@vinkius-core/mcp-fusion';
11
+ import type { AppContext } from './context.js';
12
+
13
+ export const f = initFusion<AppContext>();
14
14
  `;
15
15
  }
16
16
  /** Generate `src/context.ts` — Application context type + factory */
17
17
  export function contextTs() {
18
- return `/**
19
- * Application Context — Shared State for Every Tool Handler
20
- *
21
- * Every f.tool() handler receives { input, ctx } where ctx
22
- * is this AppContext. Extend it with your own services
23
- * (DB client, auth, external APIs, etc.)
24
- */
25
-
26
- export interface AppContext {
27
- /** Current user role for RBAC checks */
28
- role: 'ADMIN' | 'USER' | 'GUEST';
29
-
30
- /** Tenant identifier (multi-tenancy) */
31
- tenantId: string;
32
- }
33
-
34
- /**
35
- * Create the application context for each tool invocation.
36
- *
37
- * In production, hydrate this from the MCP session metadata,
38
- * JWT tokens, or environment variables.
39
- */
40
- export function createContext(): AppContext {
41
- return {
42
- role: 'ADMIN',
43
- tenantId: 'default',
44
- };
45
- }
18
+ return `/**
19
+ * Application Context — Shared State for Every Tool Handler
20
+ *
21
+ * Every f.query() / f.mutation() handler receives (input, ctx)
22
+ * where ctx is this AppContext. Extend it with your own services
23
+ * (DB client, auth, external APIs, etc.)
24
+ */
25
+
26
+ export interface AppContext {
27
+ /** Current user role for RBAC checks */
28
+ role: 'ADMIN' | 'USER' | 'GUEST';
29
+
30
+ /** Tenant identifier (multi-tenancy) */
31
+ tenantId: string;
32
+ }
33
+
34
+ /**
35
+ * Create the application context for each tool invocation.
36
+ *
37
+ * In production, hydrate this from the MCP session metadata,
38
+ * JWT tokens, or environment variables.
39
+ */
40
+ export function createContext(): AppContext {
41
+ return {
42
+ role: 'ADMIN',
43
+ tenantId: 'default',
44
+ };
45
+ }
46
46
  `;
47
47
  }
48
48
  /** Generate `src/server.ts` — Bootstrap with autoDiscover + transport */
49
49
  export function serverTs(config) {
50
50
  const transportImport = config.transport === 'stdio'
51
51
  ? `import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';`
52
- : `import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
52
+ : `import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
53
53
  import { createServer } from 'node:http';`;
54
54
  const transportSetup = config.transport === 'stdio'
55
- ? `
56
- // ── Transport ────────────────────────────────────────────
57
- const transport = new StdioServerTransport();
58
- await server.connect(transport);
55
+ ? `
56
+ // ── Transport ────────────────────────────────────────────
57
+ const transport = new StdioServerTransport();
58
+ await server.connect(transport);
59
59
  console.error('⚡ MCP Fusion server running on stdio');`
60
- : `
61
- // ── Transport ────────────────────────────────────────────
62
- const PORT = Number(process.env['PORT'] ?? 3001);
63
- const transports = new Map<string, SSEServerTransport>();
64
-
65
- const httpServer = createServer(async (req, res) => {
66
- if (req.method === 'GET' && req.url === '/sse') {
67
- const sseTransport = new SSEServerTransport('/mcp/messages', res);
68
- transports.set(sseTransport.sessionId, sseTransport);
69
- res.on('close', () => transports.delete(sseTransport.sessionId));
70
- await server.connect(sseTransport);
71
- } else if (req.method === 'POST' && req.url?.startsWith('/mcp/messages')) {
72
- const url = new URL(req.url, \`http://localhost:\${PORT}\`);
73
- const sessionId = url.searchParams.get('sessionId') ?? '';
74
- const transport = transports.get(sessionId);
75
- if (transport) {
76
- await transport.handlePostMessage(req, res);
77
- } else {
78
- res.writeHead(400).end('Unknown session');
79
- }
80
- } else {
81
- res.writeHead(404).end();
82
- }
83
- });
84
-
85
- httpServer.listen(PORT, () => {
86
- console.error(\`⚡ MCP Fusion SSE server on http://localhost:\${PORT}/sse\`);
60
+ : `
61
+ // ── Transport ────────────────────────────────────────────
62
+ const PORT = Number(process.env['PORT'] ?? 3001);
63
+ const transports = new Map<string, SSEServerTransport>();
64
+
65
+ const httpServer = createServer(async (req, res) => {
66
+ if (req.method === 'GET' && req.url === '/sse') {
67
+ const sseTransport = new SSEServerTransport('/mcp/messages', res);
68
+ transports.set(sseTransport.sessionId, sseTransport);
69
+ res.on('close', () => transports.delete(sseTransport.sessionId));
70
+ await server.connect(sseTransport);
71
+ } else if (req.method === 'POST' && req.url?.startsWith('/mcp/messages')) {
72
+ const url = new URL(req.url, \`http://localhost:\${PORT}\`);
73
+ const sessionId = url.searchParams.get('sessionId') ?? '';
74
+ const transport = transports.get(sessionId);
75
+ if (transport) {
76
+ await transport.handlePostMessage(req, res);
77
+ } else {
78
+ res.writeHead(400).end('Unknown session');
79
+ }
80
+ } else {
81
+ res.writeHead(404).end();
82
+ }
83
+ });
84
+
85
+ httpServer.listen(PORT, () => {
86
+ console.error(\`⚡ MCP Fusion SSE server on http://localhost:\${PORT}/sse\`);
87
87
  });`;
88
- return `/**
89
- * Server Bootstrap — MCP Fusion with autoDiscover
90
- *
91
- * Tools are auto-discovered from src/tools/ — drop a file,
92
- * it becomes a tool. No manual imports or registration needed.
93
- */
94
- import { Server } from '@modelcontextprotocol/sdk/server/index.js';
95
- ${transportImport}
96
- import { ToolRegistry, autoDiscover, PromptRegistry } from '@vinkius-core/mcp-fusion';
97
- import type { AppContext } from './context.js';
98
- import { createContext } from './context.js';
99
- import { f } from './fusion.js';
100
- import { GreetPrompt } from './prompts/greet.js';
101
-
102
- // ── Registries ───────────────────────────────────────────
103
- const registry = f.registry();
104
- const prompts = new PromptRegistry<AppContext>();
105
-
106
- // ── Auto-Discover Tools ──────────────────────────────────
107
- const discovered = await autoDiscover(registry, new URL('./tools', import.meta.url).pathname);
108
- console.error(\`📦 Discovered \${discovered.length} tool file(s)\`);
109
-
110
- // ── Register Prompts ─────────────────────────────────────
111
- prompts.register(GreetPrompt);
112
- console.error(\`💬 Registered \${prompts.size} prompt(s)\`);
113
-
114
- // ── Server ───────────────────────────────────────────────
115
- const server = new Server(
116
- { name: '${config.name}', version: '0.1.0' },
117
- { capabilities: { tools: {}, prompts: {} } },
118
- );
119
-
120
- registry.attachToServer(server, {
121
- contextFactory: () => createContext(),
122
- });
123
-
124
- prompts.attachToServer(server, {
125
- contextFactory: () => createContext(),
126
- });
127
- ${transportSetup}
88
+ return `/**
89
+ * Server Bootstrap — MCP Fusion with autoDiscover
90
+ *
91
+ * Tools are auto-discovered from src/tools/ — drop a file,
92
+ * it becomes a tool. No manual imports or registration needed.
93
+ */
94
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
95
+ ${transportImport}
96
+ import { ToolRegistry, autoDiscover, PromptRegistry } from '@vinkius-core/mcp-fusion';
97
+ import type { AppContext } from './context.js';
98
+ import { createContext } from './context.js';
99
+ import { f } from './fusion.js';
100
+ import { GreetPrompt } from './prompts/greet.js';
101
+
102
+ // ── Registries ───────────────────────────────────────────
103
+ const registry = f.registry();
104
+ const prompts = new PromptRegistry<AppContext>();
105
+
106
+ // ── Auto-Discover Tools ──────────────────────────────────
107
+ const discovered = await autoDiscover(registry, new URL('./tools', import.meta.url).pathname);
108
+ console.error(\`📦 Discovered \${discovered.length} tool file(s)\`);
109
+
110
+ // ── Register Prompts ─────────────────────────────────────
111
+ prompts.register(GreetPrompt);
112
+ console.error(\`💬 Registered \${prompts.size} prompt(s)\`);
113
+
114
+ // ── Server ───────────────────────────────────────────────
115
+ const server = new Server(
116
+ { name: '${config.name}', version: '0.1.0' },
117
+ { capabilities: { tools: {}, prompts: {} } },
118
+ );
119
+
120
+ registry.attachToServer(server, {
121
+ contextFactory: () => createContext(),
122
+ });
123
+
124
+ prompts.attachToServer(server, {
125
+ contextFactory: () => createContext(),
126
+ });
127
+ ${transportSetup}
128
128
  `;
129
129
  }
130
130
  //# sourceMappingURL=core.js.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Middleware Template — RBAC guard example
2
+ * Middleware Template — RBAC guard example (Fluent API)
3
3
  * @module
4
4
  */
5
5
  /** Generate `src/middleware/auth.ts` — RBAC middleware */
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../../src/cli/templates/middleware.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0DAA0D;AAC1D,wBAAgB,gBAAgB,IAAI,MAAM,CAwBzC"}
1
+ {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../../src/cli/templates/middleware.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0DAA0D;AAC1D,wBAAgB,gBAAgB,IAAI,MAAM,CA2BzC"}
@@ -1,31 +1,34 @@
1
1
  /**
2
- * Middleware Template — RBAC guard example
2
+ * Middleware Template — RBAC guard example (Fluent API)
3
3
  * @module
4
4
  */
5
5
  /** Generate `src/middleware/auth.ts` — RBAC middleware */
6
6
  export function authMiddlewareTs() {
7
- return `/**
8
- * Auth Middleware — RBAC Guard
9
- *
10
- * Demonstrates middleware with tRPC-style context derivation.
11
- * Rejects GUEST requests with a structured error.
12
- *
13
- * In production, replace this with JWT validation,
14
- * API key checks, or OAuth token verification.
15
- */
16
- import { error } from '@vinkius-core/mcp-fusion';
17
- import type { AppContext } from '../context.js';
18
-
19
- export async function authGuard<TArgs>(
20
- ctx: AppContext,
21
- _args: TArgs,
22
- next: () => Promise<unknown>,
23
- ): Promise<unknown> {
24
- if (ctx.role === 'GUEST') {
25
- return error('Access denied. Authentication required.');
26
- }
27
- return next();
28
- }
7
+ return `/**
8
+ * Auth Middleware — RBAC Guard (Fluent API)
9
+ *
10
+ * Demonstrates f.middleware() tRPC-style context derivation.
11
+ * Rejects GUEST requests with a structured error.
12
+ *
13
+ * Usage in tools:
14
+ * f.query('users.list')
15
+ * .use(withAuth)
16
+ * .handle(async (input, ctx) => {
17
+ * // ctx now has ctx.role guaranteed non-GUEST
18
+ * });
19
+ *
20
+ * In production, replace with JWT validation,
21
+ * API key checks, or OAuth token verification.
22
+ */
23
+ import { f } from '../fusion.js';
24
+ import { error } from '@vinkius-core/mcp-fusion';
25
+
26
+ export const withAuth = f.middleware(async (ctx) => {
27
+ if (ctx.role === 'GUEST') {
28
+ throw error('Access denied. Authentication required.');
29
+ }
30
+ return { verified: true as const };
31
+ });
29
32
  `;
30
33
  }
31
34
  //# sourceMappingURL=middleware.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../../src/cli/templates/middleware.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0DAA0D;AAC1D,MAAM,UAAU,gBAAgB;IAC5B,OAAO;;;;;;;;;;;;;;;;;;;;;;CAsBV,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../../src/cli/templates/middleware.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0DAA0D;AAC1D,MAAM,UAAU,gBAAgB;IAC5B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;CAyBV,CAAC;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"readme.d.ts","sourceRoot":"","sources":["../../../src/cli/templates/readme.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,8DAA8D;AAC9D,wBAAgB,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAiGpD"}
1
+ {"version":3,"file":"readme.d.ts","sourceRoot":"","sources":["../../../src/cli/templates/readme.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,8DAA8D;AAC9D,wBAAgB,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CA4FpD"}
@@ -11,164 +11,160 @@ export function readme(config) {
11
11
  const sseNote = config.transport === 'sse'
12
12
  ? `\n> **Note:** SSE transport requires the server to be running first. Run \\\`npm start\\\` before connecting.`
13
13
  : '';
14
- return `# ${config.name}
15
-
16
- MCP Server built with [MCP Fusion](https://mcp-fusion.vinkius.com/) — the MVA framework for the Model Context Protocol.
17
-
18
- ## Quick Start
19
-
20
- \`\`\`bash
21
- npm install
22
- ${config.transport === 'sse' ? 'npm start' : 'npm run dev'}
23
- \`\`\`
24
- ${config.testing ? `
25
- ## Testing
26
-
27
- \`\`\`bash
28
- npm test
29
- \`\`\`
30
- ` : ''}
31
- ## Project Structure
32
-
33
- \`\`\`
34
- src/
35
- ├── fusion.ts # initFusion<AppContext>() — context center
36
- ├── context.ts # AppContext type + factory
37
- ├── server.ts # Bootstrap with autoDiscover
38
- ├── tools/ # Drop a file → it's a tool (autoDiscover)
39
- │ └── system/
40
- │ ├── health.ts # Health check with Presenter
41
- │ └── echo.ts # Echo for connectivity testing
42
- ├── presenters/ # MVA View Layer (Egress Firewall)
43
- │ └── SystemPresenter.ts
44
- ├── prompts/ # MCP Prompt Engine
45
- │ └── greet.ts
46
- └── middleware/ # RBAC guards
47
- └── auth.ts
48
- \`\`\`
49
-
50
- ## Client Configuration
51
-
52
- ### Cursor Editor
53
-
54
- > **Already configured!** The \`.cursor/mcp.json\` file was generated automatically.
55
- > Just open this folder in Cursor and the server connects instantly.
56
- ${sseNote}
57
-
58
- ### Claude Desktop
59
-
60
- Add to your \`claude_desktop_config.json\`:
61
-
62
- \`\`\`json
63
- ${clientConfig}
64
- \`\`\`
65
- ${vectorReadmeSection(config)}
66
- ## Adding New Tools
67
-
68
- Create a new file in \`src/tools/\`. It's automatically discovered:
69
-
70
- \`\`\`typescript
71
- // src/tools/my-domain/my-tool.ts
72
- import { f } from '../../fusion.js';
73
- import { success } from '@vinkius-core/mcp-fusion';
74
-
75
- export default f.tool({
76
- name: 'my_domain.my_tool',
77
- description: 'What this tool does',
78
- input: {
79
- query: { type: 'string', description: 'Search query' },
80
- },
81
- handler: async ({ input, ctx }) => {
82
- return success({ result: input.query });
83
- },
84
- });
85
- \`\`\`
86
-
87
- No registration needed. The \`autoDiscover()\` system picks it up automatically.
88
-
89
- ## Documentation
90
-
91
- - [MCP Fusion Docs](https://mcp-fusion.vinkius.com/)
92
- - [Presenter — Egress Firewall](https://mcp-fusion.vinkius.com/presenter)
93
- - [DX Guide — initFusion()](https://mcp-fusion.vinkius.com/dx-guide)
94
- - [Testing](https://mcp-fusion.vinkius.com/testing)
14
+ return `# ${config.name}
15
+
16
+ MCP Server built with [MCP Fusion](https://mcp-fusion.vinkius.com/) — the MVA framework for the Model Context Protocol.
17
+
18
+ ## Quick Start
19
+
20
+ \`\`\`bash
21
+ npm install
22
+ ${config.transport === 'sse' ? 'npm start' : 'npm run dev'}
23
+ \`\`\`
24
+ ${config.testing ? `
25
+ ## Testing
26
+
27
+ \`\`\`bash
28
+ npm test
29
+ \`\`\`
30
+ ` : ''}
31
+ ## Project Structure
32
+
33
+ \`\`\`
34
+ src/
35
+ ├── fusion.ts # initFusion<AppContext>() — context center
36
+ ├── context.ts # AppContext type + factory
37
+ ├── server.ts # Bootstrap with autoDiscover
38
+ ├── tools/ # Drop a file → it's a tool (autoDiscover)
39
+ │ └── system/
40
+ │ ├── health.ts # Health check with Presenter
41
+ │ └── echo.ts # Echo for connectivity testing
42
+ ├── presenters/ # MVA View Layer (Egress Firewall)
43
+ │ └── SystemPresenter.ts
44
+ ├── prompts/ # MCP Prompt Engine
45
+ │ └── greet.ts
46
+ └── middleware/ # RBAC guards
47
+ └── auth.ts
48
+ \`\`\`
49
+
50
+ ## Client Configuration
51
+
52
+ ### Cursor Editor
53
+
54
+ > **Already configured!** The \`.cursor/mcp.json\` file was generated automatically.
55
+ > Just open this folder in Cursor and the server connects instantly.
56
+ ${sseNote}
57
+
58
+ ### Claude Desktop
59
+
60
+ Add to your \`claude_desktop_config.json\`:
61
+
62
+ \`\`\`json
63
+ ${clientConfig}
64
+ \`\`\`
65
+ ${vectorReadmeSection(config)}
66
+ ## Adding New Tools
67
+
68
+ Create a new file in \`src/tools/\`. It's automatically discovered:
69
+
70
+ \`\`\`typescript
71
+ // src/tools/my-domain/my-tool.ts
72
+ import { f } from '../../fusion.js';
73
+
74
+ export default f.query('my_domain.my_tool')
75
+ .describe('What this tool does')
76
+ .withString('query', 'Search query')
77
+ .handle(async (input, ctx) => {
78
+ return { result: input.query };
79
+ });
80
+ \`\`\`
81
+
82
+ No registration needed. The \`autoDiscover()\` system picks it up automatically.
83
+
84
+ ## Documentation
85
+
86
+ - [MCP Fusion Docs](https://mcp-fusion.vinkius.com/)
87
+ - [Presenter Egress Firewall](https://mcp-fusion.vinkius.com/presenter)
88
+ - [DX Guide — initFusion()](https://mcp-fusion.vinkius.com/dx-guide)
89
+ - [Testing](https://mcp-fusion.vinkius.com/testing)
95
90
  `;
96
91
  }
97
92
  /** Vector-specific README section */
98
93
  function vectorReadmeSection(config) {
99
94
  switch (config.vector) {
100
95
  case 'prisma':
101
- return `
102
- ## Database Setup (Prisma)
103
-
104
- 1. Configure your database URL in \`.env\`:
105
- \`\`\`
106
- DATABASE_URL="postgresql://user:password@localhost:5432/mydb"
107
- \`\`\`
108
-
109
- 2. Edit \`prisma/schema.prisma\` to define your models
110
-
111
- 3. Generate the Prisma client and Fusion tools:
112
- \`\`\`bash
113
- npm run db:generate
114
- \`\`\`
115
-
116
- 4. Push the schema to your database:
117
- \`\`\`bash
118
- npm run db:push
119
- \`\`\`
120
-
121
- Use \`/// @fusion.hide\` on sensitive fields to strip them from the Egress Firewall.
96
+ return `
97
+ ## Database Setup (Prisma)
98
+
99
+ 1. Configure your database URL in \`.env\`:
100
+ \`\`\`
101
+ DATABASE_URL="postgresql://user:password@localhost:5432/mydb"
102
+ \`\`\`
103
+
104
+ 2. Edit \`prisma/schema.prisma\` to define your models
105
+
106
+ 3. Generate the Prisma client and Fusion tools:
107
+ \`\`\`bash
108
+ npm run db:generate
109
+ \`\`\`
110
+
111
+ 4. Push the schema to your database:
112
+ \`\`\`bash
113
+ npm run db:push
114
+ \`\`\`
115
+
116
+ Use \`/// @fusion.hide\` on sensitive fields to strip them from the Egress Firewall.
122
117
  `;
123
118
  case 'n8n':
124
- return `
125
- ## n8n Workflow Setup
126
-
127
- 1. Configure your n8n instance in \`.env\`:
128
- \`\`\`
129
- N8N_BASE_URL=http://localhost:5678
130
- N8N_API_KEY=your-api-key
131
- \`\`\`
132
-
133
- 2. The connector in \`src/n8n.ts\` auto-discovers webhook workflows
134
- and registers them as MCP tools.
119
+ return `
120
+ ## n8n Workflow Setup
121
+
122
+ 1. Configure your n8n instance in \`.env\`:
123
+ \`\`\`
124
+ N8N_BASE_URL=http://localhost:5678
125
+ N8N_API_KEY=your-api-key
126
+ \`\`\`
127
+
128
+ 2. The connector in \`src/n8n.ts\` auto-discovers webhook workflows
129
+ and registers them as MCP tools.
135
130
  `;
136
131
  case 'openapi':
137
- return `
138
- ## OpenAPI Generator Setup
139
-
140
- 1. Replace \`openapi.yaml\` with your actual OpenAPI 3.x spec
141
-
142
- 2. Generate the MCP server from the spec:
143
- \`\`\`bash
144
- npx mcp-fusion-openapi-gen ./openapi.yaml --outDir ./src/generated
145
- \`\`\`
146
-
147
- 3. Import and register the generated tools in \`src/server.ts\`
132
+ return `
133
+ ## OpenAPI Generator Setup
134
+
135
+ 1. Replace \`openapi.yaml\` with your actual OpenAPI 3.x spec
136
+
137
+ 2. Generate the MCP server from the spec:
138
+ \`\`\`bash
139
+ npx @vinkius-core/mcp-fusion-openapi-gen ./openapi.yaml --outDir ./src/generated
140
+ \`\`\`
141
+
142
+ 3. Import and register the generated tools in \`src/server.ts\`
148
143
  `;
149
144
  case 'oauth':
150
- return `
151
- ## OAuth Device Flow Setup
152
-
153
- 1. Configure your OAuth provider in \`.env\`:
154
- \`\`\`
155
- OAUTH_CLIENT_ID=your-client-id
156
- OAUTH_AUTH_ENDPOINT=https://api.example.com/oauth/device/code
157
- OAUTH_TOKEN_ENDPOINT=https://api.example.com/oauth/device/token
158
- \`\`\`
159
-
160
- 2. The auth tool in \`src/auth.ts\` is pre-configured with login, complete, status, and logout actions.
161
-
162
- 3. Protect any tool with the \`withAuth\` middleware from \`src/middleware/auth.ts\`:
163
- \`\`\`ts
164
- import { withAuth } from '../middleware/auth.js';
165
-
166
- export default f.tool({
167
- name: 'protected.action',
168
- middleware: [withAuth],
169
- handler: async ({ ctx }) => { /* authenticated */ },
170
- });
171
- \`\`\`
145
+ return `
146
+ ## OAuth Device Flow Setup
147
+
148
+ 1. Configure your OAuth provider in \`.env\`:
149
+ \`\`\`
150
+ OAUTH_CLIENT_ID=your-client-id
151
+ OAUTH_AUTH_ENDPOINT=https://api.example.com/oauth/device/code
152
+ OAUTH_TOKEN_ENDPOINT=https://api.example.com/oauth/device/token
153
+ \`\`\`
154
+
155
+ 2. The auth tool in \`src/auth.ts\` is pre-configured with login, complete, status, and logout actions.
156
+
157
+ 3. Protect any tool with the \`withAuth\` middleware from \`src/middleware/auth.ts\`:
158
+ \`\`\`ts
159
+ import { withAuth } from '../middleware/auth.js';
160
+
161
+ export default f.query('protected.action')
162
+ .describe('A protected query')
163
+ .use(withAuth)
164
+ .handle(async (input, ctx) => {
165
+ // ctx is authenticated
166
+ });
167
+ \`\`\`
172
168
  `;
173
169
  default:
174
170
  return '';
@@ -1 +1 @@
1
- {"version":3,"file":"readme.js","sourceRoot":"","sources":["../../../src/cli/templates/readme.ts"],"names":[],"mappings":"AAMA,8DAA8D;AAC9D,MAAM,UAAU,MAAM,CAAC,MAAqB;IACxC,MAAM,WAAW,GAAG,MAAM,CAAC,SAAS,KAAK,KAAK;QAC1C,CAAC,CAAC,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