nitrostack 1.0.14 → 1.0.16

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 (43) hide show
  1. package/CHANGELOG.md +29 -295
  2. package/README.md +9 -1
  3. package/dist/cli/commands/dev.d.ts.map +1 -1
  4. package/dist/cli/commands/dev.js +2 -1
  5. package/dist/cli/commands/dev.js.map +1 -1
  6. package/dist/cli/mcp-dev-wrapper.js +30 -17
  7. package/dist/cli/mcp-dev-wrapper.js.map +1 -1
  8. package/dist/core/transports/http-server.d.ts.map +1 -1
  9. package/dist/core/transports/http-server.js +21 -1
  10. package/dist/core/transports/http-server.js.map +1 -1
  11. package/package.json +8 -6
  12. package/src/studio/app/api/chat/route.ts +12 -1
  13. package/src/studio/app/api/init/route.ts +28 -4
  14. package/src/studio/app/auth/page.tsx +13 -9
  15. package/src/studio/app/chat/page.tsx +544 -133
  16. package/src/studio/app/health/page.tsx +101 -99
  17. package/src/studio/app/layout.tsx +23 -3
  18. package/src/studio/app/page.tsx +61 -56
  19. package/src/studio/app/ping/page.tsx +13 -8
  20. package/src/studio/app/prompts/page.tsx +72 -70
  21. package/src/studio/app/resources/page.tsx +88 -86
  22. package/src/studio/app/settings/page.tsx +270 -0
  23. package/src/studio/components/Sidebar.tsx +197 -35
  24. package/src/studio/lib/http-client-transport.ts +222 -0
  25. package/src/studio/lib/llm-service.ts +97 -0
  26. package/src/studio/lib/log-manager.ts +76 -0
  27. package/src/studio/lib/mcp-client.ts +103 -13
  28. package/src/studio/package-lock.json +622 -189
  29. package/src/studio/package.json +1 -0
  30. package/templates/typescript-auth/README.md +3 -1
  31. package/templates/typescript-auth/src/db/database.ts +5 -8
  32. package/templates/typescript-auth/src/index.ts +13 -2
  33. package/templates/typescript-auth/src/modules/addresses/addresses.tools.ts +49 -6
  34. package/templates/typescript-auth/src/modules/cart/cart.tools.ts +13 -17
  35. package/templates/typescript-auth/src/modules/orders/orders.tools.ts +38 -16
  36. package/templates/typescript-auth/src/modules/products/products.tools.ts +4 -4
  37. package/templates/typescript-auth/src/widgets/app/order-confirmation/page.tsx +25 -0
  38. package/templates/typescript-auth/src/widgets/app/products-grid/page.tsx +26 -1
  39. package/templates/typescript-auth-api-key/README.md +3 -1
  40. package/templates/typescript-auth-api-key/src/index.ts +11 -3
  41. package/templates/typescript-starter/README.md +3 -1
  42. package/templates/typescript-auth-api-key/.env +0 -15
  43. package/templates/typescript-auth-api-key/package-lock.json +0 -124
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitrostack",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "NitroStack - Build powerful MCP servers with TypeScript",
5
5
  "type": "module",
6
6
  "main": "dist/core/index.js",
@@ -65,12 +65,12 @@
65
65
  "express": "^4.21.2",
66
66
  "fs-extra": "^11.3.2",
67
67
  "http-proxy-middleware": "^3.0.3",
68
- "inquirer": "^12.10.0",
68
+ "inquirer": "^9.3.7",
69
69
  "jose": "^6.1.0",
70
70
  "jsonwebtoken": "^9.0.2",
71
- "open": "^10.2.0",
71
+ "open": "^10.1.0",
72
72
  "openai": "^6.5.0",
73
- "ora": "^9.0.0",
73
+ "ora": "^8.1.1",
74
74
  "reflect-metadata": "^0.2.1",
75
75
  "uuid": "^11.0.5",
76
76
  "winston": "^3.17.0",
@@ -84,6 +84,7 @@
84
84
  "@types/cors": "^2.8.19",
85
85
  "@types/express": "^5.0.0",
86
86
  "@types/fs-extra": "^11.0.4",
87
+ "@types/inquirer": "^9.0.9",
87
88
  "@types/jest": "^29.5.14",
88
89
  "@types/jsonwebtoken": "^9.0.7",
89
90
  "@types/node": "^22.10.5",
@@ -95,7 +96,8 @@
95
96
  "typescript": "^5.7.2"
96
97
  },
97
98
  "engines": {
98
- "node": ">=18.0.0"
99
+ "node": ">=18.0.0",
100
+ "npm": ">=9.0.0"
99
101
  },
100
102
  "repository": {
101
103
  "type": "git",
@@ -105,4 +107,4 @@
105
107
  "url": "https://github.com/abhishekpanditofficial/nitrostack/issues"
106
108
  },
107
109
  "homepage": "https://nitrostack.vercel.app"
108
- }
110
+ }
@@ -18,7 +18,10 @@ export async function POST(request: NextRequest) {
18
18
  provider,
19
19
  messagesCount: messages?.length,
20
20
  messages: JSON.stringify(messages),
21
- hasApiKey: !!apiKey
21
+ hasApiKey: !!apiKey,
22
+ hasJwtToken: !!jwtToken,
23
+ hasMcpApiKey: !!mcpApiKey,
24
+ jwtTokenPreview: jwtToken ? jwtToken.substring(0, 20) + '...' : null
22
25
  });
23
26
 
