@nitrostack/core 1.0.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 (239) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +80 -0
  3. package/dist/auth/api-key.d.ts +118 -0
  4. package/dist/auth/api-key.d.ts.map +1 -0
  5. package/dist/auth/api-key.js +168 -0
  6. package/dist/auth/api-key.js.map +1 -0
  7. package/dist/auth/client.d.ts +151 -0
  8. package/dist/auth/client.d.ts.map +1 -0
  9. package/dist/auth/client.js +330 -0
  10. package/dist/auth/client.js.map +1 -0
  11. package/dist/auth/index.d.ts +31 -0
  12. package/dist/auth/index.d.ts.map +1 -0
  13. package/dist/auth/index.js +46 -0
  14. package/dist/auth/index.js.map +1 -0
  15. package/dist/auth/middleware.d.ts +95 -0
  16. package/dist/auth/middleware.d.ts.map +1 -0
  17. package/dist/auth/middleware.js +260 -0
  18. package/dist/auth/middleware.js.map +1 -0
  19. package/dist/auth/pkce.d.ts +53 -0
  20. package/dist/auth/pkce.d.ts.map +1 -0
  21. package/dist/auth/pkce.js +105 -0
  22. package/dist/auth/pkce.js.map +1 -0
  23. package/dist/auth/quick-setup.d.ts +94 -0
  24. package/dist/auth/quick-setup.d.ts.map +1 -0
  25. package/dist/auth/quick-setup.js +210 -0
  26. package/dist/auth/quick-setup.js.map +1 -0
  27. package/dist/auth/secure-secret.d.ts +136 -0
  28. package/dist/auth/secure-secret.d.ts.map +1 -0
  29. package/dist/auth/secure-secret.js +182 -0
  30. package/dist/auth/secure-secret.js.map +1 -0
  31. package/dist/auth/server-integration.d.ts +97 -0
  32. package/dist/auth/server-integration.d.ts.map +1 -0
  33. package/dist/auth/server-integration.js +182 -0
  34. package/dist/auth/server-integration.js.map +1 -0
  35. package/dist/auth/server-metadata.d.ts +51 -0
  36. package/dist/auth/server-metadata.d.ts.map +1 -0
  37. package/dist/auth/server-metadata.js +106 -0
  38. package/dist/auth/server-metadata.js.map +1 -0
  39. package/dist/auth/simple-jwt.d.ts +174 -0
  40. package/dist/auth/simple-jwt.d.ts.map +1 -0
  41. package/dist/auth/simple-jwt.js +162 -0
  42. package/dist/auth/simple-jwt.js.map +1 -0
  43. package/dist/auth/token-store.d.ts +104 -0
  44. package/dist/auth/token-store.d.ts.map +1 -0
  45. package/dist/auth/token-store.js +205 -0
  46. package/dist/auth/token-store.js.map +1 -0
  47. package/dist/auth/token-validation.d.ts +59 -0
  48. package/dist/auth/token-validation.d.ts.map +1 -0
  49. package/dist/auth/token-validation.js +241 -0
  50. package/dist/auth/token-validation.js.map +1 -0
  51. package/dist/auth/types.d.ts +215 -0
  52. package/dist/auth/types.d.ts.map +1 -0
  53. package/dist/auth/types.js +6 -0
  54. package/dist/auth/types.js.map +1 -0
  55. package/dist/core/apikey-module.d.ts +69 -0
  56. package/dist/core/apikey-module.d.ts.map +1 -0
  57. package/dist/core/apikey-module.js +114 -0
  58. package/dist/core/apikey-module.js.map +1 -0
  59. package/dist/core/app-decorator.d.ts +59 -0
  60. package/dist/core/app-decorator.d.ts.map +1 -0
  61. package/dist/core/app-decorator.js +322 -0
  62. package/dist/core/app-decorator.js.map +1 -0
  63. package/dist/core/builders.d.ts +50 -0
  64. package/dist/core/builders.d.ts.map +1 -0
  65. package/dist/core/builders.js +139 -0
  66. package/dist/core/builders.js.map +1 -0
  67. package/dist/core/component.d.ts +111 -0
  68. package/dist/core/component.d.ts.map +1 -0
  69. package/dist/core/component.js +228 -0
  70. package/dist/core/component.js.map +1 -0
  71. package/dist/core/config-module.d.ts +62 -0
  72. package/dist/core/config-module.d.ts.map +1 -0
  73. package/dist/core/config-module.js +94 -0
  74. package/dist/core/config-module.js.map +1 -0
  75. package/dist/core/decorators/cache.decorator.d.ts +61 -0
  76. package/dist/core/decorators/cache.decorator.d.ts.map +1 -0
  77. package/dist/core/decorators/cache.decorator.js +115 -0
  78. package/dist/core/decorators/cache.decorator.js.map +1 -0
  79. package/dist/core/decorators/health-check.decorator.d.ts +80 -0
  80. package/dist/core/decorators/health-check.decorator.d.ts.map +1 -0
  81. package/dist/core/decorators/health-check.decorator.js +153 -0
  82. package/dist/core/decorators/health-check.decorator.js.map +1 -0
  83. package/dist/core/decorators/rate-limit.decorator.d.ts +63 -0
  84. package/dist/core/decorators/rate-limit.decorator.d.ts.map +1 -0
  85. package/dist/core/decorators/rate-limit.decorator.js +129 -0
  86. package/dist/core/decorators/rate-limit.decorator.js.map +1 -0
  87. package/dist/core/decorators.d.ts +190 -0
  88. package/dist/core/decorators.d.ts.map +1 -0
  89. package/dist/core/decorators.js +170 -0
  90. package/dist/core/decorators.js.map +1 -0
  91. package/dist/core/di/container.d.ts +64 -0
  92. package/dist/core/di/container.d.ts.map +1 -0
  93. package/dist/core/di/container.js +105 -0
  94. package/dist/core/di/container.js.map +1 -0
  95. package/dist/core/di/injectable.decorator.d.ts +62 -0
  96. package/dist/core/di/injectable.decorator.d.ts.map +1 -0
  97. package/dist/core/di/injectable.decorator.js +66 -0
  98. package/dist/core/di/injectable.decorator.js.map +1 -0
  99. package/dist/core/errors.d.ts +54 -0
  100. package/dist/core/errors.d.ts.map +1 -0
  101. package/dist/core/errors.js +87 -0
  102. package/dist/core/errors.js.map +1 -0
  103. package/dist/core/events/event-emitter.d.ts +50 -0
  104. package/dist/core/events/event-emitter.d.ts.map +1 -0
  105. package/dist/core/events/event-emitter.js +94 -0
  106. package/dist/core/events/event-emitter.js.map +1 -0
  107. package/dist/core/events/event.decorator.d.ts +48 -0
  108. package/dist/core/events/event.decorator.d.ts.map +1 -0
  109. package/dist/core/events/event.decorator.js +72 -0
  110. package/dist/core/events/event.decorator.js.map +1 -0
  111. package/dist/core/events/log-emitter.d.ts +14 -0
  112. package/dist/core/events/log-emitter.d.ts.map +1 -0
  113. package/dist/core/events/log-emitter.js +20 -0
  114. package/dist/core/events/log-emitter.js.map +1 -0
  115. package/dist/core/filters/exception-filter.decorator.d.ts +40 -0
  116. package/dist/core/filters/exception-filter.decorator.d.ts.map +1 -0
  117. package/dist/core/filters/exception-filter.decorator.js +54 -0
  118. package/dist/core/filters/exception-filter.decorator.js.map +1 -0
  119. package/dist/core/filters/exception-filter.interface.d.ts +39 -0
  120. package/dist/core/filters/exception-filter.interface.d.ts.map +1 -0
  121. package/dist/core/filters/exception-filter.interface.js +2 -0
  122. package/dist/core/filters/exception-filter.interface.js.map +1 -0
  123. package/dist/core/guards/apikey.guard.d.ts +22 -0
  124. package/dist/core/guards/apikey.guard.d.ts.map +1 -0
  125. package/dist/core/guards/apikey.guard.js +11 -0
  126. package/dist/core/guards/apikey.guard.js.map +1 -0
  127. package/dist/core/guards/guard.interface.d.ts +18 -0
  128. package/dist/core/guards/guard.interface.d.ts.map +1 -0
  129. package/dist/core/guards/guard.interface.js +2 -0
  130. package/dist/core/guards/guard.interface.js.map +1 -0
  131. package/dist/core/guards/jwt.guard.d.ts +18 -0
  132. package/dist/core/guards/jwt.guard.d.ts.map +1 -0
  133. package/dist/core/guards/jwt.guard.js +2 -0
  134. package/dist/core/guards/jwt.guard.js.map +1 -0
  135. package/dist/core/guards/oauth.guard.d.ts +35 -0
  136. package/dist/core/guards/oauth.guard.d.ts.map +1 -0
  137. package/dist/core/guards/oauth.guard.js +2 -0
  138. package/dist/core/guards/oauth.guard.js.map +1 -0
  139. package/dist/core/guards/use-guards.decorator.d.ts +25 -0
  140. package/dist/core/guards/use-guards.decorator.d.ts.map +1 -0
  141. package/dist/core/guards/use-guards.decorator.js +32 -0
  142. package/dist/core/guards/use-guards.decorator.js.map +1 -0
  143. package/dist/core/health/health-checks.resource.d.ts +14 -0
  144. package/dist/core/health/health-checks.resource.d.ts.map +1 -0
  145. package/dist/core/health/health-checks.resource.js +29 -0
  146. package/dist/core/health/health-checks.resource.js.map +1 -0
  147. package/dist/core/index.d.ts +57 -0
  148. package/dist/core/index.d.ts.map +1 -0
  149. package/dist/core/index.js +59 -0
  150. package/dist/core/index.js.map +1 -0
  151. package/dist/core/interceptors/interceptor.decorator.d.ts +37 -0
  152. package/dist/core/interceptors/interceptor.decorator.d.ts.map +1 -0
  153. package/dist/core/interceptors/interceptor.decorator.js +51 -0
  154. package/dist/core/interceptors/interceptor.decorator.js.map +1 -0
  155. package/dist/core/interceptors/interceptor.interface.d.ts +31 -0
  156. package/dist/core/interceptors/interceptor.interface.d.ts.map +1 -0
  157. package/dist/core/interceptors/interceptor.interface.js +2 -0
  158. package/dist/core/interceptors/interceptor.interface.js.map +1 -0
  159. package/dist/core/jwt-module.d.ts +51 -0
  160. package/dist/core/jwt-module.d.ts.map +1 -0
  161. package/dist/core/jwt-module.js +52 -0
  162. package/dist/core/jwt-module.js.map +1 -0
  163. package/dist/core/logger.d.ts +18 -0
  164. package/dist/core/logger.d.ts.map +1 -0
  165. package/dist/core/logger.js +53 -0
  166. package/dist/core/logger.js.map +1 -0
  167. package/dist/core/middleware/middleware.decorator.d.ts +39 -0
  168. package/dist/core/middleware/middleware.decorator.d.ts.map +1 -0
  169. package/dist/core/middleware/middleware.decorator.js +53 -0
  170. package/dist/core/middleware/middleware.decorator.js.map +1 -0
  171. package/dist/core/middleware/middleware.interface.d.ts +29 -0
  172. package/dist/core/middleware/middleware.interface.d.ts.map +1 -0
  173. package/dist/core/middleware/middleware.interface.js +2 -0
  174. package/dist/core/middleware/middleware.interface.js.map +1 -0
  175. package/dist/core/module.d.ts +93 -0
  176. package/dist/core/module.d.ts.map +1 -0
  177. package/dist/core/module.js +87 -0
  178. package/dist/core/module.js.map +1 -0
  179. package/dist/core/oauth-module.d.ts +123 -0
  180. package/dist/core/oauth-module.d.ts.map +1 -0
  181. package/dist/core/oauth-module.js +324 -0
  182. package/dist/core/oauth-module.js.map +1 -0
  183. package/dist/core/pipes/pipe.decorator.d.ts +64 -0
  184. package/dist/core/pipes/pipe.decorator.d.ts.map +1 -0
  185. package/dist/core/pipes/pipe.decorator.js +85 -0
  186. package/dist/core/pipes/pipe.decorator.js.map +1 -0
  187. package/dist/core/pipes/pipe.interface.d.ts +41 -0
  188. package/dist/core/pipes/pipe.interface.d.ts.map +1 -0
  189. package/dist/core/pipes/pipe.interface.js +2 -0
  190. package/dist/core/pipes/pipe.interface.js.map +1 -0
  191. package/dist/core/prompt.d.ts +46 -0
  192. package/dist/core/prompt.d.ts.map +1 -0
  193. package/dist/core/prompt.js +76 -0
  194. package/dist/core/prompt.js.map +1 -0
  195. package/dist/core/resource.d.ts +47 -0
  196. package/dist/core/resource.d.ts.map +1 -0
  197. package/dist/core/resource.js +90 -0
  198. package/dist/core/resource.js.map +1 -0
  199. package/dist/core/server.d.ts +129 -0
  200. package/dist/core/server.d.ts.map +1 -0
  201. package/dist/core/server.js +617 -0
  202. package/dist/core/server.js.map +1 -0
  203. package/dist/core/tool.d.ts +108 -0
  204. package/dist/core/tool.d.ts.map +1 -0
  205. package/dist/core/tool.js +241 -0
  206. package/dist/core/tool.js.map +1 -0
  207. package/dist/core/transports/discovery-http-server.d.ts +19 -0
  208. package/dist/core/transports/discovery-http-server.d.ts.map +1 -0
  209. package/dist/core/transports/discovery-http-server.js +54 -0
  210. package/dist/core/transports/discovery-http-server.js.map +1 -0
  211. package/dist/core/transports/http-server.d.ts +108 -0
  212. package/dist/core/transports/http-server.d.ts.map +1 -0
  213. package/dist/core/transports/http-server.js +293 -0
  214. package/dist/core/transports/http-server.js.map +1 -0
  215. package/dist/core/transports/streamable-http.d.ts +177 -0
  216. package/dist/core/transports/streamable-http.d.ts.map +1 -0
  217. package/dist/core/transports/streamable-http.js +1287 -0
  218. package/dist/core/transports/streamable-http.js.map +1 -0
  219. package/dist/core/types.d.ts +195 -0
  220. package/dist/core/types.d.ts.map +1 -0
  221. package/dist/core/types.js +2 -0
  222. package/dist/core/types.js.map +1 -0
  223. package/dist/core/widgets/widget-examples.resource.d.ts +17 -0
  224. package/dist/core/widgets/widget-examples.resource.d.ts.map +1 -0
  225. package/dist/core/widgets/widget-examples.resource.js +28 -0
  226. package/dist/core/widgets/widget-examples.resource.js.map +1 -0
  227. package/dist/core/widgets/widget-registry.d.ts +56 -0
  228. package/dist/core/widgets/widget-registry.d.ts.map +1 -0
  229. package/dist/core/widgets/widget-registry.js +75 -0
  230. package/dist/core/widgets/widget-registry.js.map +1 -0
  231. package/dist/testing/index.d.ts +103 -0
  232. package/dist/testing/index.d.ts.map +1 -0
  233. package/dist/testing/index.js +161 -0
  234. package/dist/testing/index.js.map +1 -0
  235. package/dist/ui-next/index.d.ts +31 -0
  236. package/dist/ui-next/index.d.ts.map +1 -0
  237. package/dist/ui-next/index.js +687 -0
  238. package/dist/ui-next/index.js.map +1 -0
  239. package/package.json +89 -0
