mozaic-mcp-server 2.3.0 → 2.5.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 (74) hide show
  1. package/bin/install.js +4 -0
  2. package/dist/app.module.d.ts +3 -0
  3. package/dist/app.module.d.ts.map +1 -0
  4. package/dist/app.module.js +28 -0
  5. package/dist/app.module.js.map +1 -0
  6. package/dist/auth/auth.guard.d.ts +10 -0
  7. package/dist/auth/auth.guard.d.ts.map +1 -0
  8. package/dist/auth/auth.guard.js +53 -0
  9. package/dist/auth/auth.guard.js.map +1 -0
  10. package/dist/auth/auth.module.d.ts +3 -0
  11. package/dist/auth/auth.module.d.ts.map +1 -0
  12. package/dist/auth/auth.module.js +18 -0
  13. package/dist/auth/auth.module.js.map +1 -0
  14. package/dist/config/configuration.d.ts +18 -0
  15. package/dist/config/configuration.d.ts.map +1 -0
  16. package/dist/config/configuration.js +17 -0
  17. package/dist/config/configuration.js.map +1 -0
  18. package/dist/main.d.ts +2 -0
  19. package/dist/main.d.ts.map +1 -0
  20. package/dist/main.js +55 -0
  21. package/dist/main.js.map +1 -0
  22. package/dist/mcp/mcp.controller.d.ts +27 -0
  23. package/dist/mcp/mcp.controller.d.ts.map +1 -0
  24. package/dist/mcp/mcp.controller.js +102 -0
  25. package/dist/mcp/mcp.controller.js.map +1 -0
  26. package/dist/mcp/mcp.module.d.ts +3 -0
  27. package/dist/mcp/mcp.module.d.ts.map +1 -0
  28. package/dist/mcp/mcp.module.js +20 -0
  29. package/dist/mcp/mcp.module.js.map +1 -0
  30. package/dist/mcp/mcp.service.d.ts +35 -0
  31. package/dist/mcp/mcp.service.d.ts.map +1 -0
  32. package/dist/mcp/mcp.service.js +229 -0
  33. package/dist/mcp/mcp.service.js.map +1 -0
  34. package/dist/tools/generate-freemarker.d.ts +6 -6
  35. package/dist/tools/get-freemarker-info.d.ts +2 -2
  36. package/dist/tools/list-css-utilities.d.ts +1 -1
  37. package/dist/tools/list-freemarker.d.ts +2 -2
  38. package/package.json +17 -3
  39. package/dist/__tests__/sanity-check.test.d.ts +0 -2
  40. package/dist/__tests__/sanity-check.test.d.ts.map +0 -1
  41. package/dist/__tests__/sanity-check.test.js +0 -167
  42. package/dist/__tests__/sanity-check.test.js.map +0 -1
  43. package/dist/__tests__/skills-scripts.test.d.ts +0 -2
  44. package/dist/__tests__/skills-scripts.test.d.ts.map +0 -1
  45. package/dist/__tests__/skills-scripts.test.js +0 -404
  46. package/dist/__tests__/skills-scripts.test.js.map +0 -1
  47. package/dist/__tests__/tools.integration.test.d.ts +0 -2
  48. package/dist/__tests__/tools.integration.test.d.ts.map +0 -1
  49. package/dist/__tests__/tools.integration.test.js +0 -305
  50. package/dist/__tests__/tools.integration.test.js.map +0 -1
  51. package/dist/parsers/__tests__/docs-parser.test.d.ts +0 -2
  52. package/dist/parsers/__tests__/docs-parser.test.d.ts.map +0 -1
  53. package/dist/parsers/__tests__/docs-parser.test.js +0 -251
  54. package/dist/parsers/__tests__/docs-parser.test.js.map +0 -1
  55. package/dist/parsers/__tests__/icons-parser.test.d.ts +0 -2
  56. package/dist/parsers/__tests__/icons-parser.test.d.ts.map +0 -1
  57. package/dist/parsers/__tests__/icons-parser.test.js +0 -169
  58. package/dist/parsers/__tests__/icons-parser.test.js.map +0 -1
  59. package/dist/parsers/__tests__/react-parser.test.d.ts +0 -2
  60. package/dist/parsers/__tests__/react-parser.test.d.ts.map +0 -1
  61. package/dist/parsers/__tests__/react-parser.test.js +0 -274
  62. package/dist/parsers/__tests__/react-parser.test.js.map +0 -1
  63. package/dist/parsers/__tests__/scss-parser.test.d.ts +0 -2
  64. package/dist/parsers/__tests__/scss-parser.test.d.ts.map +0 -1
  65. package/dist/parsers/__tests__/scss-parser.test.js +0 -364
  66. package/dist/parsers/__tests__/scss-parser.test.js.map +0 -1
  67. package/dist/parsers/__tests__/tokens-parser.test.d.ts +0 -2
  68. package/dist/parsers/__tests__/tokens-parser.test.d.ts.map +0 -1
  69. package/dist/parsers/__tests__/tokens-parser.test.js +0 -172
  70. package/dist/parsers/__tests__/tokens-parser.test.js.map +0 -1
  71. package/dist/parsers/__tests__/vue-parser.test.d.ts +0 -2
  72. package/dist/parsers/__tests__/vue-parser.test.d.ts.map +0 -1
  73. package/dist/parsers/__tests__/vue-parser.test.js +0 -207
  74. package/dist/parsers/__tests__/vue-parser.test.js.map +0 -1
