@maka/maka-cli 5.1.41 → 5.1.43

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 (61) hide show
  1. package/.claude/settings.local.json +4 -1
  2. package/bundle/typescript/package.json +8 -2
  3. package/bundle/typescript/src/commands/_index.d.ts +1 -1
  4. package/bundle/typescript/src/commands/_index.js +1 -1
  5. package/bundle/typescript/src/commands/_index.js.map +1 -1
  6. package/bundle/typescript/src/commands/ai/_index.d.ts +2 -0
  7. package/bundle/typescript/src/commands/ai/_index.js +3 -0
  8. package/bundle/typescript/src/commands/ai/_index.js.map +1 -0
  9. package/bundle/typescript/src/commands/ai/ai.command.d.ts +3 -0
  10. package/bundle/typescript/src/commands/{ai.js → ai/ai.command.js} +9 -7
  11. package/bundle/typescript/src/commands/ai/ai.command.js.map +1 -0
  12. package/bundle/typescript/src/commands/ai/mcp.sub.cmd.js +605 -0
  13. package/bundle/typescript/src/commands/ai/mcp.sub.cmd.js.map +1 -0
  14. package/bundle/typescript/src/commands/create.js +79 -35
  15. package/bundle/typescript/src/commands/create.js.map +1 -1
  16. package/bundle/typescript/src/generators/api.js +3 -1
  17. package/bundle/typescript/src/generators/api.js.map +1 -1
  18. package/bundle/typescript/src/generators/component.js +3 -1
  19. package/bundle/typescript/src/generators/component.js.map +1 -1
  20. package/bundle/typescript/src/generators/hook.js +3 -1
  21. package/bundle/typescript/src/generators/hook.js.map +1 -1
  22. package/bundle/typescript/src/generators/kits/_index.d.ts +1 -0
  23. package/bundle/typescript/src/generators/kits/_index.js +1 -0
  24. package/bundle/typescript/src/generators/kits/_index.js.map +1 -1
  25. package/bundle/typescript/src/generators/kits/frames/_index.d.ts +1 -0
  26. package/bundle/typescript/src/generators/kits/frames/_index.js +2 -0
  27. package/bundle/typescript/src/generators/kits/frames/_index.js.map +1 -0
  28. package/bundle/typescript/src/generators/kits/frames/frames.generator.d.ts +3 -0
  29. package/bundle/typescript/src/generators/kits/frames/frames.generator.js +166 -0
  30. package/bundle/typescript/src/generators/kits/frames/frames.generator.js.map +1 -0
  31. package/bundle/typescript/src/generators/kits/mui/auth.mui.gen.js +3 -2
  32. package/bundle/typescript/src/generators/kits/mui/auth.mui.gen.js.map +1 -1
  33. package/bundle/typescript/src/generators/layout.js +3 -1
  34. package/bundle/typescript/src/generators/layout.js.map +1 -1
  35. package/bundle/typescript/src/generators/package.js +3 -1
  36. package/bundle/typescript/src/generators/package.js.map +1 -1
  37. package/bundle/typescript/src/generators/page.js +3 -1
  38. package/bundle/typescript/src/generators/page.js.map +1 -1
  39. package/bundle/typescript/src/templates/meteor/template/template-tests.js.jsx +2 -2
  40. package/bundle/typescript/src/templates/meteor/template/template-tests.js.tsx +2 -2
  41. package/bundle/typescript/src/templates/meteor/template/template.js.jsx +2 -2
  42. package/bundle/typescript/src/templates/meteor/template/template.js.tsx +2 -2
  43. package/bundle/typescript/src/templates/react/hook/hook.js.jsx +1 -1
  44. package/bundle/typescript/src/templates/react/kit/auth/service/meteor-auth-service.js.jsx +4 -2
  45. package/bundle/typescript/src/templates/react/kit/frames/frames-demo.css +63 -0
  46. package/bundle/typescript/src/templates/react/kit/frames/frames-demo.jsx +153 -0
  47. package/bundle/typescript/src/templates/react/kit/frames/frames-demo.tsx +164 -0
  48. package/bundle/typescript/src/templates/react/kit/frames/workspace-manager.css +105 -0
  49. package/bundle/typescript/src/templates/react/kit/frames/workspace-manager.jsx +158 -0
  50. package/bundle/typescript/src/templates/react/kit/frames/workspace-manager.tsx +166 -0
  51. package/bundle/typescript/src/templates/react/kit/mui/auth/login/basic-login-page.js.jsx +3 -1
  52. package/bundle/typescript/src/templates/react/kit/mui/auth/login/basic-login-page.js.tsx +3 -1
  53. package/bundle/typescript/src/templates/react/test/test.js.jsx +2 -2
  54. package/bundle/typescript/src/templates/react/test/test.js.tsx +2 -2
  55. package/bundle/typescript/src/tools/fsi/fsi.interfaces.d.ts +3 -0
  56. package/bundle/typescript/src/tools/fsi/fsi.interfaces.js +3 -1
  57. package/bundle/typescript/src/tools/fsi/fsi.interfaces.js.map +1 -1
  58. package/docs/MCP_SERVER.md +396 -0
  59. package/package.json +8 -2
  60. package/bundle/typescript/src/commands/ai.js.map +0 -1
  61. /package/bundle/typescript/src/commands/{ai.d.ts → ai/mcp.sub.cmd.d.ts} +0 -0