@@ -0,0 +1,59 @@
1
+ import 'reflect-metadata';
2
+ import { NitroStackServer } from './server.js';
3
+ import type { ClassConstructor } from './types.js';
4
+ /**
5
+ * MCP Application Options
6
+ */
7
+ export interface McpAppOptions {
8
+ /**
9
+ * Root module of the application
10
+ */
11
+ module: ClassConstructor;
12
+ /**
13
+ * Server configuration
14
+ */
15
+ server?: {
16
+ name?: string;
17
+ version?: string;
18
+ };
19
+ /**
20
+ * Logging configuration
21
+ */
22
+ logging?: {
23
+ level?: 'debug' | 'info' | 'warn' | 'error';
24
+ };
25
+ /**
26
+ * Transport configuration
27
+ * - 'stdio': STDIO only (default)
28
+ * - 'http': HTTP only
29
+ * - 'dual': STDIO for MCP + HTTP for OAuth metadata (auto-enabled with OAuth)
30
+ */
31
+ transport?: {
32
+ type: 'stdio' | 'http' | 'dual';
33
+ http?: {
34
+ port?: number;
35
+ host?: string;
36
+ basePath?: string;
37
+ };
38
+ };
39
+ }
40
+ /**
41
+ * @McpApp Decorator
42
+ * Marks a class as the root application module
43
+ */
44
+ export declare function McpApp(options: McpAppOptions): ClassDecorator;
45
+ /**
46
+ * Get MCP App metadata
47
+ */
48
+ export declare function getMcpAppMetadata(target: ClassConstructor): McpAppOptions | undefined;
49
+ /**
50
+ * MCP Application Factory
51
+ * Creates and bootstraps an MCP application
52
+ */
53
+ export declare class McpApplicationFactory {
54
+ /**
55
+ * Create an MCP application from an app module
56
+ */
57
+ static create(AppModule: ClassConstructor): Promise<NitroStackServer>;
58
+ }
59
+ //# sourceMappingURL=app-decorator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-decorator.d.ts","sourceRoot":"","sources":["../../src/core/app-decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAgB,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAO7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAiDnD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,MAAM,EAAE,gBAAgB,CAAC;IAEzB;;OAEG;IACH,MAAM,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IAEF;;OAEG;IACH,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;KAC7C,CAAC;IAEF;;;;;OAKG;IACH,SAAS,CAAC,EAAE;QACV,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;QAChC,IAAI,CAAC,EAAE;YACL,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,QAAQ,CAAC,EAAE,MAAM,CAAC;SACnB,CAAC;KACH,CAAC;CACH;AAOD;;;GAGG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,cAAc,CAM7D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,aAAa,GAAG,SAAS,CAErF;AAED;;;GAGG;AACH,qBAAa,qBAAqB;IAChC;;OAEG;WACU,MAAM,CAAC,SAAS,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAmT5E"}
@@ -0,0 +1,322 @@
1
+ import 'reflect-metadata';
2
+ import { createServer } from './server.js';
3
+ import { createLogger } from './logger.js';
4
+ import { DIContainer } from './di/container.js';
5
+ import { registerHealthCheck } from './decorators/health-check.decorator.js';
6
+ import { createResource } from './resource.js';
7
+ import { getModuleMetadata } from './module.js';
8
+ import { buildTools, buildResources, buildPrompts } from './builders.js';
9
+ /**
10
+ * Helper to check if a provider is a ClassConstructor
11
+ */
12
+ function isClassConstructor(provider) {
13
+ return typeof provider === 'function';
14
+ }
15
+ /**
16
+ * Register a provider (either class or object-style provider)
17
+ */
18
+ function registerProvider(container, provider) {
19
+ if (isClassConstructor(provider)) {
20
+ container.register(provider);
21
+ }
22
+ else {
23
+ // Object-style provider: { provide: ..., useValue/useClass/useFactory: ... }
24
+ const token = provider.provide;
25
+ if (provider.useValue !== undefined) {
26
+ container.registerValue(token, provider.useValue);
27
+ }
28
+ else if (provider.useClass) {
29
+ container.register(token, provider.useClass);
30
+ }
31
+ // useFactory could be added later if needed
32
+ }
33
+ }
34
+ /**
35
+ * MCP Application Metadata Key
36
+ */
37
+ const MCP_APP_METADATA = Symbol('mcp:app');
38
+ /**
39
+ * @McpApp Decorator
40
+ * Marks a class as the root application module
41
+ */
42
+ export function McpApp(options) {
43
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
+ return (target) => {
45
+ Reflect.defineMetadata(MCP_APP_METADATA, options, target);
46
+ return target;
47
+ };
48
+ }
49
+ /**
50
+ * Get MCP App metadata
51
+ */
52
+ export function getMcpAppMetadata(target) {
53
+ return Reflect.getMetadata(MCP_APP_METADATA, target);
54
+ }
55
+ /**
56
+ * MCP Application Factory
57
+ * Creates and bootstraps an MCP application
58
+ */
59
+ export class McpApplicationFactory {
60
+ /**
61
+ * Create an MCP application from an app module
62
+ */
63
+ static async create(AppModule) {
64
+ const options = getMcpAppMetadata(AppModule);
65
+ if (!options) {
66
+ throw new Error(`${AppModule.name} is not decorated with @McpApp. ` +
67
+ `Please add @McpApp decorator to your root module.`);
68
+ }
69
+ // Create logger
70
+ const logger = createLogger({ level: options.logging?.level || 'info' });
71
+ // Set log level if provided
72
+ if (options.logging?.level) {
73
+ process.env.LOG_LEVEL = options.logging.level;
74
+ }
75
+ // Create DI container
76
+ const container = DIContainer.getInstance();
77
+ // Register logger in DI for modules that need it
78
+ container.registerValue('Logger', logger);
79
+ // Get module metadata
80
+ const moduleMetadata = getModuleMetadata(options.module);
81
+ if (!moduleMetadata) {
82
+ throw new Error(`${options.module.name} is not decorated with @Module`);
83
+ }
84
+ // Register all providers
85
+ if (moduleMetadata.providers) {
86
+ for (const provider of moduleMetadata.providers) {
87
+ registerProvider(container, provider);
88
+ // Check if provider is a health check (only for class constructors)
89
+ if (isClassConstructor(provider)) {
90
+ const healthCheckMetadata = Reflect.getMetadata('nitrostack:health_check', provider);
91
+ if (healthCheckMetadata) {
92
+ // Resolve and register health check
93
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
94
+ const healthCheckInstance = container.resolve(provider);
95
+ registerHealthCheck(healthCheckInstance, healthCheckMetadata);
96
+ logger.info(` ✓ Health Check: ${healthCheckMetadata.name}`);
97
+ }
98
+ }
99
+ }
100
+ }
101
+ // Register all controllers (tools/resources/prompts)
102
+ if (moduleMetadata.controllers) {
103
+ for (const controller of moduleMetadata.controllers) {
104
+ container.register(controller);
105
+ }
106
+ }
107
+ // Track dynamic modules (forRoot() style) to add to server after creation
108
+ const dynamicModulesToAdd = [];
109
+ // Process imports (other modules)
110
+ if (moduleMetadata.imports) {
111
+ for (const importedModule of moduleMetadata.imports) {
112
+ if (typeof importedModule === 'function') {
113
+ const importedMetadata = getModuleMetadata(importedModule);
114
+ if (importedMetadata) {
115
+ // Register providers from imported module
116
+ if (importedMetadata.providers) {
117
+ for (const provider of importedMetadata.providers) {
118
+ registerProvider(container, provider);
119
+ // Check if provider is a health check (only for class constructors)
120
+ if (isClassConstructor(provider)) {
121
+ const healthCheckMetadata = Reflect.getMetadata('nitrostack:health_check', provider);
122
+ if (healthCheckMetadata) {
123
+ // Resolve and register health check
124
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
125
+ const healthCheckInstance = container.resolve(provider);
126
+ registerHealthCheck(healthCheckInstance, healthCheckMetadata);
127
+ logger.info(` ✓ Health Check: ${healthCheckMetadata.name}`);
128
+ }
129
+ }
130
+ }
131
+ }
132
+ // Register controllers from imported module
133
+ if (importedMetadata.controllers) {
134
+ for (const controller of importedMetadata.controllers) {
135
+ container.register(controller);
136
+ }
137
+ }
138
+ }
139
+ }
140
+ else if (importedModule && typeof importedModule === 'object') {
141
+ // Handle ConfigModule.forRoot() style dynamic modules
142
+ const dynamicMod = importedModule;
143
+ if (dynamicMod.providers) {
144
+ for (const provider of dynamicMod.providers) {
145
+ // Check if provider has {provide, useValue} format
146
+ if (provider && typeof provider === 'object' && 'provide' in provider && 'useValue' in provider) {
147
+ const valueProvider = provider;
148
+ container.registerValue(valueProvider.provide, valueProvider.useValue);
149
+ }
150
+ else {
151
+ container.register(provider);
152
+ }
153
+ }
154
+ }
155
+ // If the dynamic module has a module class, we'll add it to the server after creation
156
+ // Don't register it in DI yet to avoid circular dependency issues
157
+ if (dynamicMod.module) {
158
+ dynamicModulesToAdd.push(dynamicMod.module);
159
+ }
160
+ }
161
+ }
162
+ }
163
+ // Create server
164
+ const server = createServer({
165
+ name: options.server?.name || 'mcp-server',
166
+ version: options.server?.version || '1.0.0',
167
+ });
168
+ // Register the server itself in DI so dynamic modules can inject it
169
+ // Use string token since NitroStackServer has specific constructor signature
170
+ container.registerValue('NitroStackServer', server);
171
+ // Now register and add dynamic modules (from forRoot() calls) to server
172
+ for (const dynamicModule of dynamicModulesToAdd) {
173
+ container.register(dynamicModule);
174
+ // Access internal modules array
175
+ const serverInternal = server;
176
+ serverInternal.modules.push(dynamicModule);
177
+ }
178
+ // Build and register tools, resources, and prompts from all controllers
179
+ let totalTools = 0;
180
+ let totalResources = 0;
181
+ let totalPrompts = 0;
182
+ // Process all registered controllers
183
+ const allControllers = [];
184
+ // Get controllers from root module
185
+ if (moduleMetadata.controllers) {
186
+ allControllers.push(...moduleMetadata.controllers);
187
+ }
188
+ // Get controllers from imported modules
189
+ if (moduleMetadata.imports) {
190
+ for (const importedModule of moduleMetadata.imports) {
191
+ if (typeof importedModule === 'function') {
192
+ const importedMetadata = getModuleMetadata(importedModule);
193
+ if (importedMetadata?.controllers) {
194
+ allControllers.push(...importedMetadata.controllers);
195
+ }
196
+ }
197
+ }
198
+ }
199
+ // Build and register from each controller
200
+ for (const controllerClass of allControllers) {
201
+ // Resolve controller instance from DI container
202
+ const controller = container.resolve(controllerClass);
203
+ // Build tools
204
+ const tools = buildTools(controller);
205
+ for (const tool of tools) {
206
+ server.tool(tool);
207
+ totalTools++;
208
+ }
209
+ // Build resources
210
+ const resources = buildResources(controller);
211
+ for (const resource of resources) {
212
+ server.resource(resource);
213
+ totalResources++;
214
+ }
215
+ // Build prompts
216
+ const prompts = buildPrompts(controller);
217
+ for (const prompt of prompts) {
218
+ server.prompt(prompt);
219
+ totalPrompts++;
220
+ }
221
+ }
222
+ // Register health checks resource if any health checks exist
223
+ const { buildHealthChecksResource } = await import('./health/health-checks.resource.js');
224
+ const healthChecksResourceDef = await buildHealthChecksResource();
225
+ const healthChecksResource = createResource({
226
+ uri: healthChecksResourceDef.uri,
227
+ name: healthChecksResourceDef.name,
228
+ description: healthChecksResourceDef.description,
229
+ mimeType: healthChecksResourceDef.mimeType,
230
+ handler: async (uri, context) => {
231
+ const content = await healthChecksResourceDef.read();
232
+ return { type: 'text', data: content };
233
+ },
234
+ });
235
+ server.resource(healthChecksResource);
236
+ logger.info(`✅ Health checks resource registered`);
237
+ // Load widget manifest and register widget examples resource
238
+ try {
239
+ const { getWidgetRegistry } = await import('./widgets/widget-registry.js');
240
+ const { buildWidgetExamplesResource } = await import('./widgets/widget-examples.resource.js');
241
+ const { join } = await import('path');
242
+ const registry = getWidgetRegistry();
243
+ const widgetManifestPath = join(process.cwd(), 'src', 'widgets', 'widget-manifest.json');
244
+ registry.loadManifest(widgetManifestPath);
245
+ const widgetExamplesResourceDef = await buildWidgetExamplesResource();
246
+ const widgetExamplesResource = createResource({
247
+ uri: widgetExamplesResourceDef.uri,
248
+ name: widgetExamplesResourceDef.name,
249
+ description: widgetExamplesResourceDef.description,
250
+ mimeType: widgetExamplesResourceDef.mimeType,
251
+ handler: async (uri, context) => {
252
+ const content = await widgetExamplesResourceDef.read();
253
+ return { type: 'text', data: content };
254
+ },
255
+ });
256
+ server.resource(widgetExamplesResource);
257
+ logger.info(`Widget examples resource registered`);
258
+ }
259
+ catch (error) {
260
+ const errorMessage = error instanceof Error ? error.message : String(error);
261
+ logger.warn(`Widget examples not available: ${errorMessage}`);
262
+ }
263
+ logger.info(`✅ Application initialized with ${totalTools} tools, ${totalResources} resources, ${totalPrompts} prompts`);
264
+ // Auto-detect transport type based on configuration
265
+ let transportType = 'stdio';
266
+ let transportOptions = undefined;
267
+ // Check explicit transport configuration
268
+ if (options.transport?.type) {
269
+ transportType = options.transport.type;
270
+ }
271
+ // Check if OAuth is configured
272
+ const { OAuthModule } = await import('./oauth-module.js');
273
+ const oauthConfig = OAuthModule.getConfig();
274
+ if (oauthConfig) {
275
+ // OAuth requires DUAL transport: STDIO for MCP + HTTP for metadata
276
+ // This allows Studio to connect via STDIO while exposing OAuth metadata via HTTP
277
+ transportType = 'dual';
278
+ // Extract port from resourceUri (e.g., http://localhost:3002)
279
+ let port = 3000;
280
+ try {
281
+ const resourceUrl = new URL(oauthConfig.resourceUri);
282
+ port = resourceUrl.port ? parseInt(resourceUrl.port) : (resourceUrl.protocol === 'https:' ? 443 : 80);
283
+ }
284
+ catch (error) {
285
+ logger.warn(`Failed to parse resourceUri for port, using default 3000`);
286
+ }
287
+ // Override with explicit config if provided
288
+ if (oauthConfig.http?.port) {
289
+ port = oauthConfig.http.port;
290
+ }
291
+ else if (options.transport?.http?.port) {
292
+ port = options.transport.http.port;
293
+ }
294
+ transportOptions = {
295
+ port,
296
+ host: oauthConfig.http?.host || options.transport?.http?.host || '0.0.0.0',
297
+ basePath: oauthConfig.http?.basePath || options.transport?.http?.basePath || '/mcp',
298
+ oauth: {
299
+ resourceUri: oauthConfig.resourceUri,
300
+ authorizationServers: oauthConfig.authorizationServers,
301
+ scopesSupported: oauthConfig.scopesSupported,
302
+ },
303
+ };
304
+ logger.info(`🔐 OAuth 2.1 detected - using HTTP transport on port ${port}`);
305
+ }
306
+ else if (options.transport?.type === 'http') {
307
+ // Explicitly configured HTTP transport
308
+ transportType = 'http';
309
+ transportOptions = {
310
+ port: options.transport.http?.port || 3000,
311
+ host: options.transport.http?.host || '0.0.0.0',
312
+ basePath: options.transport.http?.basePath || '/mcp',
313
+ };
314
+ }
315
+ // Store transport configuration on server for later use
316
+ const serverInternal = server;
317
+ serverInternal._transportType = transportType;
318
+ serverInternal._transportOptions = transportOptions;
319
+ return server;
320
+ }
321
+ }
322
+ //# sourceMappingURL=app-decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-decorator.js","sourceRoot":"","sources":["../../src/core/app-decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAoB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAY,iBAAiB,EAA4B,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAkBzE;;GAEG;AACH,SAAS,kBAAkB,CAAC,QAAqC;IAC/D,OAAO,OAAO,QAAQ,KAAK,UAAU,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB,CAAC,SAAsB,EAAE,QAAqC;IACrF,IAAI,kBAAkB,CAAC,QAAQ,CA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import { ClassConstructor } from './types.js';
5
+ import { ToolOptions, ResourceOptions, PromptOptions } from './decorators.js';
6
+ /**
7
+ * Controller instance type
8
+ */
9
+ interface ControllerInstance {
10
+ [key: string]: unknown;
11
+ }
12
+ /**
13
+ * Controller class type (using ClassConstructor for compatibility)
14
+ */
15
+ type ControllerClass = ClassConstructor<ControllerInstance>;
16
+ /**
17
+ * Build a Tool instance from a decorated method
18
+ */
19
+ export declare function buildTool(controllerInstance: ControllerInstance, methodName: string, options: ToolOptions, widgetRoute?: string, isInitial?: boolean): Tool;
20
+ /**
21
+ * Build all tools from a controller
22
+ */
23
+ export declare function buildTools(controllerInstance: ControllerInstance): Tool[];
24
+ /**
25
+ * Build a Resource instance from a decorated method
26
+ */
27
+ export declare function buildResource(controllerInstance: ControllerInstance, methodName: string, options: ResourceOptions): Resource;
28
+ /**
29
+ * Build all resources from a controller
30
+ */
31
+ export declare function buildResources(controllerInstance: ControllerInstance): Resource[];
32
+ /**
33
+ * Build a Prompt instance from a decorated method
34
+ */
35
+ export declare function buildPrompt(controllerInstance: ControllerInstance, methodName: string, options: PromptOptions): Prompt;
36
+ /**
37
+ * Build all prompts from a controller
38
+ */
39
+ export declare function buildPrompts(controllerInstance: ControllerInstance): Prompt[];
40
+ /**
41
+ * Build all tools, resources, and prompts from a controller
42
+ * Supports dependency injection
43
+ */
44
+ export declare function buildController(controller: ControllerClass): {
45
+ tools: Tool[];
46
+ resources: Resource[];
47
+ prompts: Prompt[];
48
+ };
49
+ export {};
50
+ //# sourceMappingURL=builders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../src/core/builders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAkB,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,MAAM,EAAgB,MAAM,aAAa,CAAC;AAEnD,OAAO,EAA+G,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC3J,OAAO,EAA6F,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AASzK;;GAEG;AACH,UAAU,kBAAkB;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,KAAK,eAAe,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;AAE5D;;GAEG;AACH,wBAAgB,SAAS,CACvB,kBAAkB,EAAE,kBAAkB,EACtC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,WAAW,EACpB,WAAW,CAAC,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,OAAO,GAClB,IAAI,CAsCN;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,EAAE,CAczE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,kBAAkB,EAAE,kBAAkB,EACtC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,eAAe,GACvB,QAAQ,CAgBV;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,QAAQ,EAAE,CAOjF;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,kBAAkB,EAAE,kBAAkB,EACtC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,aAAa,GACrB,MAAM,CAcR;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAO7E;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,eAAe,GAAG;IAC5D,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAgBA"}
@@ -0,0 +1,139 @@
1
+ import { Tool } from './tool.js';
2
+ import { createResource } from './resource.js';
3
+ import { createPrompt } from './prompt.js';
4
+ import { createComponentFromNextRoute } from '../ui-next/index.js';
5
+ import { extractTools, extractResources, extractPrompts, getWidgetMetadata, getInitialToolMetadata } from './decorators.js';
6
+ import { getGuardsMetadata } from './guards/use-guards.decorator.js';
7
+ import { getMiddlewareMetadata } from './middleware/middleware.decorator.js';
8
+ import { getInterceptorMetadata } from './interceptors/interceptor.decorator.js';
9
+ import { getPipeMetadata } from './pipes/pipe.decorator.js';
10
+ import { getExceptionFilterMetadata } from './filters/exception-filter.decorator.js';
11
+ import { DIContainer } from './di/container.js';
12
+ import { isInjectable } from './di/injectable.decorator.js';
13
+ /**
14
+ * Build a Tool instance from a decorated method
15
+ */
16
+ export function buildTool(controllerInstance, methodName, options, widgetRoute, isInitial) {
17
+ const prototype = Object.getPrototypeOf(controllerInstance);
18
+ // Get the original method
19
+ const method = controllerInstance[methodName];
20
+ const originalMethod = method.bind(controllerInstance);
21
+ // Extract all decorator metadata
22
+ const guards = getGuardsMetadata(prototype, methodName);
23
+ const middlewares = getMiddlewareMetadata(prototype, methodName);
24
+ const interceptors = getInterceptorMetadata(prototype, methodName);
25
+ const pipes = getPipeMetadata(prototype, methodName);
26
+ const filters = getExceptionFilterMetadata(prototype, methodName);
27
+ // Create tool with all metadata
28
+ const tool = new Tool({
29
+ name: options.name,
30
+ description: options.description,
31
+ inputSchema: options.inputSchema,
32
+ handler: originalMethod,
33
+ guards,
34
+ middlewares,
35
+ interceptors,
36
+ pipes,
37
+ filters,
38
+ examples: options.examples,
39
+ widget: widgetRoute ? { route: widgetRoute } : undefined,
40
+ outputTemplate: widgetRoute,
41
+ isInitial,
42
+ });
43
+ // Create and attach component if widget route is specified
44
+ if (widgetRoute) {
45
+ const component = createComponentFromNextRoute(widgetRoute);
46
+ tool.setComponent(component);
47
+ }
48
+ return tool;
49
+ }
50
+ /**
51
+ * Build all tools from a controller
52
+ */
53
+ export function buildTools(controllerInstance) {
54
+ const constructor = Object.getPrototypeOf(controllerInstance).constructor;
55
+ const toolMetadata = extractTools(constructor);
56
+ return toolMetadata.map(({ methodName, options }) => {
57
+ const prototype = Object.getPrototypeOf(controllerInstance);
58
+ // Check if this method has a widget
59
+ const widgetRoute = getWidgetMetadata(prototype, methodName);
60
+ // Check for initial tool decorator
61
+ const isInitial = getInitialToolMetadata(prototype, methodName);
62
+ return buildTool(controllerInstance, methodName, options, widgetRoute, isInitial);
63
+ });
64
+ }
65
+ /**
66
+ * Build a Resource instance from a decorated method
67
+ */
68
+ export function buildResource(controllerInstance, methodName, options) {
69
+ const method = controllerInstance[methodName];
70
+ const originalMethod = method.bind(controllerInstance);
71
+ const resourceDefinition = {
72
+ uri: options.uri,
73
+ name: options.name,
74
+ description: options.description,
75
+ mimeType: options.mimeType,
76
+ handler: async (uri, context) => {
77
+ return await originalMethod(uri, context);
78
+ },
79
+ metadata: options.metadata,
80
+ };
81
+ return createResource(resourceDefinition);
82
+ }
83
+ /**
84
+ * Build all resources from a controller
85
+ */
86
+ export function buildResources(controllerInstance) {
87
+ const constructor = Object.getPrototypeOf(controllerInstance).constructor;
88
+ const resourceMetadata = extractResources(constructor);
89
+ return resourceMetadata.map(({ methodName, options }) => {
90
+ return buildResource(controllerInstance, methodName, options);
91
+ });
92
+ }
93
+ /**
94
+ * Build a Prompt instance from a decorated method
95
+ */
96
+ export function buildPrompt(controllerInstance, methodName, options) {
97
+ const method = controllerInstance[methodName];
98
+ const originalMethod = method.bind(controllerInstance);
99
+ const promptDefinition = {
100
+ name: options.name,
101
+ description: options.description,
102
+ arguments: options.arguments,
103
+ handler: async (args, context) => {
104
+ return await originalMethod(args, context);
105
+ },
106
+ };
107
+ return createPrompt(promptDefinition);
108
+ }
109
+ /**
110
+ * Build all prompts from a controller
111
+ */
112
+ export function buildPrompts(controllerInstance) {
113
+ const constructor = Object.getPrototypeOf(controllerInstance).constructor;
114
+ const promptMetadata = extractPrompts(constructor);
115
+ return promptMetadata.map(({ methodName, options }) => {
116
+ return buildPrompt(controllerInstance, methodName, options);
117
+ });
118
+ }
119
+ /**
120
+ * Build all tools, resources, and prompts from a controller
121
+ * Supports dependency injection
122
+ */
123
+ export function buildController(controller) {
124
+ const container = DIContainer.getInstance();
125
+ // Create controller instance (with DI if available)
126
+ let instance;
127
+ if (isInjectable(controller) && container.has(controller)) {
128
+ instance = container.resolve(controller);
129
+ }
130
+ else {
131
+ instance = new controller();
132
+ }
133
+ return {
134
+ tools: buildTools(instance),
135
+ resources: buildResources(instance),
136
+ prompts: buildPrompts(instance),
137
+ };
138
+ }
139
+ //# sourceMappingURL=builders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builders.js","sourceRoot":"","sources":["../../src/core/builders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAY,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAU,YAAY,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,iBAAiB,EAAE,sBAAsB,EAA+C,MAAM,iBAAiB,CAAC;AACzK,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAc5D;;GAEG;AACH,MAAM,UAAU,SAAS,CACvB,kBAAsC,EACtC,UAAkB,EAClB,OAAoB,EACpB,WAAoB,EACpB,SAAmB;IAEnB,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC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