mcpgraph-ux 0.1.1 → 0.1.2

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.
@@ -1,6 +1,9 @@
1
1
  import { NextResponse } from 'next/server';
2
2
  import { McpGraphApi, type NodeDefinition } from 'mcpgraph';
3
3
 
4
+ // Force dynamic rendering - this route requires runtime config
5
+ export const dynamic = 'force-dynamic';
6
+
4
7
  let apiInstance: McpGraphApi | null = null;
5
8
 
6
9
  function getApi(): McpGraphApi {
@@ -1,6 +1,9 @@
1
1
  import { NextResponse } from 'next/server';
2
2
  import { McpGraphApi } from 'mcpgraph';
3
3
 
4
+ // Force dynamic rendering - this route requires runtime config
5
+ export const dynamic = 'force-dynamic';
6
+
4
7
  let apiInstance: McpGraphApi | null = null;
5
8
 
6
9
  function getApi(): McpGraphApi {
@@ -1,6 +1,9 @@
1
1
  import { NextResponse } from 'next/server';
2
2
  import { McpGraphApi } from 'mcpgraph';
3
3
 
4
+ // Force dynamic rendering - this route requires runtime config
5
+ export const dynamic = 'force-dynamic';
6
+
4
7
  let apiInstance: McpGraphApi | null = null;
5
8
 
6
9
  function getApi(): McpGraphApi {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcpgraph-ux",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Visual interface for mcpGraph - visualize and test MCP tool execution graphs",
5
5
  "main": "server.ts",
6
6
  "bin": {
package/server.ts CHANGED
@@ -3,11 +3,19 @@
3
3
  /**
4
4
  * Server entry point for mcpGraph UX
5
5
  *
6
- * Usage: npm run server <port> <config-path>
7
- * Example: npm run server 3000 ../mcpGraph/examples/count_files.yaml
6
+ * Usage:
7
+ * npm run server <port> <config-path>
8
+ * Example: npm run server 3000 ../mcpGraph/examples/count_files.yaml
9
+ *
10
+ * Or set MCPGRAPH_CONFIG_PATH environment variable:
11
+ * MCPGRAPH_CONFIG_PATH=../mcpGraph/examples/count_files.yaml npm run server 3000
8
12
  *
9
13
  * Or with tsx directly:
10
- * tsx server.ts 3000 ../mcpGraph/examples/count_files.yaml
14
+ * tsx server.ts 3000 ../mcpGraph/examples/count_files.yaml
15
+ *
16
+ * The config path can be provided either as:
17
+ * - Command-line argument (3rd argument)
18
+ * - MCPGRAPH_CONFIG_PATH environment variable (takes precedence)
11
19
  */
12
20
 
13
21
  import { createServer } from 'http';
@@ -18,18 +26,24 @@ import { resolve } from 'path';
18
26
  const port = parseInt(process.argv[2] || '3000', 10);
19
27
  const configPathArg = process.argv[3];
20
28
 
21
- if (!configPathArg) {
29
+ // Use env var if set, otherwise use command-line argument
30
+ let configPath: string;
31
+ if (process.env.MCPGRAPH_CONFIG_PATH) {
32
+ configPath = resolve(process.cwd(), process.env.MCPGRAPH_CONFIG_PATH);
33
+ console.log(`Using config path from MCPGRAPH_CONFIG_PATH env var: ${configPath}`);
34
+ } else if (configPathArg) {
35
+ configPath = resolve(process.cwd(), configPathArg);
36
+ // Store config path in environment variable for API routes
37
+ process.env.MCPGRAPH_CONFIG_PATH = configPath;
38
+ } else {
22
39
  console.error('Usage: npm run server <port> <config-path>');
23
40
  console.error('Example: npm run server 3000 ../mcpGraph/examples/count_files.yaml');
41
+ console.error('');
42
+ console.error('Alternatively, set MCPGRAPH_CONFIG_PATH environment variable:');
43
+ console.error(' MCPGRAPH_CONFIG_PATH=../mcpGraph/examples/count_files.yaml npm run server 3000');
24
44
  process.exit(1);
25
45
  }
26
46
 
27
- // Resolve config path to absolute path
28
- const configPath = resolve(process.cwd(), configPathArg);
29
-
30
- // Store config path in environment variable for API routes
31
- process.env.MCPGRAPH_CONFIG_PATH = configPath;
32
-
33
47
  const dev = process.env.NODE_ENV !== 'production';
34
48
  const app = next({ dev });
35
49
  const handle = app.getRequestHandler();