impact-ui-mcp-server 1.0.0 → 1.0.1

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.
@@ -0,0 +1,204 @@
1
+ # Setup Guide for NPM Packages
2
+
3
+ This guide is for when both `impact-ui` and `impact-ui-mcp-server` are published to npm.
4
+
5
+ ## Project Structure
6
+
7
+ When both packages are installed from npm, your `node_modules` will look like:
8
+
9
+ ```
10
+ your-project/
11
+ ├── node_modules/
12
+ │ ├── impact-ui/ # ✅ Published npm package
13
+ │ │ ├── dist/ # Built library
14
+ │ │ ├── src/
15
+ │ │ │ ├── stories/ # ✅ For MCP server
16
+ │ │ │ └── components/ # ✅ For MCP server
17
+ │ │ └── package.json
18
+ │ └── impact-ui-mcp-server/ # ✅ Published npm package
19
+ │ ├── src/
20
+ │ │ └── index.js # MCP server entry point
21
+ │ └── package.json
22
+ └── package.json
23
+ ```
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ npm install impact-ui impact-ui-mcp-server
29
+ ```
30
+
31
+ ## Windsurf Configuration
32
+
33
+ Since Windsurf needs absolute paths, use this configuration:
34
+
35
+ ### Option 1: Auto-Detection (Simplest)
36
+
37
+ The MCP server will automatically find `impact-ui` in `node_modules`:
38
+
39
+ ```json
40
+ {
41
+ "mcpServers": {
42
+ "impact-ui": {
43
+ "command": "node",
44
+ "args": [
45
+ "/absolute/path/to/your/project/node_modules/impact-ui-mcp-server/src/index.js"
46
+ ],
47
+ "cwd": "/absolute/path/to/your/project"
48
+ }
49
+ }
50
+ }
51
+ ```
52
+
53
+ **No environment variables needed!** The MCP server auto-detects from `process.cwd()/node_modules/impact-ui`.
54
+
55
+ ### Option 2: Explicit Path (More Reliable)
56
+
57
+ If auto-detection doesn't work, explicitly set the path:
58
+
59
+ ```json
60
+ {
61
+ "mcpServers": {
62
+ "impact-ui": {
63
+ "command": "node",
64
+ "args": [
65
+ "/absolute/path/to/your/project/node_modules/impact-ui-mcp-server/src/index.js"
66
+ ],
67
+ "cwd": "/absolute/path/to/your/project",
68
+ "env": {
69
+ "IMPACT_UI_NODE_MODULES": "/absolute/path/to/your/project/node_modules/impact-ui"
70
+ }
71
+ }
72
+ }
73
+ }
74
+ ```
75
+
76
+ ## Generate Configuration Automatically
77
+
78
+ ### Option 1: Using npx (Recommended)
79
+
80
+ After installing the package, run from your project directory:
81
+
82
+ ```bash
83
+ cd /path/to/your/project
84
+ npx impact-ui-generate-windsurf-config-absolute --project-path=$(pwd)
85
+ ```
86
+
87
+ Or without specifying project path (uses current directory):
88
+ ```bash
89
+ cd /path/to/your/project
90
+ npx impact-ui-generate-windsurf-config-absolute
91
+ ```
92
+
93
+ ### Option 2: Using npm run
94
+
95
+ If you add it to your project's `package.json`:
96
+ ```json
97
+ {
98
+ "scripts": {
99
+ "generate-windsurf-config": "impact-ui-generate-windsurf-config-absolute"
100
+ }
101
+ }
102
+ ```
103
+
104
+ Then run:
105
+ ```bash
106
+ npm run generate-windsurf-config
107
+ ```
108
+
109
+ ### Option 3: Direct path to node_modules
110
+
111
+ ```bash
112
+ cd /path/to/your/project
113
+ node node_modules/impact-ui-mcp-server/generate-windsurf-config-absolute.js --project-path=$(pwd)
114
+ ```
115
+
116
+ ### What it does:
117
+
118
+ 1. ✅ Finds `impact-ui-mcp-server` in `node_modules`
119
+ 2. ✅ Finds `impact-ui` in `node_modules`
120
+ 3. ✅ Generates configuration with absolute paths
121
+ 4. ✅ Sets `IMPACT_UI_NODE_MODULES` if found
122
+
123
+ ## How Auto-Detection Works
124
+
125
+ The MCP server looks for `impact-ui` in these locations (in order):
126
+
127
+ 1. `process.cwd()/node_modules/impact-ui` ✅ **Most common**
128
+ 2. `process.cwd()/../node_modules/impact-ui`
129
+ 3. `process.cwd()/../../node_modules/impact-ui`
130
+ 4. Environment variable `IMPACT_UI_NODE_MODULES`
131
+ 5. Environment variable `IMPACT_UI_PATH`
132
+
133
+ Since `cwd` is set to your project root, it will find `node_modules/impact-ui` automatically!
134
+
135
+ ## Verification
136
+
137
+ After configuration, verify:
138
+
139
+ 1. **Check paths exist:**
140
+ ```bash
141
+ ls /path/to/your/project/node_modules/impact-ui/src/stories
142
+ ls /path/to/your/project/node_modules/impact-ui-mcp-server/src/index.js
143
+ ```
144
+
145
+ 2. **Test MCP server manually:**
146
+ ```bash
147
+ cd /path/to/your/project
148
+ node node_modules/impact-ui-mcp-server/src/index.js
149
+ ```
150
+
151
+ Should see: "Building component registry..." then "Impact UI MCP Server running on stdio"
152
+
153
+ 3. **In Windsurf:**
154
+ - Open chat
155
+ - Ask: "What components are available in Impact UI?"
156
+ - Should see component list
157
+
158
+ ## Troubleshooting
159
+
160
+ ### Issue: "Cannot find module"
161
+ **Solution**: Make sure both packages are installed:
162
+ ```bash
163
+ npm install impact-ui impact-ui-mcp-server
164
+ ```
165
+
166
+ ### Issue: "Auto-detection failed"
167
+ **Solution**: Set `IMPACT_UI_NODE_MODULES` explicitly:
168
+ ```json
169
+ "env": {
170
+ "IMPACT_UI_NODE_MODULES": "/absolute/path/to/your/project/node_modules/impact-ui"
171
+ }
172
+ ```
173
+
174
+ ### Issue: "Components not found"
175
+ **Solution**: Verify `impact-ui` package includes source files:
176
+ ```bash
177
+ ls node_modules/impact-ui/src/stories
178
+ ls node_modules/impact-ui/src/components
179
+ ```
180
+
181
+ If these don't exist, the package wasn't published with source files. Check `impact-ui/package.json` has:
182
+ ```json
183
+ {
184
+ "files": ["dist", "src/stories", "src/components"]
185
+ }
186
+ ```
187
+
188
+ ## Example: Complete Working Configuration
189
+
190
+ ```json
191
+ {
192
+ "mcpServers": {
193
+ "impact-ui": {
194
+ "command": "node",
195
+ "args": [
196
+ "/Users/yourname/projects/your-project/node_modules/impact-ui-mcp-server/src/index.js"
197
+ ],
198
+ "cwd": "/Users/yourname/projects/your-project"
199
+ }
200
+ }
201
+ }
202
+ ```
203
+
204
+ **That's it!** No environment variables needed when both packages are in npm and `cwd` points to project root.
@@ -0,0 +1,204 @@
1
+ # Windsurf IDE Setup Guide
2
+
3
+ This guide explains how to configure the Impact UI MCP Server in Windsurf IDE.
4
+
5
+ ## Quick Setup
6
+
7
+ ### Option 1: Generate Configuration Automatically
8
+
9
+ 1. **Generate the configuration:**
10
+ ```bash
11
+ cd mcp-server
12
+ node generate-windsurf-config.js
13
+ ```
14
+
15
+ For npm package installation:
16
+ ```bash
17
+ node generate-windsurf-config.js --npm --impact-ui-path=/path/to/impact-ui
18
+ ```
19
+
20
+ 2. **Open Windsurf Settings:**
21
+ - Press `Cmd+,` (macOS) or `Ctrl+,` (Windows/Linux)
22
+ - Or go to `Windsurf` → `Settings` → `MCP Servers`
23
+
24
+ 3. **Add the generated configuration** to your settings file
25
+
26
+ 4. **Restart Windsurf IDE**
27
+
28
+ ### Option 2: Manual Configuration
29
+
30
+ #### Step 1: Find Windsurf Settings File
31
+
32
+ **macOS:**
33
+ ```
34
+ ~/Library/Application Support/Windsurf/settings.json
35
+ ```
36
+
37
+ **Windows:**
38
+ ```
39
+ %APPDATA%\Windsurf\settings.json
40
+ ```
41
+
42
+ **Linux:**
43
+ ```
44
+ ~/.config/Windsurf/settings.json
45
+ ```
46
+
47
+ #### Step 2: Add MCP Server Configuration
48
+
49
+ Open the settings file and add:
50
+
51
+ **If using npm package:**
52
+ ```json
53
+ {
54
+ "mcpServers": {
55
+ "impact-ui": {
56
+ "command": "node",
57
+ "args": [
58
+ "./node_modules/impact-ui-mcp-server/src/index.js"
59
+ ],
60
+ "cwd": "${workspaceFolder}",
61
+ "env": {
62
+ "IMPACT_UI_PATH": "/absolute/path/to/impact-ui"
63
+ }
64
+ }
65
+ }
66
+ }
67
+ ```
68
+
69
+ **If using local path:**
70
+ ```json
71
+ {
72
+ "mcpServers": {
73
+ "impact-ui": {
74
+ "command": "node",
75
+ "args": [
76
+ "/absolute/path/to/impact-ui/mcp-server/src/index.js"
77
+ ],
78
+ "cwd": "/absolute/path/to/impact-ui/mcp-server"
79
+ }
80
+ }
81
+ }
82
+ ```
83
+
84
+ #### Step 3: Restart Windsurf
85
+
86
+ Close and reopen Windsurf IDE for the changes to take effect.
87
+
88
+ ## Configuration Options
89
+
90
+ ### Environment Variables
91
+
92
+ The MCP server supports these environment variables:
93
+
94
+ - **`IMPACT_UI_PATH`**: Path to Impact UI repository root
95
+ ```json
96
+ "env": {
97
+ "IMPACT_UI_PATH": "/path/to/impact-ui"
98
+ }
99
+ ```
100
+
101
+ - **`IMPACT_UI_FRONTEND_PATH`**: Direct path to frontend folder
102
+ ```json
103
+ "env": {
104
+ "IMPACT_UI_FRONTEND_PATH": "/path/to/impact-ui/frontend"
105
+ }
106
+ ```
107
+
108
+ - **`IMPACT_UI_NODE_MODULES`**: Path to installed npm package
109
+ ```json
110
+ "env": {
111
+ "IMPACT_UI_NODE_MODULES": "/path/to/project/node_modules/impact-ui"
112
+ }
113
+ ```
114
+
115
+ ### Auto-Detection (No Environment Variables)
116
+
117
+ If source files are included in the npm package, the MCP server will auto-detect from `node_modules`:
118
+
119
+ ```json
120
+ {
121
+ "mcpServers": {
122
+ "impact-ui": {
123
+ "command": "node",
124
+ "args": [
125
+ "./node_modules/impact-ui-mcp-server/src/index.js"
126
+ ],
127
+ "cwd": "${workspaceFolder}"
128
+ }
129
+ }
130
+ }
131
+ ```
132
+
133
+ No environment variables needed!
134
+
135
+ ## Verification
136
+
137
+ After configuration, verify it's working:
138
+
139
+ 1. **Open Windsurf chat** (usually `Cmd+L` or `Ctrl+L`)
140
+ 2. **Look for Impact UI MCP server** in the server selector
141
+ 3. **Ask**: "What components are available in Impact UI?"
142
+ 4. The MCP server should respond with component information
143
+
144
+ ## Troubleshooting
145
+
146
+ ### Server Not Starting
147
+
148
+ - **Check Node.js version**: Requires Node.js 18+
149
+ ```bash
150
+ node --version
151
+ ```
152
+
153
+ - **Verify paths**: Make sure all paths in the configuration are correct
154
+ - **Check logs**: Look at Windsurf's MCP server logs for errors
155
+
156
+ ### Components Not Found
157
+
158
+ - **Verify Impact UI path**: Ensure `IMPACT_UI_PATH` points to the correct location
159
+ - **Check source files**: Make sure `src/stories` and `src/components` exist
160
+ - **Test manually**: Run the MCP server manually to see errors:
161
+ ```bash
162
+ cd mcp-server
163
+ node src/index.js
164
+ ```
165
+
166
+ ### Configuration Not Loading
167
+
168
+ - **Check JSON syntax**: Ensure the JSON is valid
169
+ - **Restart Windsurf**: Always restart after changing settings
170
+ - **Check file permissions**: Make sure Windsurf can read the settings file
171
+
172
+ ## Differences from Cursor
173
+
174
+ Windsurf uses `mcpServers` (plural) instead of `mcp.servers`:
175
+ - ✅ Windsurf: `"mcpServers"`
176
+ - ✅ Cursor: `"mcp.servers"`
177
+
178
+ The rest of the configuration format is the same.
179
+
180
+ ## Example Complete Configuration
181
+
182
+ ```json
183
+ {
184
+ "mcpServers": {
185
+ "impact-ui": {
186
+ "command": "node",
187
+ "args": [
188
+ "./node_modules/impact-ui-mcp-server/src/index.js"
189
+ ],
190
+ "cwd": "${workspaceFolder}",
191
+ "env": {
192
+ "IMPACT_UI_PATH": "/Users/team/projects/impact-ui"
193
+ }
194
+ }
195
+ }
196
+ }
197
+ ```
198
+
199
+ ## Support
200
+
201
+ For issues or questions:
202
+ - Check the main [README.md](./README.md) for general usage
203
+ - Review [QUICKSTART.md](./QUICKSTART.md) for setup instructions
204
+ - Contact the Impact UI team
@@ -0,0 +1,113 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Helper script to generate Cursor IDE MCP server configuration
5
+ * Run this script to get the exact configuration you need to add to Cursor
6
+ *
7
+ * Usage:
8
+ * node generate-cursor-config.js [--npm] [--impact-ui-path=/path/to/impact-ui]
9
+ */
10
+
11
+ import { fileURLToPath } from "url";
12
+ import { dirname, resolve } from "path";
13
+ import { existsSync } from "fs";
14
+ import { execSync } from "child_process";
15
+
16
+ const __filename = fileURLToPath(import.meta.url);
17
+ const __dirname = dirname(__filename);
18
+
19
+ // Parse command line arguments
20
+ const args = process.argv.slice(2);
21
+ const useNpm = args.includes("--npm");
22
+ const impactUiPathArg = args.find(arg => arg.startsWith("--impact-ui-path="));
23
+ const impactUiPath = impactUiPathArg ? impactUiPathArg.split("=")[1] : null;
24
+
25
+ console.log("\n📋 Cursor IDE MCP Server Configuration Generator\n");
26
+ console.log("=".repeat(60));
27
+
28
+ let config;
29
+ let impactUiPathToUse = impactUiPath;
30
+
31
+ if (useNpm) {
32
+ // Check if package is installed
33
+ let packagePath;
34
+ try {
35
+ packagePath = execSync("npm list @impact-analytics/impact-ui-mcp-server --json", { encoding: "utf-8", stdio: "pipe" });
36
+ const packageInfo = JSON.parse(packagePath);
37
+ if (!packageInfo.dependencies || !packageInfo.dependencies["@impact-analytics/impact-ui-mcp-server"]) {
38
+ console.log("\n⚠️ Package not found. Install it first:");
39
+ console.log(" npm install @impact-analytics/impact-ui-mcp-server\n");
40
+ process.exit(1);
41
+ }
42
+ } catch (error) {
43
+ console.log("\n⚠️ Package not found. Install it first:");
44
+ console.log(" npm install @impact-analytics/impact-ui-mcp-server\n");
45
+ process.exit(1);
46
+ }
47
+
48
+ // Get the absolute path to Impact UI
49
+ if (!impactUiPathToUse) {
50
+ console.log("\n❓ Please provide the path to your Impact UI repository:");
51
+ console.log(" node generate-cursor-config.js --npm --impact-ui-path=/path/to/impact-ui\n");
52
+ process.exit(1);
53
+ }
54
+
55
+ // Verify the path exists
56
+ if (!existsSync(impactUiPathToUse)) {
57
+ console.log(`\n❌ Path does not exist: ${impactUiPathToUse}\n`);
58
+ process.exit(1);
59
+ }
60
+
61
+ if (!existsSync(resolve(impactUiPathToUse, "frontend"))) {
62
+ console.log(`\n❌ Frontend directory not found at: ${resolve(impactUiPathToUse, "frontend")}\n`);
63
+ process.exit(1);
64
+ }
65
+
66
+ config = {
67
+ "mcp.servers": {
68
+ "impact-ui": {
69
+ "command": "node",
70
+ "args": [
71
+ "./node_modules/@impact-analytics/impact-ui-mcp-server/src/index.js"
72
+ ],
73
+ "cwd": "${workspaceFolder}",
74
+ "env": {
75
+ "IMPACT_UI_PATH": impactUiPathToUse
76
+ }
77
+ }
78
+ }
79
+ };
80
+
81
+ console.log("\n📦 NPM Package Configuration\n");
82
+ } else {
83
+ // Local development configuration
84
+ const mcpServerPath = resolve(__dirname);
85
+ const indexPath = resolve(__dirname, "src/index.js");
86
+
87
+ config = {
88
+ "mcp.servers": {
89
+ "impact-ui": {
90
+ "command": "node",
91
+ "args": [indexPath],
92
+ "cwd": mcpServerPath
93
+ }
94
+ }
95
+ };
96
+
97
+ console.log("\n🏠 Local Development Configuration\n");
98
+ }
99
+
100
+ console.log("Add this to your Cursor settings.json:\n");
101
+ console.log("(Press Cmd+Shift+P / Ctrl+Shift+P → 'Preferences: Open User Settings (JSON)')\n");
102
+
103
+ console.log(JSON.stringify(config, null, 2));
104
+
105
+ console.log("\n" + "=".repeat(60));
106
+ console.log("\n✅ Copy the JSON above and add it to your Cursor settings.json");
107
+ console.log("💡 Make sure to merge it with your existing settings (if any)");
108
+ console.log("🔄 Restart Cursor IDE after adding the configuration\n");
109
+
110
+ if (useNpm) {
111
+ console.log("📝 Note: Make sure to install the package first:");
112
+ console.log(" npm install @impact-analytics/impact-ui-mcp-server\n");
113
+ }
@@ -0,0 +1,134 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Generate Windsurf configuration with absolute paths (for when ${workspaceFolder} doesn't work)
5
+ *
6
+ * Usage:
7
+ * node generate-windsurf-config-absolute.js [--project-path=/path/to/project] [--impact-ui-path=/path/to/impact-ui]
8
+ */
9
+
10
+ import { fileURLToPath } from "url";
11
+ import { dirname, resolve } from "path";
12
+ import { existsSync } from "fs";
13
+ import { execSync } from "child_process";
14
+
15
+ const __filename = fileURLToPath(import.meta.url);
16
+ const __dirname = dirname(__filename);
17
+
18
+ // Parse command line arguments
19
+ const args = process.argv.slice(2);
20
+ const projectPathArg = args.find(arg => arg.startsWith("--project-path="));
21
+ const impactUiPathArg = args.find(arg => arg.startsWith("--impact-ui-path="));
22
+
23
+ let projectPath = projectPathArg ? projectPathArg.split("=")[1] : process.cwd();
24
+ let impactUiPath = impactUiPathArg ? impactUiPathArg.split("=")[1] : null;
25
+
26
+ // Convert to absolute paths
27
+ projectPath = resolve(projectPath);
28
+ if (impactUiPath) {
29
+ impactUiPath = resolve(impactUiPath);
30
+ }
31
+
32
+ console.log("\n📋 Windsurf IDE MCP Server Configuration (Absolute Paths)\n");
33
+ console.log("=".repeat(60));
34
+
35
+ // Verify project path
36
+ if (!existsSync(projectPath)) {
37
+ console.log(`\n❌ Project path does not exist: ${projectPath}\n`);
38
+ process.exit(1);
39
+ }
40
+
41
+ // Check for MCP server in different locations
42
+ const possibleMcpPaths = [
43
+ resolve(projectPath, "node_modules", "impact-ui-mcp-server", "src", "index.js"),
44
+ resolve(projectPath, "frontend", "node_modules", "impact-ui-mcp-server", "src", "index.js"),
45
+ resolve(__dirname, "src", "index.js"), // Fallback to local
46
+ ];
47
+
48
+ let mcpServerPath = null;
49
+ for (const path of possibleMcpPaths) {
50
+ if (existsSync(path)) {
51
+ mcpServerPath = path;
52
+ break;
53
+ }
54
+ }
55
+
56
+ if (!mcpServerPath) {
57
+ console.log("\n❌ Could not find MCP server. Tried:");
58
+ possibleMcpPaths.forEach(p => console.log(` - ${p}`));
59
+ console.log("\n Install it with: npm install impact-ui-mcp-server\n");
60
+ process.exit(1);
61
+ }
62
+
63
+ // Check for impact-ui package in node_modules (npm installed)
64
+ const possibleImpactUiPaths = [
65
+ resolve(projectPath, "node_modules", "impact-ui"),
66
+ resolve(projectPath, "frontend", "node_modules", "impact-ui"),
67
+ ];
68
+
69
+ let impactUiNodeModules = null;
70
+ for (const path of possibleImpactUiPaths) {
71
+ const storiesPath = resolve(path, "src", "stories");
72
+ if (existsSync(storiesPath)) {
73
+ impactUiNodeModules = path;
74
+ break;
75
+ }
76
+ }
77
+
78
+ // Build configuration
79
+ const config = {
80
+ "mcpServers": {
81
+ "impact-ui": {
82
+ "command": "node",
83
+ "args": [mcpServerPath],
84
+ "cwd": projectPath
85
+ }
86
+ }
87
+ };
88
+
89
+ // For npm packages: MCP server auto-detects from node_modules, but we can set env var for explicit path
90
+ // This ensures it works even if auto-detection fails
91
+ if (impactUiNodeModules) {
92
+ console.log("\n✅ Found impact-ui package in node_modules (npm installed)");
93
+ console.log(" The MCP server will auto-detect it, but setting IMPACT_UI_NODE_MODULES for reliability.\n");
94
+ config.mcpServers["impact-ui"].env = {
95
+ "IMPACT_UI_NODE_MODULES": impactUiNodeModules
96
+ };
97
+ } else if (impactUiPath) {
98
+ // Fallback to repository path if provided
99
+ if (!existsSync(impactUiPath)) {
100
+ console.log(`\n❌ Impact UI path does not exist: ${impactUiPath}\n`);
101
+ process.exit(1);
102
+ }
103
+ config.mcpServers["impact-ui"].env = {
104
+ "IMPACT_UI_PATH": impactUiPath
105
+ };
106
+ } else {
107
+ console.log("\n⚠️ Warning: Could not find impact-ui package in node_modules.");
108
+ console.log(" Make sure you've installed it: npm install impact-ui");
109
+ console.log(" Or set IMPACT_UI_PATH to the repository root.\n");
110
+ console.log(" The MCP server will try to auto-detect, but may fail.\n");
111
+ }
112
+
113
+ console.log("\n✅ Detected paths:");
114
+ console.log(` MCP Server: ${mcpServerPath}`);
115
+ if (impactUiNodeModules) {
116
+ console.log(` Impact UI: ${impactUiNodeModules}`);
117
+ } else if (impactUiPath) {
118
+ console.log(` Impact UI: ${impactUiPath}`);
119
+ }
120
+ console.log(` Working Directory: ${projectPath}\n`);
121
+
122
+ console.log("Add this to your Windsurf settings:\n");
123
+ console.log("Windsurf Settings Location:");
124
+ console.log(" macOS: ~/Library/Application Support/Windsurf/settings.json");
125
+ console.log(" Windows: %APPDATA%\\Windsurf\\settings.json");
126
+ console.log(" Linux: ~/.config/Windsurf/settings.json\n");
127
+ console.log("Or use: Windsurf → Settings → MCP Servers\n");
128
+
129
+ console.log(JSON.stringify(config, null, 2));
130
+
131
+ console.log("\n" + "=".repeat(60));
132
+ console.log("\n✅ Copy the JSON above and add it to your Windsurf settings");
133
+ console.log("💡 All paths are absolute - no variables needed!");
134
+ console.log("🔄 Restart Windsurf IDE after adding the configuration\n");
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Helper script to generate Windsurf IDE MCP server configuration
5
+ * Run this script to get the exact configuration you need to add to Windsurf
6
+ *
7
+ * Usage:
8
+ * node generate-windsurf-config.js [--npm] [--impact-ui-path=/path/to/impact-ui]
9
+ */
10
+
11
+ import { fileURLToPath } from "url";
12
+ import { dirname, resolve } from "path";
13
+ import { existsSync } from "fs";
14
+ import { execSync } from "child_process";
15
+
16
+ const __filename = fileURLToPath(import.meta.url);
17
+ const __dirname = dirname(__filename);
18
+
19
+ // Parse command line arguments
20
+ const args = process.argv.slice(2);
21
+ const useNpm = args.includes("--npm");
22
+ const impactUiPathArg = args.find(arg => arg.startsWith("--impact-ui-path="));
23
+ const impactUiPath = impactUiPathArg ? impactUiPathArg.split("=")[1] : null;
24
+
25
+ console.log("\n📋 Windsurf IDE MCP Server Configuration Generator\n");
26
+ console.log("=".repeat(60));
27
+
28
+ let config;
29
+ let impactUiPathToUse = impactUiPath;
30
+
31
+ if (useNpm) {
32
+ // Check if package is installed
33
+ try {
34
+ execSync("npm list impact-ui-mcp-server --json", { encoding: "utf-8", stdio: "pipe" });
35
+ } catch (error) {
36
+ console.log("\n⚠️ Package not found. Install it first:");
37
+ console.log(" npm install impact-ui-mcp-server\n");
38
+ process.exit(1);
39
+ }
40
+
41
+ // Get the absolute path to Impact UI
42
+ if (!impactUiPathToUse) {
43
+ console.log("\n❓ Please provide the path to your Impact UI repository:");
44
+ console.log(" node generate-windsurf-config.js --npm --impact-ui-path=/path/to/impact-ui\n");
45
+ process.exit(1);
46
+ }
47
+
48
+ // Verify the path exists
49
+ if (!existsSync(impactUiPathToUse)) {
50
+ console.log(`\n❌ Path does not exist: ${impactUiPathToUse}\n`);
51
+ process.exit(1);
52
+ }
53
+
54
+ if (!existsSync(resolve(impactUiPathToUse, "frontend"))) {
55
+ console.log(`\n❌ Frontend directory not found at: ${resolve(impactUiPathToUse, "frontend")}\n`);
56
+ process.exit(1);
57
+ }
58
+
59
+ config = {
60
+ "mcpServers": {
61
+ "impact-ui": {
62
+ "command": "node",
63
+ "args": [
64
+ "./node_modules/impact-ui-mcp-server/src/index.js"
65
+ ],
66
+ "cwd": "${workspaceFolder}",
67
+ "env": {
68
+ "IMPACT_UI_PATH": impactUiPathToUse
69
+ }
70
+ }
71
+ }
72
+ };
73
+
74
+ console.log("\n📦 NPM Package Configuration\n");
75
+ } else {
76
+ // Local development configuration
77
+ const mcpServerPath = resolve(__dirname);
78
+ const indexPath = resolve(__dirname, "src/index.js");
79
+
80
+ config = {
81
+ "mcpServers": {
82
+ "impact-ui": {
83
+ "command": "node",
84
+ "args": [indexPath],
85
+ "cwd": mcpServerPath
86
+ }
87
+ }
88
+ };
89
+
90
+ console.log("\n🏠 Local Development Configuration\n");
91
+ }
92
+
93
+ console.log("Add this to your Windsurf settings:\n");
94
+ console.log("Windsurf Settings Location:");
95
+ console.log(" macOS: ~/Library/Application Support/Windsurf/settings.json");
96
+ console.log(" Windows: %APPDATA%\\Windsurf\\settings.json");
97
+ console.log(" Linux: ~/.config/Windsurf/settings.json\n");
98
+ console.log("Or use: Windsurf → Settings → MCP Servers\n");
99
+
100
+ console.log(JSON.stringify(config, null, 2));
101
+
102
+ console.log("\n⚠️ IMPORTANT FOR WINDSURF:");
103
+ console.log(" Windsurf may not support ${workspaceFolder} variable.");
104
+ console.log(" If this doesn't work, replace ${workspaceFolder} with absolute paths:");
105
+ console.log(" Example: /Users/yourname/projects/your-project");
106
+ console.log("\n See WINDSURF_TROUBLESHOOTING.md for more help.\n");
107
+
108
+ console.log("\n" + "=".repeat(60));
109
+ console.log("\n✅ Copy the JSON above and add it to your Windsurf settings");
110
+ console.log("💡 Make sure to merge it with your existing settings (if any)");
111
+ console.log("🔄 Restart Windsurf IDE after adding the configuration\n");
112
+
113
+ if (useNpm) {
114
+ console.log("📝 Note: Make sure to install the package first:");
115
+ console.log(" npm install impact-ui-mcp-server\n");
116
+ }
package/package.json CHANGED
@@ -1,18 +1,26 @@
1
1
  {
2
2
  "name": "impact-ui-mcp-server",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
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",
7
7
  "bin": {
8
- "impact-ui-mcp": "src/index.js"
8
+ "impact-ui-mcp": "./src/index.js",
9
+ "impact-ui-generate-cursor-config": "./generate-cursor-config.js",
10
+ "impact-ui-generate-windsurf-config": "./generate-windsurf-config.js",
11
+ "impact-ui-generate-windsurf-config-absolute": "./generate-windsurf-config-absolute.js"
9
12
  },
10
13
  "files": [
11
14
  "src",
15
+ "generate-cursor-config.js",
16
+ "generate-windsurf-config.js",
17
+ "generate-windsurf-config-absolute.js",
12
18
  "README.md",
13
19
  "DEPLOYMENT.md",
14
20
  "QUICK_SETUP.md",
15
- "QUICKSTART.md"
21
+ "QUICKSTART.md",
22
+ "WINDSURF_SETUP.md",
23
+ "NPM_PACKAGE_SETUP.md"
16
24
  ],
17
25
  "publishConfig": {
18
26
  "access": "public"
@@ -20,7 +28,9 @@
20
28
  "scripts": {
21
29
  "start": "node src/index.js",
22
30
  "dev": "node --watch src/index.js",
23
- "generate-config": "node generate-cursor-config.js"
31
+ "generate-config": "node generate-cursor-config.js",
32
+ "generate-windsurf-config": "node generate-windsurf-config.js",
33
+ "generate-windsurf-config-absolute": "node generate-windsurf-config-absolute.js"
24
34
  },
25
35
  "keywords": [
26
36
  "mcp",
@@ -35,7 +45,7 @@
35
45
  "license": "MIT",
36
46
  "repository": {
37
47
  "type": "git",
38
- "url": "git+https://github.com/impact-analytics/impact-ui.git",
48
+ "url": "https://github.com/impact-analytics/impact-ui.git",
39
49
  "directory": "mcp-server"
40
50
  },
41
51
  "engines": {