package/bin/install.js CHANGED
@@ -23,6 +23,8 @@ const MCP_CONFIG_FILE = join(MCP_CONFIG_DIR, 'claude_desktop_config.json');
23
23
  const SKILLS = [
24
24
  'mozaic-vue-builder',
25
25
  'mozaic-react-builder',
26
+ 'mozaic-webcomponents-builder',
27
+ 'mozaic-freemarker-builder',
26
28
  'mozaic-design-tokens',
27
29
  'mozaic-css-utilities',
28
30
  'mozaic-icons'
@@ -456,6 +458,8 @@ async function runInteractive() {
456
458
  const descriptions = {
457
459
  'mozaic-vue-builder': 'Vue 3 component generator',
458
460
  'mozaic-react-builder': 'React/TSX component generator',
461
+ 'mozaic-webcomponents-builder': 'Web Components generator',
462
+ 'mozaic-freemarker-builder': 'Freemarker macro generator',
459
463
  'mozaic-design-tokens': 'Design tokens & styling',
460
464
  'mozaic-css-utilities': 'CSS utilities & layouts',
461
465
  'mozaic-icons': 'Icon search & integration'
@@ -0,0 +1,3 @@
1
+ export declare class AppModule {
2
+ }
3
+ //# sourceMappingURL=app.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.module.d.ts","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":"AAMA,qBAWa,SAAS;CAAG"}
@@ -0,0 +1,28 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Module } from "@nestjs/common";
8
+ import { ConfigModule } from "@nestjs/config";
9
+ import { McpModule } from "./mcp/mcp.module.js";
10
+ import { AuthModule } from "./auth/auth.module.js";
11
+ import configuration from "./config/configuration.js";
12
+ let AppModule = class AppModule {
13
+ };
14
+ AppModule = __decorate([
15
+ Module({
16
+ imports: [
17
+ ConfigModule.forRoot({
18
+ isGlobal: true,
19
+ load: [configuration],
20
+ envFilePath: [".env", ".env.local"],
21
+ }),
22
+ AuthModule,
23
+ McpModule,
24
+ ],
25
+ })
26
+ ], AppModule);
27
+ export { AppModule };
28
+ //# sourceMappingURL=app.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,aAAa,MAAM,2BAA2B,CAAC;AAa/C,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,SAAS;IAXrB,MAAM,CAAC;QACN,OAAO,EAAE;YACP,YAAY,CAAC,OAAO,CAAC;gBACnB,QAAQ,EAAE,IAAI;gBACd,IAAI,EAAE,CAAC,aAAa,CAAC;gBACrB,WAAW,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC;aACpC,CAAC;YACF,UAAU;YACV,SAAS;SACV;KACF,CAAC;GACW,SAAS,CAAG"}
@@ -0,0 +1,10 @@
1
+ import { CanActivate, ExecutionContext } from "@nestjs/common";
2
+ import { ConfigService } from "@nestjs/config";
3
+ export declare class AuthGuard implements CanActivate {
4
+ private configService;
5
+ private readonly logger;
6
+ private readonly authToken;
7
+ constructor(configService: ConfigService);
8
+ canActivate(context: ExecutionContext): boolean;
9
+ }
10
+ //# sourceMappingURL=auth.guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.guard.d.ts","sourceRoot":"","sources":["../../src/auth/auth.guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,gBAAgB,EAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,qBACa,SAAU,YAAW,WAAW;IAI/B,OAAO,CAAC,aAAa;IAHjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8B;IACrD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEf,aAAa,EAAE,aAAa;IAIhD,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO;CA+BhD"}
@@ -0,0 +1,53 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var AuthGuard_1;
11
+ import { Injectable, UnauthorizedException, Logger, } from "@nestjs/common";
12
+ import { ConfigService } from "@nestjs/config";
13
+ let AuthGuard = AuthGuard_1 = class AuthGuard {
14
+ configService;
15
+ logger = new Logger(AuthGuard_1.name);
16
+ authToken;
17
+ constructor(configService) {
18
+ this.configService = configService;
19
+ this.authToken = this.configService.get("auth.token", "");
20
+ }
21
+ canActivate(context) {
22
+ const request = context.switchToHttp().getRequest();
23
+ const authHeader = request.headers.authorization;
24
+ // Skip auth in development mode if no token is configured
25
+ if (process.env.NODE_ENV === "development" && !this.authToken) {
26
+ this.logger.warn("Authentication skipped in development mode (no token configured)");
27
+ return true;
28
+ }
29
+ // Check if authorization header is present
30
+ if (!authHeader) {
31
+ this.logger.warn(`Unauthorized access attempt from ${request.ip}`);
32
+ throw new UnauthorizedException("Missing authorization header");
33
+ }
34
+ // Check Bearer token format
35
+ const [type, token] = authHeader.split(" ");
36
+ if (type !== "Bearer" || !token) {
37
+ this.logger.warn(`Invalid authorization format from ${request.ip}`);
38
+ throw new UnauthorizedException("Invalid authorization format");
39
+ }
40
+ // Validate token
41
+ if (token !== this.authToken) {
42
+ this.logger.warn(`Invalid token from ${request.ip}`);
43
+ throw new UnauthorizedException("Invalid token");
44
+ }
45
+ return true;
46
+ }
47
+ };
48
+ AuthGuard = AuthGuard_1 = __decorate([
49
+ Injectable(),
50
+ __metadata("design:paramtypes", [ConfigService])
51
+ ], AuthGuard);
52
+ export { AuthGuard };
53
+ //# sourceMappingURL=auth.guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.guard.js","sourceRoot":"","sources":["../../src/auth/auth.guard.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EACL,UAAU,EAGV,qBAAqB,EACrB,MAAM,GACP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAIxC,IAAM,SAAS,iBAAf,MAAM,SAAS;IAIA;IAHH,MAAM,GAAG,IAAI,MAAM,CAAC,WAAS,CAAC,IAAI,CAAC,CAAC;IACpC,SAAS,CAAS;IAEnC,YAAoB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;QAC9C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,YAA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aAAa;GAJrC,SAAS,CAuCrB"}
@@ -0,0 +1,3 @@
1
+ export declare class AuthModule {
2
+ }
3
+ //# sourceMappingURL=auth.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.module.d.ts","sourceRoot":"","sources":["../../src/auth/auth.module.ts"],"names":[],"mappings":"AAGA,qBAIa,UAAU;CAAG"}
@@ -0,0 +1,18 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Module } from "@nestjs/common";
8
+ import { AuthGuard } from "./auth.guard.js";
9
+ let AuthModule = class AuthModule {
10
+ };
11
+ AuthModule = __decorate([
12
+ Module({
13
+ providers: [AuthGuard],
14
+ exports: [AuthGuard],
15
+ })
16
+ ], AuthModule);
17
+ export { AuthModule };
18
+ //# sourceMappingURL=auth.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../src/auth/auth.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAMrC,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,UAAU;IAJtB,MAAM,CAAC;QACN,SAAS,EAAE,CAAC,SAAS,CAAC;QACtB,OAAO,EAAE,CAAC,SAAS,CAAC;KACrB,CAAC;GACW,UAAU,CAAG"}
@@ -0,0 +1,18 @@
1
+ declare const _default: () => {
2
+ port: number;
3
+ auth: {
4
+ token: string;
5
+ };
6
+ database: {
7
+ path: string;
8
+ };
9
+ mcp: {
10
+ debug: boolean;
11
+ serverPath: string;
12
+ };
13
+ cors: {
14
+ origins: string[];
15
+ };
16
+ };
17
+ export default _default;
18
+ //# sourceMappingURL=configuration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/config/configuration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wBAeG"}
@@ -0,0 +1,17 @@
1
+ export default () => ({
2
+ port: parseInt(process.env.PORT || "3000", 10),
3
+ auth: {
4
+ token: process.env.AUTH_TOKEN || "change-me-in-production",
5
+ },
6
+ database: {
7
+ path: process.env.DATABASE_PATH || "/app/data/mozaic.db",
8
+ },
9
+ mcp: {
10
+ debug: process.env.MCP_DEBUG === "true",
11
+ serverPath: process.env.MCP_SERVER_PATH || "/app/dist/index.js",
12
+ },
13
+ cors: {
14
+ origins: (process.env.CORS_ORIGINS || "https://v0.dev,https://*.v0.dev").split(","),
15
+ },
16
+ });
17
+ //# sourceMappingURL=configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../src/config/configuration.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC,CAAC;IACpB,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,EAAE,EAAE,CAAC;IAC9C,IAAI,EAAE;QACJ,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,yBAAyB;KAC3D;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,qBAAqB;KACzD;IACD,GAAG,EAAE;QACH,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,MAAM;QACvC,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,oBAAoB;KAChE;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,iCAAiC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;KACpF;CACF,CAAC,CAAC"}
package/dist/main.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import "reflect-metadata";
2
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC"}
package/dist/main.js ADDED
@@ -0,0 +1,55 @@
1
+ import "reflect-metadata";
2
+ import { NestFactory } from "@nestjs/core";
3
+ import { ValidationPipe } from "@nestjs/common";
4
+ import { SwaggerModule, DocumentBuilder } from "@nestjs/swagger";
5
+ import { AppModule } from "./app.module.js";
6
+ async function bootstrap() {
7
+ const app = await NestFactory.create(AppModule, {
8
+ logger: ["error", "warn", "log", "debug", "verbose"],
9
+ });
10
+ // Enable CORS for v0 and other clients
11
+ app.enableCors({
12
+ origin: [
13
+ "https://v0.dev",
14
+ "https://*.v0.dev",
15
+ "http://localhost:3000",
16
+ "http://localhost:3001",
17
+ ],
18
+ credentials: true,
19
+ methods: ["GET", "POST", "OPTIONS"],
20
+ allowedHeaders: ["Content-Type", "Authorization"],
21
+ });
22
+ // Global validation pipe
23
+ app.useGlobalPipes(new ValidationPipe({
24
+ whitelist: true,
25
+ forbidNonWhitelisted: true,
26
+ transform: true,
27
+ transformOptions: {
28
+ enableImplicitConversion: true,
29
+ },
30
+ }));
31
+ // Swagger documentation
32
+ const config = new DocumentBuilder()
33
+ .setTitle("Mozaic MCP Server")
34
+ .setDescription("Model Context Protocol server for Mozaic Design System")
35
+ .setVersion("2.4.0")
36
+ .addBearerAuth()
37
+ .addTag("MCP", "Model Context Protocol endpoints")
38
+ .addTag("Health", "Health check endpoints")
39
+ .build();
40
+ const document = SwaggerModule.createDocument(app, config);
41
+ SwaggerModule.setup("api", app, document);
42
+ // Graceful shutdown
43
+ app.enableShutdownHooks();
44
+ const port = process.env.PORT || 3000;
45
+ await app.listen(port);
46
+ console.log(`🚀 Mozaic MCP Server is running on: http://localhost:${port}`);
47
+ console.log(`📚 API Documentation available at: http://localhost:${port}/api`);
48
+ console.log(`🔌 MCP endpoint: http://localhost:${port}/mcp`);
49
+ console.log(`❤️ Health check: http://localhost:${port}/health`);
50
+ }
51
+ bootstrap().catch((error) => {
52
+ console.error("Failed to start server:", error);
53
+ process.exit(1);
54
+ });
55
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,KAAK,UAAU,SAAS;IACtB,MAAM,GAAG,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE;QAC9C,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC;KACrD,CAAC,CAAC;IAEH,uCAAuC;IACvC,GAAG,CAAC,UAAU,CAAC;QACb,MAAM,EAAE;YACN,gBAAgB;YAChB,kBAAkB;YAClB,uBAAuB;YACvB,uBAAuB;SACxB;QACD,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC;QACnC,cAAc,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC;KAClD,CAAC,CAAC;IAEH,yBAAyB;IACzB,GAAG,CAAC,cAAc,CAChB,IAAI,cAAc,CAAC;QACjB,SAAS,EAAE,IAAI;QACf,oBAAoB,EAAE,IAAI;QAC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 interface McpRequest {
3
+ jsonrpc?: string;
4
+ method?: string;
5
+ params?: unknown;
6
+ id?: string | number;
7
+ }
8
+ interface ToolCallRequest {
9
+ name: string;
10
+ arguments?: Record<string, unknown>;
11
+ }
12
+ export declare class McpController {
13
+ private readonly mcpService;
14
+ constructor(mcpService: McpService);
15
+ health(): {
16
+ status: string;
17
+ timestamp: string;
18
+ service: string;
19
+ version: string;
20
+ };
21
+ handleMcpRequest(body: McpRequest): Promise<unknown>;
22
+ getServerInfo(): Promise<unknown>;
23
+ listTools(): Promise<unknown>;
24
+ callTool(body: ToolCallRequest): Promise<unknown>;
25
+ }
26
+ export {};
27
+ //# sourceMappingURL=mcp.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.controller.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp.controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,UAAU,UAAU;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACtB;AAED,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED,qBAEa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAInD,MAAM;;;;;;IAcA,gBAAgB,CAAS,IAAI,EAAE,UAAU;IAczC,aAAa;IASb,SAAS;IAST,QAAQ,CAAS,IAAI,EAAE,eAAe;CAG7C"}
@@ -0,0 +1,102 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { Controller, Post, Get, Body, UseGuards, HttpCode, HttpStatus } from "@nestjs/common";
14
+ import { ApiTags, ApiOperation, ApiBearerAuth } from "@nestjs/swagger";
15
+ import { McpService } from "./mcp.service.js";
16
+ import { AuthGuard } from "../auth/auth.guard.js";
17
+ let McpController = class McpController {
18
+ mcpService;
19
+ constructor(mcpService) {
20
+ this.mcpService = mcpService;
21
+ }
22
+ health() {
23
+ return {
24
+ status: "ok",
25
+ timestamp: new Date().toISOString(),
26
+ service: "mozaic-mcp-server",
27
+ version: "2.4.0",
28
+ };
29
+ }
30
+ async handleMcpRequest(body) {
31
+ // Handle JSON-RPC requests
32
+ if (body.jsonrpc === "2.0") {
33
+ return this.mcpService.handleJsonRpcRequest(body);
34
+ }
35
+ // Handle standard MCP protocol messages
36
+ return this.mcpService.handleMcpRequest(body);
37
+ }
38
+ async getServerInfo() {
39
+ return this.mcpService.getServerInfo();
40
+ }
41
+ async listTools() {
42
+ return this.mcpService.listTools();
43
+ }
44
+ async callTool(body) {
45
+ return this.mcpService.callTool(body.name, body.arguments);
46
+ }
47
+ };
48
+ __decorate([
49
+ Get("health"),
50
+ ApiOperation({ summary: "Health check endpoint" }),
51
+ __metadata("design:type", Function),
52
+ __metadata("design:paramtypes", []),
53
+ __metadata("design:returntype", void 0)
54
+ ], McpController.prototype, "health", null);
55
+ __decorate([
56
+ Post("mcp"),
57
+ HttpCode(HttpStatus.OK),
58
+ UseGuards(AuthGuard),
59
+ ApiBearerAuth(),
60
+ ApiOperation({ summary: "Main MCP JSON-RPC endpoint" }),
61
+ __param(0, Body()),
62
+ __metadata("design:type", Function),
63
+ __metadata("design:paramtypes", [Object]),
64
+ __metadata("design:returntype", Promise)
65
+ ], McpController.prototype, "handleMcpRequest", null);
66
+ __decorate([
67
+ Get("mcp/info"),
68
+ UseGuards(AuthGuard),
69
+ ApiBearerAuth(),
70
+ ApiOperation({ summary: "Get MCP server information" }),
71
+ __metadata("design:type", Function),
72
+ __metadata("design:paramtypes", []),
73
+ __metadata("design:returntype", Promise)
74
+ ], McpController.prototype, "getServerInfo", null);
75
+ __decorate([
76
+ Post("mcp/list-tools"),
77
+ HttpCode(HttpStatus.OK),
78
+ UseGuards(AuthGuard),
79
+ ApiBearerAuth(),
80
+ ApiOperation({ summary: "List available MCP tools" }),
81
+ __metadata("design:type", Function),
82
+ __metadata("design:paramtypes", []),
83
+ __metadata("design:returntype", Promise)
84
+ ], McpController.prototype, "listTools", null);
85
+ __decorate([
86
+ Post("mcp/call-tool"),
87
+ HttpCode(HttpStatus.OK),
88
+ UseGuards(AuthGuard),
89
+ ApiBearerAuth(),
90
+ ApiOperation({ summary: "Call a specific MCP tool" }),
91
+ __param(0, Body()),
92
+ __metadata("design:type", Function),
93
+ __metadata("design:paramtypes", [Object]),
94
+ __metadata("design:returntype", Promise)
95
+ ], McpController.prototype, "callTool", null);
96
+ McpController = __decorate([
97
+ ApiTags("MCP"),
98
+ Controller(),
99
+ __metadata("design:paramtypes", [McpService])
100
+ ], McpController);
101
+ export { McpController };
102
+ //# sourceMappingURL=mcp.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.controller.js","sourceRoot":"","sources":["../../src/mcp/mcp.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE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AAO,EAAE,uBAAuB,EAAE,CAAC;;;;2CAQlD;AAOK;IALL,IAAI,CAAC,KAAK,CAAC;IACX,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;IACvB,SAAS,CAAC,SAAS,CAAC;IACpB,aAAa,EAAE;IACf,YAAY,CAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;IAChC,WAAA,IAAI,EAAE,CAAA;;;;qDAQ7B;AAMK;IAJL,GAAG,CAAC,UAAU,CAAC;IACf,SAAS,CAAC,SAAS,CAAC;IACpB,aAAa,EAAE;IACf,YAAY,CAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;;;;kDAGvD;AAOK;IALL,IAAI,CAAC,gBAAgB,CAAC;IACtB,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;IACvB,SAAS,CAAC,SAAS,CAAC;IACpB,aAAa,EAAE;IACf,YAAY,CAAC,EAAE,OAAO,EAAE,0BAA0B,EAAE,CAAC;;;;8CAGrD;AAOK;IALL,IAAI,CAAC,eAAe,CAAC;IACrB,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;IACvB,SAAS,CAAC,SAAS,CAAC;IACpB,aAAa,EAAE;IACf,YAAY,CAAC,EAAE,OAAO,EAAE,0BAA0B,EAAE,CAAC;IACtC,WAAA,IAAI,EAAE,CAAA;;;;6CAErB;AArDU,aAAa;IAFzB,OAAO,CAAC,KAAK,CAAC;IACd,UAAU,EAAE;qCAE8B,UAAU;GADxC,aAAa,CAsDzB"}
@@ -0,0 +1,3 @@
1
+ export declare class McpModule {
2
+ }
3
+ //# sourceMappingURL=mcp.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.module.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp.module.ts"],"names":[],"mappings":"AAIA,qBAKa,SAAS;CAAG"}
@@ -0,0 +1,20 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Module } from "@nestjs/common";
8
+ import { McpController } from "./mcp.controller.js";
9
+ import { McpService } from "./mcp.service.js";
10
+ let McpModule = class McpModule {
11
+ };
12
+ McpModule = __decorate([
13
+ Module({
14
+ controllers: [McpController],
15
+ providers: [McpService],
16
+ exports: [McpService],
17
+ })
18
+ ], McpModule);
19
+ export { McpModule };
20
+ //# sourceMappingURL=mcp.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.module.js","sourceRoot":"","sources":["../../src/mcp/mcp.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAOvC,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,SAAS;IALrB,MAAM,CAAC;QACN,WAAW,EAAE,CAAC,aAAa,CAAC;QAC5B,SAAS,EAAE,CAAC,UAAU,CAAC;QACvB,OAAO,EAAE,CAAC,UAAU,CAAC;KACtB,CAAC;GACW,SAAS,CAAG"}
@@ -0,0 +1,35 @@
1
+ import { OnModuleInit, OnModuleDestroy } from "@nestjs/common";
2
+ import { ConfigService } from "@nestjs/config";
3
+ interface McpRequest {
4
+ jsonrpc?: string;
5
+ method?: string;
6
+ params?: unknown;
7
+ id?: string | number;
8
+ type?: string;
9
+ }
10
+ export declare class McpService implements OnModuleInit, OnModuleDestroy {
11
+ private configService;
12
+ private readonly logger;
13
+ private mcpProcess;
14
+ private requestId;
15
+ private pendingRequests;
16
+ private eventEmitter;
17
+ private serverInfo;
18
+ private tools;
19
+ constructor(configService: ConfigService);
20
+ onModuleInit(): Promise<void>;
21
+ onModuleDestroy(): Promise<void>;
22
+ private startMcpServer;
23
+ private stopMcpServer;
24
+ private handleMcpMessage;
25
+ private handleNotification;
26
+ private sendRequest;
27
+ private initializeServerInfo;
28
+ handleJsonRpcRequest(request: McpRequest): Promise<unknown>;
29
+ handleMcpRequest(request: McpRequest): Promise<unknown>;
30
+ getServerInfo(): Promise<unknown>;
31
+ listTools(): Promise<unknown>;
32
+ callTool(name: string, args?: Record<string, unknown>): Promise<unknown>;
33
+ }
34
+ export {};
35
+ //# sourceMappingURL=mcp.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.service.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,eAAe,EAAU,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AA4B/C,UAAU,UAAU;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qBACa,UAAW,YAAW,YAAY,EAAE,eAAe;IASlD,OAAO,CAAC,aAAa;IARjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+B;IACtD,OAAO,CAAC,UAAU,CAA6B;IAC/C,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,eAAe,CAA8C;IACrE,OAAO,CAAC,YAAY,CAAsB;IAC1C,OAAO,CAAC,UAAU,CAA8B;IAChD,OAAO,CAAC,KAAK,CAAiB;gBAEV,aAAa,EAAE,aAAa;IAE1C,YAAY;IAKZ,eA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