impact-ui-mcp-server 1.0.0 → 1.0.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.
- package/NPM_PACKAGE_SETUP.md +208 -0
- package/WINDSURF_SETUP.md +204 -0
- package/generate-cursor-config.js +136 -0
- package/generate-windsurf-config-absolute.js +134 -0
- package/generate-windsurf-config.js +139 -0
- package/package.json +15 -5
|
@@ -0,0 +1,208 @@
|
|
|
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
|
+
**Package Names:**
|
|
32
|
+
- `impact-ui` - The UI library
|
|
33
|
+
- `impact-ui-mcp-server` - The MCP server (published to npm)
|
|
34
|
+
|
|
35
|
+
## Windsurf Configuration
|
|
36
|
+
|
|
37
|
+
Since Windsurf needs absolute paths, use this configuration:
|
|
38
|
+
|
|
39
|
+
### Option 1: Auto-Detection (Simplest)
|
|
40
|
+
|
|
41
|
+
The MCP server will automatically find `impact-ui` in `node_modules`:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"mcpServers": {
|
|
46
|
+
"impact-ui": {
|
|
47
|
+
"command": "node",
|
|
48
|
+
"args": [
|
|
49
|
+
"/absolute/path/to/your/project/node_modules/impact-ui-mcp-server/src/index.js"
|
|
50
|
+
],
|
|
51
|
+
"cwd": "/absolute/path/to/your/project"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**No environment variables needed!** The MCP server auto-detects from `process.cwd()/node_modules/impact-ui`.
|
|
58
|
+
|
|
59
|
+
### Option 2: Explicit Path (More Reliable)
|
|
60
|
+
|
|
61
|
+
If auto-detection doesn't work, explicitly set the path:
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"mcpServers": {
|
|
66
|
+
"impact-ui": {
|
|
67
|
+
"command": "node",
|
|
68
|
+
"args": [
|
|
69
|
+
"/absolute/path/to/your/project/node_modules/impact-ui-mcp-server/src/index.js"
|
|
70
|
+
],
|
|
71
|
+
"cwd": "/absolute/path/to/your/project",
|
|
72
|
+
"env": {
|
|
73
|
+
"IMPACT_UI_NODE_MODULES": "/absolute/path/to/your/project/node_modules/impact-ui"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Generate Configuration Automatically
|
|
81
|
+
|
|
82
|
+
### Option 1: Using npx (Recommended)
|
|
83
|
+
|
|
84
|
+
After installing the package, run from your project directory:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
cd /path/to/your/project
|
|
88
|
+
npx impact-ui-generate-windsurf-config-absolute --project-path=$(pwd)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Or without specifying project path (uses current directory):
|
|
92
|
+
```bash
|
|
93
|
+
cd /path/to/your/project
|
|
94
|
+
npx impact-ui-generate-windsurf-config-absolute
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Option 2: Using npm run
|
|
98
|
+
|
|
99
|
+
If you add it to your project's `package.json`:
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"scripts": {
|
|
103
|
+
"generate-windsurf-config": "impact-ui-generate-windsurf-config-absolute"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Then run:
|
|
109
|
+
```bash
|
|
110
|
+
npm run generate-windsurf-config
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Option 3: Direct path to node_modules
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
cd /path/to/your/project
|
|
117
|
+
node node_modules/impact-ui-mcp-server/generate-windsurf-config-absolute.js --project-path=$(pwd)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### What it does:
|
|
121
|
+
|
|
122
|
+
1. ✅ Finds `impact-ui-mcp-server` in `node_modules`
|
|
123
|
+
2. ✅ Finds `impact-ui` in `node_modules`
|
|
124
|
+
3. ✅ Generates configuration with absolute paths
|
|
125
|
+
4. ✅ Sets `IMPACT_UI_NODE_MODULES` if found
|
|
126
|
+
|
|
127
|
+
## How Auto-Detection Works
|
|
128
|
+
|
|
129
|
+
The MCP server looks for `impact-ui` in these locations (in order):
|
|
130
|
+
|
|
131
|
+
1. `process.cwd()/node_modules/impact-ui` ✅ **Most common**
|
|
132
|
+
2. `process.cwd()/../node_modules/impact-ui`
|
|
133
|
+
3. `process.cwd()/../../node_modules/impact-ui`
|
|
134
|
+
4. Environment variable `IMPACT_UI_NODE_MODULES`
|
|
135
|
+
5. Environment variable `IMPACT_UI_PATH`
|
|
136
|
+
|
|
137
|
+
Since `cwd` is set to your project root, it will find `node_modules/impact-ui` automatically!
|
|
138
|
+
|
|
139
|
+
## Verification
|
|
140
|
+
|
|
141
|
+
After configuration, verify:
|
|
142
|
+
|
|
143
|
+
1. **Check paths exist:**
|
|
144
|
+
```bash
|
|
145
|
+
ls /path/to/your/project/node_modules/impact-ui/src/stories
|
|
146
|
+
ls /path/to/your/project/node_modules/impact-ui-mcp-server/src/index.js
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
2. **Test MCP server manually:**
|
|
150
|
+
```bash
|
|
151
|
+
cd /path/to/your/project
|
|
152
|
+
node node_modules/impact-ui-mcp-server/src/index.js
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Should see: "Building component registry..." then "Impact UI MCP Server running on stdio"
|
|
156
|
+
|
|
157
|
+
3. **In Windsurf:**
|
|
158
|
+
- Open chat
|
|
159
|
+
- Ask: "What components are available in Impact UI?"
|
|
160
|
+
- Should see component list
|
|
161
|
+
|
|
162
|
+
## Troubleshooting
|
|
163
|
+
|
|
164
|
+
### Issue: "Cannot find module"
|
|
165
|
+
**Solution**: Make sure both packages are installed:
|
|
166
|
+
```bash
|
|
167
|
+
npm install impact-ui impact-ui-mcp-server
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Issue: "Auto-detection failed"
|
|
171
|
+
**Solution**: Set `IMPACT_UI_NODE_MODULES` explicitly:
|
|
172
|
+
```json
|
|
173
|
+
"env": {
|
|
174
|
+
"IMPACT_UI_NODE_MODULES": "/absolute/path/to/your/project/node_modules/impact-ui"
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Issue: "Components not found"
|
|
179
|
+
**Solution**: Verify `impact-ui` package includes source files:
|
|
180
|
+
```bash
|
|
181
|
+
ls node_modules/impact-ui/src/stories
|
|
182
|
+
ls node_modules/impact-ui/src/components
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
If these don't exist, the package wasn't published with source files. Check `impact-ui/package.json` has:
|
|
186
|
+
```json
|
|
187
|
+
{
|
|
188
|
+
"files": ["dist", "src/stories", "src/components"]
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Example: Complete Working Configuration
|
|
193
|
+
|
|
194
|
+
```json
|
|
195
|
+
{
|
|
196
|
+
"mcpServers": {
|
|
197
|
+
"impact-ui": {
|
|
198
|
+
"command": "node",
|
|
199
|
+
"args": [
|
|
200
|
+
"/Users/yourname/projects/your-project/node_modules/impact-ui-mcp-server/src/index.js"
|
|
201
|
+
],
|
|
202
|
+
"cwd": "/Users/yourname/projects/your-project"
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**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,136 @@
|
|
|
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 (try both scoped and unscoped names)
|
|
33
|
+
let packageFound = false;
|
|
34
|
+
let packageName = "impact-ui-mcp-server";
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
const packagePath = execSync("npm list impact-ui-mcp-server --json", { encoding: "utf-8", stdio: "pipe" });
|
|
38
|
+
const packageInfo = JSON.parse(packagePath);
|
|
39
|
+
if (packageInfo.dependencies && packageInfo.dependencies["impact-ui-mcp-server"]) {
|
|
40
|
+
packageFound = true;
|
|
41
|
+
}
|
|
42
|
+
} catch (error) {
|
|
43
|
+
// Try scoped version
|
|
44
|
+
try {
|
|
45
|
+
const packagePath = execSync("npm list @impact-analytics/impact-ui-mcp-server --json", { encoding: "utf-8", stdio: "pipe" });
|
|
46
|
+
const packageInfo = JSON.parse(packagePath);
|
|
47
|
+
if (packageInfo.dependencies && packageInfo.dependencies["@impact-analytics/impact-ui-mcp-server"]) {
|
|
48
|
+
packageFound = true;
|
|
49
|
+
packageName = "@impact-analytics/impact-ui-mcp-server";
|
|
50
|
+
}
|
|
51
|
+
} catch (error2) {
|
|
52
|
+
// Package not found, but continue - user might install it later
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// For npm packages, use ${workspaceFolder} variables (Cursor supports these)
|
|
57
|
+
// Try to detect actual structure, otherwise use most common structure
|
|
58
|
+
const cwd = process.cwd();
|
|
59
|
+
let mcpServerPath = "${workspaceFolder}/frontend/node_modules/impact-ui-mcp-server/src/index.js";
|
|
60
|
+
let impactUiPath = "${workspaceFolder}/frontend/node_modules/impact-ui";
|
|
61
|
+
|
|
62
|
+
// Check actual structure to determine which path to use
|
|
63
|
+
const frontendMcpPath = resolve(cwd, "frontend", "node_modules", "impact-ui-mcp-server", "src", "index.js");
|
|
64
|
+
const rootMcpPath = resolve(cwd, "node_modules", "impact-ui-mcp-server", "src", "index.js");
|
|
65
|
+
|
|
66
|
+
if (existsSync(frontendMcpPath)) {
|
|
67
|
+
// Packages are in frontend/node_modules
|
|
68
|
+
mcpServerPath = "${workspaceFolder}/frontend/node_modules/impact-ui-mcp-server/src/index.js";
|
|
69
|
+
impactUiPath = "${workspaceFolder}/frontend/node_modules/impact-ui";
|
|
70
|
+
} else if (existsSync(rootMcpPath)) {
|
|
71
|
+
// Packages are in root node_modules
|
|
72
|
+
mcpServerPath = "${workspaceFolder}/node_modules/impact-ui-mcp-server/src/index.js";
|
|
73
|
+
impactUiPath = "${workspaceFolder}/node_modules/impact-ui";
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Check for scoped package name
|
|
77
|
+
const frontendScopedMcpPath = resolve(cwd, "frontend", "node_modules", "@impact-analytics", "impact-ui-mcp-server", "src", "index.js");
|
|
78
|
+
const rootScopedMcpPath = resolve(cwd, "node_modules", "@impact-analytics", "impact-ui-mcp-server", "src", "index.js");
|
|
79
|
+
|
|
80
|
+
if (existsSync(frontendScopedMcpPath)) {
|
|
81
|
+
mcpServerPath = "${workspaceFolder}/frontend/node_modules/@impact-analytics/impact-ui-mcp-server/src/index.js";
|
|
82
|
+
} else if (existsSync(rootScopedMcpPath)) {
|
|
83
|
+
mcpServerPath = "${workspaceFolder}/node_modules/@impact-analytics/impact-ui-mcp-server/src/index.js";
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
config = {
|
|
87
|
+
"mcp.servers": {
|
|
88
|
+
"impact-ui": {
|
|
89
|
+
"command": "node",
|
|
90
|
+
"args": [mcpServerPath],
|
|
91
|
+
"cwd": "${workspaceFolder}",
|
|
92
|
+
"env": {
|
|
93
|
+
"IMPACT_UI_NODE_MODULES": impactUiPath
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
console.log("\n📦 NPM Package Configuration (with ${workspaceFolder} variables)\n");
|
|
100
|
+
if (!packageFound) {
|
|
101
|
+
console.log("⚠️ Note: Package not detected in current directory.");
|
|
102
|
+
console.log(" Make sure to install: npm install impact-ui-mcp-server\n");
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
// Local development configuration
|
|
106
|
+
const mcpServerPath = resolve(__dirname);
|
|
107
|
+
const indexPath = resolve(__dirname, "src/index.js");
|
|
108
|
+
|
|
109
|
+
config = {
|
|
110
|
+
"mcp.servers": {
|
|
111
|
+
"impact-ui": {
|
|
112
|
+
"command": "node",
|
|
113
|
+
"args": [indexPath],
|
|
114
|
+
"cwd": mcpServerPath
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
console.log("\n🏠 Local Development Configuration\n");
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
console.log("Add this to your Cursor settings.json:\n");
|
|
123
|
+
console.log("(Press Cmd+Shift+P / Ctrl+Shift+P → 'Preferences: Open User Settings (JSON)')\n");
|
|
124
|
+
|
|
125
|
+
console.log(JSON.stringify(config, null, 2));
|
|
126
|
+
|
|
127
|
+
console.log("\n" + "=".repeat(60));
|
|
128
|
+
console.log("\n✅ Copy the JSON above and add it to your Cursor settings.json");
|
|
129
|
+
console.log("💡 Make sure to merge it with your existing settings (if any)");
|
|
130
|
+
console.log("🔄 Restart Cursor IDE after adding the configuration\n");
|
|
131
|
+
|
|
132
|
+
if (useNpm) {
|
|
133
|
+
console.log("📝 Note: Make sure to install the package first:");
|
|
134
|
+
console.log(" npm install impact-ui-mcp-server\n");
|
|
135
|
+
console.log("💡 The configuration uses ${workspaceFolder} variables which Cursor resolves automatically.\n");
|
|
136
|
+
}
|
|
@@ -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,139 @@
|
|
|
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
|
+
// For npm packages, detect structure and use appropriate paths
|
|
60
|
+
const cwd = process.cwd();
|
|
61
|
+
let mcpServerPath = "./node_modules/impact-ui-mcp-server/src/index.js";
|
|
62
|
+
let impactUiNodeModules = null;
|
|
63
|
+
|
|
64
|
+
// Check actual structure
|
|
65
|
+
const frontendMcpPath = resolve(cwd, "frontend", "node_modules", "impact-ui-mcp-server", "src", "index.js");
|
|
66
|
+
const rootMcpPath = resolve(cwd, "node_modules", "impact-ui-mcp-server", "src", "index.js");
|
|
67
|
+
|
|
68
|
+
if (existsSync(frontendMcpPath)) {
|
|
69
|
+
mcpServerPath = "./frontend/node_modules/impact-ui-mcp-server/src/index.js";
|
|
70
|
+
impactUiNodeModules = "./frontend/node_modules/impact-ui";
|
|
71
|
+
} else if (existsSync(rootMcpPath)) {
|
|
72
|
+
mcpServerPath = "./node_modules/impact-ui-mcp-server/src/index.js";
|
|
73
|
+
impactUiNodeModules = "./node_modules/impact-ui";
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
config = {
|
|
77
|
+
"mcpServers": {
|
|
78
|
+
"impact-ui": {
|
|
79
|
+
"command": "node",
|
|
80
|
+
"args": [mcpServerPath],
|
|
81
|
+
"cwd": "${workspaceFolder}"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// Add environment variable if impact-ui is in node_modules
|
|
87
|
+
if (impactUiNodeModules) {
|
|
88
|
+
config.mcpServers["impact-ui"].env = {
|
|
89
|
+
"IMPACT_UI_NODE_MODULES": impactUiNodeModules
|
|
90
|
+
};
|
|
91
|
+
} else if (impactUiPathToUse) {
|
|
92
|
+
config.mcpServers["impact-ui"].env = {
|
|
93
|
+
"IMPACT_UI_PATH": impactUiPathToUse
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
console.log("\n📦 NPM Package Configuration\n");
|
|
98
|
+
} else {
|
|
99
|
+
// Local development configuration
|
|
100
|
+
const mcpServerPath = resolve(__dirname);
|
|
101
|
+
const indexPath = resolve(__dirname, "src/index.js");
|
|
102
|
+
|
|
103
|
+
config = {
|
|
104
|
+
"mcpServers": {
|
|
105
|
+
"impact-ui": {
|
|
106
|
+
"command": "node",
|
|
107
|
+
"args": [indexPath],
|
|
108
|
+
"cwd": mcpServerPath
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
console.log("\n🏠 Local Development Configuration\n");
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
console.log("Add this to your Windsurf settings:\n");
|
|
117
|
+
console.log("Windsurf Settings Location:");
|
|
118
|
+
console.log(" macOS: ~/Library/Application Support/Windsurf/settings.json");
|
|
119
|
+
console.log(" Windows: %APPDATA%\\Windsurf\\settings.json");
|
|
120
|
+
console.log(" Linux: ~/.config/Windsurf/settings.json\n");
|
|
121
|
+
console.log("Or use: Windsurf → Settings → MCP Servers\n");
|
|
122
|
+
|
|
123
|
+
console.log(JSON.stringify(config, null, 2));
|
|
124
|
+
|
|
125
|
+
console.log("\n⚠️ IMPORTANT FOR WINDSURF:");
|
|
126
|
+
console.log(" Windsurf may not support ${workspaceFolder} variable.");
|
|
127
|
+
console.log(" If this doesn't work, replace ${workspaceFolder} with absolute paths:");
|
|
128
|
+
console.log(" Example: /Users/yourname/projects/your-project");
|
|
129
|
+
console.log("\n See WINDSURF_TROUBLESHOOTING.md for more help.\n");
|
|
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("💡 Make sure to merge it with your existing settings (if any)");
|
|
134
|
+
console.log("🔄 Restart Windsurf IDE after adding the configuration\n");
|
|
135
|
+
|
|
136
|
+
if (useNpm) {
|
|
137
|
+
console.log("📝 Note: Make sure to install the package first:");
|
|
138
|
+
console.log(" npm install impact-ui-mcp-server\n");
|
|
139
|
+
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "impact-ui-mcp-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
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": "
|
|
48
|
+
"url": "https://github.com/impact-analytics/impact-ui.git",
|
|
39
49
|
"directory": "mcp-server"
|
|
40
50
|
},
|
|
41
51
|
"engines": {
|