impact-ui-mcp-server 1.0.2 → 1.0.3

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.
@@ -102,21 +102,51 @@ if (useNpm) {
102
102
  console.log(" Make sure to install: npm install impact-ui-mcp-server\n");
103
103
  }
104
104
  } else {
105
- // Local development configuration
106
- const mcpServerPath = resolve(__dirname);
107
- const indexPath = resolve(__dirname, "src/index.js");
105
+ // For npm packages (when run from a project), use ${workspaceFolder} variables
106
+ // Try to detect if we're in a project with node_modules
107
+ const cwd = process.cwd();
108
+ let mcpServerPath = "${workspaceFolder}/frontend/node_modules/impact-ui-mcp-server/src/index.js";
109
+ let impactUiPath = "${workspaceFolder}/frontend/node_modules/impact-ui";
110
+
111
+ // Check actual structure to determine which path to use
112
+ const frontendMcpPath = resolve(cwd, "frontend", "node_modules", "impact-ui-mcp-server", "src", "index.js");
113
+ const rootMcpPath = resolve(cwd, "node_modules", "impact-ui-mcp-server", "src", "index.js");
114
+
115
+ if (existsSync(frontendMcpPath)) {
116
+ // Packages are in frontend/node_modules
117
+ mcpServerPath = "${workspaceFolder}/frontend/node_modules/impact-ui-mcp-server/src/index.js";
118
+ impactUiPath = "${workspaceFolder}/frontend/node_modules/impact-ui";
119
+ } else if (existsSync(rootMcpPath)) {
120
+ // Packages are in root node_modules
121
+ mcpServerPath = "${workspaceFolder}/node_modules/impact-ui-mcp-server/src/index.js";
122
+ impactUiPath = "${workspaceFolder}/node_modules/impact-ui";
123
+ }
124
+
125
+ // Check for scoped package name
126
+ const frontendScopedMcpPath = resolve(cwd, "frontend", "node_modules", "@impact-analytics", "impact-ui-mcp-server", "src", "index.js");
127
+ const rootScopedMcpPath = resolve(cwd, "node_modules", "@impact-analytics", "impact-ui-mcp-server", "src", "index.js");
128
+
129
+ if (existsSync(frontendScopedMcpPath)) {
130
+ mcpServerPath = "${workspaceFolder}/frontend/node_modules/@impact-analytics/impact-ui-mcp-server/src/index.js";
131
+ } else if (existsSync(rootScopedMcpPath)) {
132
+ mcpServerPath = "${workspaceFolder}/node_modules/@impact-analytics/impact-ui-mcp-server/src/index.js";
133
+ }
108
134
 
109
135
  config = {
110
136
  "mcp.servers": {
111
137
  "impact-ui": {
112
138
  "command": "node",
113
- "args": [indexPath],
114
- "cwd": mcpServerPath
139
+ "args": [mcpServerPath],
140
+ "cwd": "${workspaceFolder}",
141
+ "env": {
142
+ "IMPACT_UI_NODE_MODULES": impactUiPath
143
+ }
115
144
  }
116
145
  }
117
146
  };
118
147
 
119
- console.log("\n🏠 Local Development Configuration\n");
148
+ console.log("\n📦 NPM Package Configuration (with ${workspaceFolder} variables)\n");
149
+ console.log("💡 Detected package structure and using ${workspaceFolder} variables for Cursor.\n");
120
150
  }
121
151
 
122
152
  console.log("Add this to your Cursor settings.json:\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impact-ui-mcp-server",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "MCP Server for Impact UI Library - Provides AI access to component documentation and code examples",
5
5
  "type": "module",
6
6
  "main": "src/index.js",