@@ -0,0 +1,605 @@
1
+ import AICommand from './ai.command.js';
2
+ import Maka from '../maka.cmd.js';
3
+ import { Command } from '../../command.js';
4
+ import { Log } from '../../tools/log/log.class.js';
5
+ import express from 'express';
6
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
+ import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
8
+ import { z } from 'zod';
9
+ import cors from 'cors';
10
+ import path from 'path';
11
+ import fs from 'fs';
12
+ import { fileURLToPath } from 'url';
13
+ import { execSync } from 'child_process';
14
+ const __filename = fileURLToPath(import.meta.url);
15
+ const __dirname = path.dirname(__filename);
16
+ /**
17
+ * Get all commands from the Maka CLI
18
+ */
19
+ const getAllCommands = (cmd, prefix = '') => {
20
+ const commands = [];
21
+ if (cmd._commands && cmd._commands.length > 0) {
22
+ for (const subCmd of cmd._commands) {
23
+ const fullName = prefix ? `${prefix}:${subCmd.name}` : subCmd.name;
24
+ // Skip internal/hidden commands
25
+ if (subCmd.name === 'murder' || subCmd.name === 'play') {
26
+ continue;
27
+ }
28
+ commands.push({
29
+ name: fullName,
30
+ aliases: subCmd.aliases ? subCmd.aliases() : 'None',
31
+ shortDesc: subCmd.shortDesc ? subCmd.shortDesc() : '',
32
+ description: subCmd.description ? subCmd.description() : '',
33
+ usage: subCmd.options?.usage || `maka ${fullName}`,
34
+ examples: subCmd.options?.examples || [],
35
+ validOpts: subCmd.options?.validOpts || [],
36
+ requiredOpts: subCmd.options?.requiredOpts || [],
37
+ experimental: subCmd.experimental ? subCmd.experimental() : false
38
+ });
39
+ // Recursively get subcommands
40
+ const subCommands = getAllCommands(subCmd, fullName);
41
+ commands.push(...subCommands);
42
+ }
43
+ }
44
+ return commands;
45
+ };
46
+ /**
47
+ * Get project configuration if in a Maka project
48
+ */
49
+ const getProjectInfo = (projectPath) => {
50
+ try {
51
+ const configPath = path.join(projectPath, '.maka', 'config.json');
52
+ if (fs.existsSync(configPath)) {
53
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
54
+ return {
55
+ isMakaProject: true,
56
+ config,
57
+ projectPath
58
+ };
59
+ }
60
+ }
61
+ catch (e) {
62
+ // Not a Maka project or config error
63
+ }
64
+ return {
65
+ isMakaProject: false,
66
+ projectPath
67
+ };
68
+ };
69
+ /**
70
+ * Creates and configures the MCP server with tools and resources
71
+ */
72
+ const createMcpServer = (projectPath, tool) => {
73
+ const server = new McpServer({
74
+ name: 'maka-cli-mcp-server',
75
+ version: '1.0.0'
76
+ }, {
77
+ capabilities: {
78
+ logging: {},
79
+ tools: {},
80
+ resources: {},
81
+ prompts: {}
82
+ }
83
+ });
84
+ const commands = getAllCommands(Maka);
85
+ const projectInfo = getProjectInfo(projectPath);
86
+ // Tool: List all available Maka CLI commands
87
+ server.tool('list-maka-commands', 'List all available Maka CLI commands with descriptions. NOTE: Many commands support interactive prompts, but when using via MCP/API, always provide all required options as command-line flags to avoid interactive prompts.', {
88
+ filter: z.string().optional().describe('Filter commands by name or category (e.g., "aws", "generate", "deploy")')
89
+ }, async ({ filter }) => {
90
+ let filteredCommands = commands;
91
+ if (filter) {
92
+ filteredCommands = commands.filter(cmd => cmd.name.toLowerCase().includes(filter.toLowerCase()) ||
93
+ cmd.shortDesc.toLowerCase().includes(filter.toLowerCase()));
94
+ }
95
+ const commandList = filteredCommands.map(cmd => {
96
+ const experimental = cmd.experimental ? ' (experimental)' : '';
97
+ return `• maka ${cmd.name}${experimental}\n ${cmd.shortDesc}\n Usage: ${cmd.usage}`;
98
+ }).join('\n\n');
99
+ return {
100
+ content: [
101
+ {
102
+ type: 'text',
103
+ text: `Available Maka CLI Commands:\n\n${commandList}\n\nTotal: ${filteredCommands.length} commands\n\n⚠️ IMPORTANT NOTES:\n• All commands must be prefixed with "maka" when executing\n• Always provide all options as command-line flags (e.g., --option=value)\n• Never rely on interactive prompts - use get-command-info to see available options\n• Example: maka generate:page myPage --private --url=/custom-path`
104
+ }
105
+ ]
106
+ };
107
+ });
108
+ // Tool: Get detailed command information
109
+ server.tool('get-command-info', 'Get detailed information about a specific Maka CLI command', {
110
+ command: z.string().describe('Command name (e.g., "create", "generate:component", "aws:create-instance")')
111
+ }, async ({ command }) => {
112
+ const cmd = commands.find(c => c.name === command ||
113
+ c.name.replace(/:/g, '-') === command ||
114
+ c.aliases === command);
115
+ if (!cmd) {
116
+ return {
117
+ content: [
118
+ {
119
+ type: 'text',
120
+ text: `Command "${command}" not found. Use list-maka-commands to see available commands.`
121
+ }
122
+ ]
123
+ };
124
+ }
125
+ // Format valid options with details if available
126
+ const formatValidOpts = (opts) => {
127
+ if (!opts || opts.length === 0)
128
+ return null;
129
+ return opts.map((opt) => {
130
+ if (typeof opt === 'string') {
131
+ return ` --${opt}`;
132
+ }
133
+ else if (opt.name) {
134
+ const parts = [` --${opt.name}`];
135
+ if (opt.boolFlag)
136
+ parts.push(' (boolean flag)');
137
+ if (opt.description)
138
+ parts.push(`\n ${opt.description}`);
139
+ if (opt.values)
140
+ parts.push(`\n Allowed values: ${opt.values.join(', ')}`);
141
+ return parts.join('');
142
+ }
143
+ return ` --${opt}`;
144
+ }).join('\n');
145
+ };
146
+ const validOptsFormatted = formatValidOpts(cmd.validOpts);
147
+ const requiredOptsFormatted = cmd.requiredOpts?.length > 0
148
+ ? cmd.requiredOpts.map((o) => ` --${o.name || o}`).join('\n')
149
+ : null;
150
+ const details = [
151
+ `Command: maka ${cmd.name}`,
152
+ cmd.aliases !== 'None' ? `Aliases: maka ${cmd.aliases}` : null,
153
+ `\nDescription:\n${cmd.description || cmd.shortDesc}`,
154
+ `\nUsage:\n${cmd.usage}`,
155
+ requiredOptsFormatted ? `\n⚠️ Required Options (must be provided):\n${requiredOptsFormatted}` : null,
156
+ validOptsFormatted ? `\nAvailable Options:\n${validOptsFormatted}` : null,
157
+ cmd.examples?.length > 0 ? `\nExamples:\n${cmd.examples.map((e) => ` ${e}`).join('\n')}` : null,
158
+ cmd.experimental ? '\n⚠️ This is an experimental command' : null,
159
+ `\n💡 IMPORTANT: When executing via MCP/API:`,
160
+ ` • Always provide options as flags: --option=value or --flag`,
161
+ ` • Do not rely on interactive prompts`,
162
+ ` • Use: maka ${cmd.name} <args> [--option=value ...]`
163
+ ].filter(Boolean).join('\n');
164
+ return {
165
+ content: [
166
+ {
167
+ type: 'text',
168
+ text: details
169
+ }
170
+ ]
171
+ };
172
+ });
173
+ // Tool: Execute Maka CLI command (read-only operations)
174
+ server.tool('execute-maka-command', 'Execute a Maka CLI command (use with caution - some commands may modify files). CRITICAL: (1) Always include "maka" prefix, (2) Always provide ALL options as command-line flags to avoid interactive prompts, (3) Use get-command-info first to see available options.', {
175
+ command: z.string().describe('Full command with all options as flags (e.g., "maka create myApp --js=jsx --css=scss", "maka generate:page homePage --private --url=/home"). NEVER rely on interactive prompts - always specify options explicitly.'),
176
+ workingDirectory: z.string().optional().describe('Working directory for the command (defaults to current project path)')
177
+ }, async ({ command, workingDirectory }) => {
178
+ try {
179
+ const cwd = workingDirectory || projectPath;
180
+ // Ensure command starts with "maka"
181
+ let fullCommand = command.trim();
182
+ if (!fullCommand.startsWith('maka ') && !fullCommand.startsWith('maka\t')) {
183
+ fullCommand = `maka ${fullCommand}`;
184
+ }
185
+ // Safety check: prevent destructive operations
186
+ const dangerousCommands = ['murder', 'uninstall', 'rm', 'delete'];
187
+ if (dangerousCommands.some(cmd => fullCommand.toLowerCase().includes(cmd))) {
188
+ return {
189
+ content: [
190
+ {
191
+ type: 'text',
192
+ text: '⚠️ This command may be destructive and cannot be executed via MCP for safety reasons.'
193
+ }
194
+ ]
195
+ };
196
+ }
197
+ const output = execSync(fullCommand, {
198
+ cwd,
199
+ encoding: 'utf-8',
200
+ timeout: 30000,
201
+ maxBuffer: 10 * 1024 * 1024 // 10MB
202
+ });
203
+ return {
204
+ content: [
205
+ {
206
+ type: 'text',
207
+ text: `✅ Command executed successfully:\n${fullCommand}\n\nOutput:\n${output}`
208
+ }
209
+ ]
210
+ };
211
+ }
212
+ catch (error) {
213
+ return {
214
+ content: [
215
+ {
216
+ type: 'text',
217
+ text: `Error executing command:\n${error.message}\n\nStderr: ${error.stderr || 'N/A'}`
218
+ }
219
+ ]
220
+ };
221
+ }
222
+ });
223
+ // Tool: Get project information
224
+ server.tool('get-project-info', 'Get information about the current Maka project', {}, async () => {
225
+ if (!projectInfo.isMakaProject) {
226
+ return {
227
+ content: [
228
+ {
229
+ type: 'text',
230
+ text: `Current directory is not a Maka project.\nPath: ${projectPath}\n\nTo create a new Maka project, use: maka create <app-name>`
231
+ }
232
+ ]
233
+ };
234
+ }
235
+ const info = [
236
+ `Project Information:`,
237
+ `\nProject Path: ${projectPath}`,
238
+ `\nConfiguration:\n${JSON.stringify(projectInfo.config, null, 2)}`
239
+ ].join('\n');
240
+ return {
241
+ content: [
242
+ {
243
+ type: 'text',
244
+ text: info
245
+ }
246
+ ]
247
+ };
248
+ });
249
+ // Resource: Maka CLI Commands Reference
250
+ server.resource('maka-commands-reference', 'maka://commands/all', {
251
+ mimeType: 'application/json',
252
+ description: 'Complete reference of all Maka CLI commands in JSON format'
253
+ }, async () => {
254
+ return {
255
+ contents: [
256
+ {
257
+ uri: 'maka://commands/all',
258
+ mimeType: 'application/json',
259
+ text: JSON.stringify(commands, null, 2)
260
+ }
261
+ ]
262
+ };
263
+ });
264
+ // Resource: Project Configuration
265
+ server.resource('project-config', 'maka://project/config', {
266
+ mimeType: 'application/json',
267
+ description: 'Current project configuration'
268
+ }, async () => {
269
+ return {
270
+ contents: [
271
+ {
272
+ uri: 'maka://project/config',
273
+ mimeType: 'application/json',
274
+ text: JSON.stringify(projectInfo, null, 2)
275
+ }
276
+ ]
277
+ };
278
+ });
279
+ // Resource: Maka CLI Version and Info
280
+ server.resource('maka-info', 'maka://info', {
281
+ mimeType: 'application/json',
282
+ description: 'Maka CLI version and system information'
283
+ }, async () => {
284
+ try {
285
+ const versionOutput = execSync('maka --version', {
286
+ encoding: 'utf-8',
287
+ cwd: projectPath
288
+ }).trim();
289
+ return {
290
+ contents: [
291
+ {
292
+ uri: 'maka://info',
293
+ mimeType: 'application/json',
294
+ text: JSON.stringify({
295
+ version: versionOutput,
296
+ platform: process.platform,
297
+ nodeVersion: process.version,
298
+ cwd: projectPath
299
+ }, null, 2)
300
+ }
301
+ ]
302
+ };
303
+ }
304
+ catch (error) {
305
+ return {
306
+ contents: [
307
+ {
308
+ uri: 'maka://info',
309
+ mimeType: 'application/json',
310
+ text: JSON.stringify({
311
+ error: 'Failed to get Maka CLI version',
312
+ message: error.message
313
+ }, null, 2)
314
+ }
315
+ ]
316
+ };
317
+ }
318
+ });
319
+ // Prompt: Create new component
320
+ server.prompt('create-component', 'Generate a prompt for creating a new component with Maka CLI', {
321
+ componentName: z.string().describe('Name of the component to create'),
322
+ componentType: z.enum(['component', 'page', 'layout', 'template']).optional().describe('Type of component (default: component)')
323
+ }, async ({ componentName, componentType }) => {
324
+ const type = componentType || 'component';
325
+ return {
326
+ messages: [
327
+ {
328
+ role: 'user',
329
+ content: {
330
+ type: 'text',
331
+ text: `I want to create a new ${type} named "${componentName}" in my Maka project. Can you help me with the correct command and explain what it will generate?`
332
+ }
333
+ },
334
+ {
335
+ role: 'assistant',
336
+ content: {
337
+ type: 'text',
338
+ text: `I'll help you create a ${type} named "${componentName}".\n\nCommand:\nmaka generate:${type} ${componentName}\n\nThis will create:\n- Component file with boilerplate code\n- Associated test file\n- Styles/CSS file\n- Proper imports and exports\n\nWould you like me to show you more options or execute this command?`
339
+ }
340
+ }
341
+ ]
342
+ };
343
+ });
344
+ // Prompt: Deployment helper
345
+ server.prompt('deploy-help', 'Get help with deploying a Maka application', {
346
+ environment: z.enum(['dev', 'staging', 'production']).optional().describe('Target environment'),
347
+ platform: z.enum(['aws', 'docker', 'custom']).optional().describe('Deployment platform')
348
+ }, async ({ environment, platform }) => {
349
+ const env = environment || 'production';
350
+ const plat = platform || 'aws';
351
+ return {
352
+ messages: [
353
+ {
354
+ role: 'user',
355
+ content: {
356
+ type: 'text',
357
+ text: `I need help deploying my Maka application to ${env} environment using ${plat}. What are the steps?`
358
+ }
359
+ },
360
+ {
361
+ role: 'assistant',
362
+ content: {
363
+ type: 'text',
364
+ text: `Here's a guide for deploying to ${env} using ${plat}:\n\n` +
365
+ (plat === 'aws' ?
366
+ `AWS Deployment Steps:\n1. Configure AWS credentials\n2. Use: maka aws:create-instance --env ${env}\n3. Use: maka deploy --env ${env}\n\nAvailable AWS commands:\n- maka aws:create-instance\n- maka aws:set-host\n- maka aws:terminate-instance\n\nWould you like details on any specific step?` :
367
+ plat === 'docker' ?
368
+ `Docker Deployment Steps:\n1. Build: maka build:docker\n2. Configure your docker-compose.yml\n3. Deploy: docker-compose up -d\n\nWould you like help with Docker configuration?` :
369
+ `Custom Deployment:\n1. Build your app: maka run --production\n2. Configure your deployment settings\n3. Use maka deploy command with custom settings\n\nWould you like help with custom deployment configuration?`)
370
+ }
371
+ }
372
+ ]
373
+ };
374
+ });
375
+ // Prompt: How to use Maka commands via MCP
376
+ server.prompt('mcp-command-usage', 'Guide on how to properly execute Maka commands via MCP (avoiding interactive prompts)', {}, async () => {
377
+ return {
378
+ messages: [
379
+ {
380
+ role: 'user',
381
+ content: {
382
+ type: 'text',
383
+ text: 'How do I properly execute Maka CLI commands through the MCP server?'
384
+ }
385
+ },
386
+ {
387
+ role: 'assistant',
388
+ content: {
389
+ type: 'text',
390
+ text: `📘 Guide: Executing Maka Commands via MCP
391
+
392
+ 🔑 KEY RULES:
393
+ 1. Always prefix commands with "maka"
394
+ 2. Never rely on interactive prompts
395
+ 3. Always provide ALL options as command-line flags
396
+ 4. Use get-command-info tool first to see available options
397
+
398
+ ✅ CORRECT USAGE:
399
+ • maka create myApp --js=jsx --css=scss --client=react
400
+ • maka generate:page homePage --private --url=/home
401
+ • maka generate:component Button --baseDir=components
402
+ • maka generate:api Users --withMethods --withRest
403
+
404
+ ❌ INCORRECT USAGE:
405
+ • generate:page homePage (missing "maka" prefix)
406
+ • maka create myApp (missing required options, will prompt)
407
+ • maka generate:page (missing page name)
408
+
409
+ 📋 WORKFLOW:
410
+ 1. Use list-maka-commands to find the command
411
+ 2. Use get-command-info to see all available options
412
+ 3. Execute with execute-maka-command, providing all options
413
+ 4. Check the output for success/errors
414
+
415
+ 💡 TIP: Boolean flags don't need values:
416
+ --private (not --private=true)
417
+
418
+ Would you like to see specific examples for any command?`
419
+ }
420
+ }
421
+ ]
422
+ };
423
+ });
424
+ // Prompt: Project setup wizard
425
+ server.prompt('project-setup', 'Interactive guide for setting up a new Maka project', {
426
+ projectType: z.enum(['basic', 'full-stack', 'api']).optional().describe('Type of project to create')
427
+ }, async ({ projectType }) => {
428
+ const type = projectType || 'basic';
429
+ return {
430
+ messages: [
431
+ {
432
+ role: 'user',
433
+ content: {
434
+ type: 'text',
435
+ text: `I want to create a new ${type} Maka project. Can you guide me through the setup?`
436
+ }
437
+ },
438
+ {
439
+ role: 'assistant',
440
+ content: {
441
+ type: 'text',
442
+ text: `I'll guide you through creating a ${type} Maka project!\n\n` +
443
+ `Step 1: Create the project\n` +
444
+ `Command: maka create <your-app-name>\n\n` +
445
+ `Step 2: Navigate to your project\n` +
446
+ `Command: cd <your-app-name>\n\n` +
447
+ `Step 3: Install dependencies\n` +
448
+ `Command: maka install meteor\n\n` +
449
+ `Step 4: Run your app\n` +
450
+ `Command: maka run\n\n` +
451
+ `Additional setup options:\n` +
452
+ `- Generate components: maka generate:component <name>\n` +
453
+ `- Add API routes: maka generate:api <name>\n` +
454
+ `- Configure deployment: Use maka deploy commands\n\n` +
455
+ `Would you like help with any specific step?`
456
+ }
457
+ }
458
+ ]
459
+ };
460
+ });
461
+ return server;
462
+ };
463
+ Command.create({
464
+ name: 'mcp',
465
+ usage: 'maka ai:mcp [--port=3000] [--host=localhost]',
466
+ validOpts: ['port', 'host'],
467
+ shortDesc: 'Start an MCP server with HTTP transport',
468
+ description: `
469
+ Start a Model Context Protocol (MCP) server with HTTP transport.
470
+
471
+ The server exposes Maka CLI capabilities, commands, and project information
472
+ to MCP clients like Claude Desktop or other AI assistants.
473
+
474
+ Features:
475
+ • List all available commands
476
+ • Get detailed command documentation
477
+ • Execute Maka CLI commands (with safety restrictions)
478
+ • Access project information and configuration
479
+ • Interactive prompts for common workflows
480
+
481
+ Options:
482
+ --port Port to listen on (default: 3000)
483
+ --host Host to bind to (default: localhost)
484
+ `,
485
+ examples: [
486
+ 'maka ai:mcp',
487
+ 'maka ai:mcp --port=8080',
488
+ 'maka ai:mcp --host=0.0.0.0 --port=3001'
489
+ ]
490
+ }, async function (args, opts) {
491
+ try {
492
+ const port = opts.port || 5050;
493
+ const host = opts.host || 'localhost';
494
+ const projectPath = process.cwd();
495
+ Log.notice(`Starting Maka CLI MCP Server`);
496
+ Log.bright(`Project: ${projectPath}`);
497
+ const app = express();
498
+ app.use(express.json());
499
+ // Configure CORS to expose Mcp-Session-Id header for browser-based clients
500
+ app.use(cors({
501
+ origin: '*', // Allow all origins - adjust as needed for production
502
+ exposedHeaders: ['Mcp-Session-Id']
503
+ }));
504
+ // Health check endpoint
505
+ app.get('/health', (req, res) => {
506
+ res.json({
507
+ status: 'ok',
508
+ name: 'maka-cli-mcp-server',
509
+ version: '1.0.0',
510
+ projectPath
511
+ });
512
+ });
513
+ // Main MCP endpoint
514
+ app.post('/mcp', async (req, res) => {
515
+ const server = createMcpServer(projectPath, this);
516
+ try {
517
+ const transport = new StreamableHTTPServerTransport({
518
+ sessionIdGenerator: undefined // Stateless mode
519
+ });
520
+ await server.connect(transport);
521
+ await transport.handleRequest(req, res, req.body);
522
+ res.on('close', () => {
523
+ transport.close().catch(console.error);
524
+ server.close().catch(console.error);
525
+ });
526
+ }
527
+ catch (error) {
528
+ console.error('Error handling MCP request:', error);
529
+ if (!res.headersSent) {
530
+ res.status(500).json({
531
+ jsonrpc: '2.0',
532
+ error: {
533
+ code: -32603,
534
+ message: 'Internal server error'
535
+ },
536
+ id: null
537
+ });
538
+ }
539
+ }
540
+ });
541
+ // Handle unsupported methods on /mcp endpoint
542
+ app.get('/mcp', (req, res) => {
543
+ res.status(405).json({
544
+ jsonrpc: '2.0',
545
+ error: {
546
+ code: -32000,
547
+ message: 'Method not allowed. Use POST for MCP requests.'
548
+ },
549
+ id: null
550
+ });
551
+ });
552
+ app.delete('/mcp', (req, res) => {
553
+ res.status(405).json({
554
+ jsonrpc: '2.0',
555
+ error: {
556
+ code: -32000,
557
+ message: 'Method not allowed.'
558
+ },
559
+ id: null
560
+ });
561
+ });
562
+ // Start the server
563
+ const server = app.listen(port, host, () => {
564
+ Log.success(`MCP Server listening on http://${host}:${port}`);
565
+ Log.notice('\nEndpoints:');
566
+ Log.bright(` POST http://${host}:${port}/mcp - MCP protocol endpoint`);
567
+ Log.bright(` GET http://${host}:${port}/health - Health check`);
568
+ Log.notice('\nAvailable Tools:');
569
+ Log.bright(' • list-maka-commands - List all Maka CLI commands');
570
+ Log.bright(' • get-command-info - Get detailed command information');
571
+ Log.bright(' • execute-maka-command - Execute Maka CLI commands');
572
+ Log.bright(' • get-project-info - Get current project information');
573
+ Log.notice('\nAvailable Resources:');
574
+ Log.bright(' • maka://commands/all - Complete commands reference');
575
+ Log.bright(' • maka://project/config - Project configuration');
576
+ Log.bright(' • maka://info - Maka CLI version and system info');
577
+ Log.notice('\nAvailable Prompts:');
578
+ Log.bright(' • mcp-command-usage - Guide for using commands via MCP (READ THIS FIRST!)');
579
+ Log.bright(' • create-component - Component creation wizard');
580
+ Log.bright(' • deploy-help - Deployment assistance');
581
+ Log.bright(' • project-setup - Project setup guide');
582
+ Log.notice('\n⚠️ IMPORTANT for AI Clients:');
583
+ Log.bright(' • Always provide options as command-line flags');
584
+ Log.bright(' • Never rely on interactive prompts');
585
+ Log.bright(' • Use get-command-info to see available options');
586
+ Log.header('\n Press Ctrl+C to stop the server');
587
+ });
588
+ // Handle graceful shutdown
589
+ const shutdown = async () => {
590
+ Log.notice('\nShutting down MCP server...');
591
+ server.close(() => {
592
+ Log.success('Server stopped');
593
+ process.exit(0);
594
+ });
595
+ };
596
+ process.on('SIGINT', shutdown);
597
+ process.on('SIGTERM', shutdown);
598
+ }
599
+ catch (e) {
600
+ Log.error('Failed to start MCP server');
601
+ console.error(e);
602
+ process.exit(1);
603
+ }
604
+ }, AICommand);
605
+ //# sourceMappingURL=mcp.sub.cmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.sub.cmd.js","sourceRoot":"","sources":["../../../../../src/commands/ai/mcp.sub.cmd.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAC;AACnD,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAO3C;;GAEG;AACH,MAAM,cAAc,GAAG,CAA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