24
27
  if (!provider || !messages || !apiKey) {
@@ -69,6 +72,14 @@ export async function POST(request: NextRequest) {
69
72
  toolArgs._meta.apiKey = mcpApiKey;
70
73
  toolArgs._meta['x-api-key'] = mcpApiKey;
71
74
  }
75
+
76
+ console.log(`🔐 Executing tool "${toolCall.name}" with auth:`, {
77
+ hasJwt: !!jwtToken,
78
+ hasMcpApiKey: !!mcpApiKey,
79
+ metaKeys: Object.keys(toolArgs._meta)
80
+ });
81
+ } else {
82
+ console.log(`⚠️ Executing tool "${toolCall.name}" WITHOUT auth tokens`);
72
83
  }
73
84
 
74
85
  // Execute tool via MCP client
@@ -24,11 +24,33 @@ function loadEnvFile(projectPath: string): Record<string, string> {
24
24
  return envVars;
25
25
  }
26
26
 
27
- export async function POST() {
27
+ export async function POST(request: Request) {
28
28
  try {
29
29
  const client = getMcpClient();
30
30
 
31
- // Get MCP server config from environment
31
+ // Parse request body to get transport configuration
32
+ const body = await request.json().catch(() => ({}));
33
+ const transportType = body.transport || 'stdio'; // Default to stdio for backward compatibility
34
+
35
+ if (!client.isConnected()) {
36
+ if (transportType === 'http') {
37
+ // HTTP Transport Configuration
38
+ const baseUrl = body.baseUrl || process.env.MCP_HTTP_URL || 'http://localhost:3000';
39
+ const basePath = body.basePath || '/mcp';
40
+ const headers = body.headers || {};
41
+
42
+ console.log(`🌐 Connecting via HTTP transport to ${baseUrl}${basePath}`);
43
+
44
+ await client.connect({
45
+ type: 'http',
46
+ baseUrl,
47
+ basePath,
48
+ headers,
49
+ });
50
+
51
+ console.log('✅ MCP client connected successfully via HTTP');
52
+ } else {
53
+ // STDIO Transport Configuration (default)
32
54
  const command = process.env.MCP_COMMAND || 'node';
33
55
  const argsString = process.env.MCP_ARGS || '';
34
56
 
@@ -44,7 +66,6 @@ export async function POST() {
44
66
  }
45
67
  }
46
68
 
47
- if (!client.isConnected()) {
48
69
  // Get project directory from the MCP server path
49
70
  // If using wrapper, the actual server path is the second argument
50
71
  const serverPath = args.length > 1 ? args[1] : args[0];
@@ -59,6 +80,7 @@ export async function POST() {
59
80
  console.log(`📝 Command: ${command} ${args.join(' ')}`);
60
81
 
61
82
  await client.connect({
83
+ type: 'stdio',
62
84
  command,
63
85
  args,
64
86
  env: {
@@ -68,12 +90,14 @@ export async function POST() {
68
90
  cwd: projectPath, // Set working directory to project root
69
91
  });
70
92
 
71
- console.log('✅ MCP client connected successfully');
93
+ console.log('✅ MCP client connected successfully via STDIO');
94
+ }
72
95
  }
73
96
 
74
97
  return NextResponse.json({
75
98
  success: true,
76
99
  message: 'MCP client connected',
100
+ transport: client.getTransportType(),
77
101
  });
78
102
  } catch (error: any) {
79
103
  console.error('Failed to connect MCP client:', error);
@@ -166,21 +166,23 @@ export default function AuthPage() {
166
166
  };
167
167
 
168
168
  return (
169
- <div className="min-h-screen bg-background p-8">
170
- {/* Header */}
171
- <div className="mb-8">
172
- <div className="flex items-center gap-3 mb-4">
173
- <div className="w-12 h-12 rounded-lg bg-gradient-to-br from-violet-500 to-purple-500 flex items-center justify-center">
174
- <Shield className="w-6 h-6 text-white" />
169
+ <div className="fixed inset-0 flex flex-col bg-background" style={{ left: 'var(--sidebar-width, 15rem)' }}>
170
+ {/* Sticky Header */}
171
+ <div className="sticky top-0 z-10 border-b border-border/50 px-6 py-3 flex items-center justify-between bg-card/80 backdrop-blur-md shadow-sm">
172
+ <div className="flex items-center gap-3">
173
+ <div className="w-8 h-8 rounded-lg bg-gradient-to-br from-violet-500 to-purple-500 flex items-center justify-center shadow-md">
174
+ <Shield className="w-5 h-5 text-white" strokeWidth={2.5} />
175
175
  </div>
176
176
  <div>
177
- <h1 className="text-3xl font-bold text-foreground">Authentication</h1>
178
- <p className="text-muted-foreground mt-1">OAuth 2.1 / JWT / API Key authentication</p>
177
+ <h1 className="text-lg font-bold text-foreground">OAuth 2.1</h1>
179
178
  </div>
180
179
  </div>
181
180
  </div>
182
181
 
183
- <div className="max-w-4xl mx-auto space-y-6">
182
+ {/* Content - ONLY this scrolls */}
183
+ <div className="flex-1 overflow-y-auto overflow-x-hidden">
184
+ <div className="max-w-4xl mx-auto px-6 py-6">
185
+ <div className="space-y-6">
184
186
  {/* JWT Token Management */}
185
187
  <div className="card card-hover p-6">
186
188
  <h2 className="text-xl font-semibold text-foreground mb-4 flex items-center gap-2">
@@ -537,6 +539,8 @@ export default function AuthPage() {
537
539
  </div>
538
540
  </div>
539
541
  </div>
542
+ </div>
543
+ </div>
540
544
  </div>
541
545
  </div>
542
546
  );