devlens-mcp 0.4.2 → 0.5.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/README.md +211 -35
- package/RELEASE_NOTES.md +3 -7
- package/dist/bin/cli.js +41 -14
- package/dist/bin/cli.js.map +1 -1
- package/dist/bin/setup.d.ts +14 -0
- package/dist/bin/setup.d.ts.map +1 -0
- package/dist/bin/setup.js +272 -0
- package/dist/bin/setup.js.map +1 -0
- package/dist/src/figma/figma-api.d.ts +108 -0
- package/dist/src/figma/figma-api.d.ts.map +1 -0
- package/dist/src/figma/figma-api.js +284 -0
- package/dist/src/figma/figma-api.js.map +1 -0
- package/dist/src/figma/figma-cache.d.ts +57 -0
- package/dist/src/figma/figma-cache.d.ts.map +1 -0
- package/dist/src/figma/figma-cache.js +266 -0
- package/dist/src/figma/figma-cache.js.map +1 -0
- package/dist/src/figma/figma-client.d.ts +62 -0
- package/dist/src/figma/figma-client.d.ts.map +1 -0
- package/dist/src/figma/figma-client.js +224 -0
- package/dist/src/figma/figma-client.js.map +1 -0
- package/dist/src/figma/figma-rate-limiter.d.ts +46 -0
- package/dist/src/figma/figma-rate-limiter.d.ts.map +1 -0
- package/dist/src/figma/figma-rate-limiter.js +153 -0
- package/dist/src/figma/figma-rate-limiter.js.map +1 -0
- package/dist/src/figma/figma-retry.d.ts +19 -0
- package/dist/src/figma/figma-retry.d.ts.map +1 -0
- package/dist/src/figma/figma-retry.js +57 -0
- package/dist/src/figma/figma-retry.js.map +1 -0
- package/dist/src/figma/figma-structure.d.ts +1 -1
- package/dist/src/figma/figma-structure.d.ts.map +1 -1
- package/dist/src/figma/figma-structure.js +11 -1
- package/dist/src/figma/figma-structure.js.map +1 -1
- package/dist/src/figma/figma-types.d.ts +54 -0
- package/dist/src/figma/figma-types.d.ts.map +1 -0
- package/dist/src/figma/figma-types.js +33 -0
- package/dist/src/figma/figma-types.js.map +1 -0
- package/dist/src/figma/url-parser.d.ts +40 -0
- package/dist/src/figma/url-parser.d.ts.map +1 -0
- package/dist/src/figma/url-parser.js +107 -0
- package/dist/src/figma/url-parser.js.map +1 -0
- package/dist/src/platform/device-manager.d.ts +5 -0
- package/dist/src/platform/device-manager.d.ts.map +1 -1
- package/dist/src/platform/device-manager.js +18 -0
- package/dist/src/platform/device-manager.js.map +1 -1
- package/dist/src/platform/device-pool.d.ts +105 -0
- package/dist/src/platform/device-pool.d.ts.map +1 -0
- package/dist/src/platform/device-pool.js +328 -0
- package/dist/src/platform/device-pool.js.map +1 -0
- package/dist/src/platform/device-profiles.d.ts +50 -0
- package/dist/src/platform/device-profiles.d.ts.map +1 -0
- package/dist/src/platform/device-profiles.js +155 -0
- package/dist/src/platform/device-profiles.js.map +1 -0
- package/dist/src/platform/ios/ios-device.d.ts +0 -2
- package/dist/src/platform/ios/ios-device.d.ts.map +1 -1
- package/dist/src/platform/ios/ios-device.js +8 -18
- package/dist/src/platform/ios/ios-device.js.map +1 -1
- package/dist/src/platform/ios/simctl.d.ts +0 -5
- package/dist/src/platform/ios/simctl.d.ts.map +1 -1
- package/dist/src/platform/ios/simctl.js +0 -4
- package/dist/src/platform/ios/simctl.js.map +1 -1
- package/dist/src/platform/simulator-factory.d.ts +85 -0
- package/dist/src/platform/simulator-factory.d.ts.map +1 -0
- package/dist/src/platform/simulator-factory.js +396 -0
- package/dist/src/platform/simulator-factory.js.map +1 -0
- package/dist/src/platform/system-resources.d.ts +44 -0
- package/dist/src/platform/system-resources.d.ts.map +1 -0
- package/dist/src/platform/system-resources.js +103 -0
- package/dist/src/platform/system-resources.js.map +1 -0
- package/dist/src/prototype/browser-engine.d.ts +62 -0
- package/dist/src/prototype/browser-engine.d.ts.map +1 -0
- package/dist/src/prototype/browser-engine.js +199 -0
- package/dist/src/prototype/browser-engine.js.map +1 -0
- package/dist/src/prototype/figma-navigator.d.ts +40 -0
- package/dist/src/prototype/figma-navigator.d.ts.map +1 -0
- package/dist/src/prototype/figma-navigator.js +95 -0
- package/dist/src/prototype/figma-navigator.js.map +1 -0
- package/dist/src/prototype/flow-reporter.d.ts +47 -0
- package/dist/src/prototype/flow-reporter.d.ts.map +1 -0
- package/dist/src/prototype/flow-reporter.js +255 -0
- package/dist/src/prototype/flow-reporter.js.map +1 -0
- package/dist/src/prototype/screen-analyzer.d.ts +31 -0
- package/dist/src/prototype/screen-analyzer.d.ts.map +1 -0
- package/dist/src/prototype/screen-analyzer.js +114 -0
- package/dist/src/prototype/screen-analyzer.js.map +1 -0
- package/dist/src/prototype/web-crawler.d.ts +31 -0
- package/dist/src/prototype/web-crawler.d.ts.map +1 -0
- package/dist/src/prototype/web-crawler.js +88 -0
- package/dist/src/prototype/web-crawler.js.map +1 -0
- package/dist/src/reports/cross-device-report.d.ts +84 -0
- package/dist/src/reports/cross-device-report.d.ts.map +1 -0
- package/dist/src/reports/cross-device-report.js +342 -0
- package/dist/src/reports/cross-device-report.js.map +1 -0
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +9 -1
- package/dist/src/server.js.map +1 -1
- package/dist/src/snapshot/formatter.d.ts +5 -13
- package/dist/src/snapshot/formatter.d.ts.map +1 -1
- package/dist/src/snapshot/formatter.js +19 -28
- package/dist/src/snapshot/formatter.js.map +1 -1
- package/dist/src/tools/interaction-tools.d.ts +6 -6
- package/dist/src/tools/interaction-tools.d.ts.map +1 -1
- package/dist/src/tools/interaction-tools.js +2 -12
- package/dist/src/tools/interaction-tools.js.map +1 -1
- package/dist/src/tools/metro-tools.d.ts +2 -2
- package/dist/src/tools/multi-device-tools.d.ts +133 -0
- package/dist/src/tools/multi-device-tools.d.ts.map +1 -0
- package/dist/src/tools/multi-device-tools.js +365 -0
- package/dist/src/tools/multi-device-tools.js.map +1 -0
- package/dist/src/tools/navigation-tools.d.ts.map +1 -1
- package/dist/src/tools/navigation-tools.js +1 -6
- package/dist/src/tools/navigation-tools.js.map +1 -1
- package/dist/src/tools/prototype-tools.d.ts +102 -0
- package/dist/src/tools/prototype-tools.d.ts.map +1 -0
- package/dist/src/tools/prototype-tools.js +391 -0
- package/dist/src/tools/prototype-tools.js.map +1 -0
- package/dist/src/tools/screenshot-tools.d.ts +7 -74
- package/dist/src/tools/screenshot-tools.d.ts.map +1 -1
- package/dist/src/tools/screenshot-tools.js +19 -286
- package/dist/src/tools/screenshot-tools.js.map +1 -1
- package/dist/src/tools/vqa-tools.d.ts +2 -2
- package/dist/src/tools/vqa-tools.d.ts.map +1 -1
- package/dist/src/tools/vqa-tools.js +4 -69
- package/dist/src/tools/vqa-tools.js.map +1 -1
- package/docs/figma-workflow.md +58 -6
- package/docs/installation-guide.md +302 -0
- package/docs/setup-guide.md +77 -79
- package/docs/tool-reference.md +152 -69
- package/install.sh +119 -0
- package/package.json +5 -2
- package/setup.sh +320 -0
- package/tsconfig.json +1 -1
package/docs/figma-workflow.md
CHANGED
|
@@ -237,15 +237,12 @@ When you use any of the prompts above, the AI agent automatically runs this sequ
|
|
|
237
237
|
3. devlens_hot_reload ← Push changes to device
|
|
238
238
|
4. devlens_wait_for_screen(stableMs: 1500) ← Wait for render
|
|
239
239
|
5. devlens_snapshot(validate: true) ← Get element tree + catch invisible bugs
|
|
240
|
-
6.
|
|
241
|
-
figmaUrl: "https://figma.com/design/..."
|
|
242
|
-
)
|
|
243
|
-
7. devlens_vqa_validate( ← Run VQA
|
|
240
|
+
6. devlens_vqa_validate( ← Run VQA
|
|
244
241
|
figmaUrl: "https://figma.com/design/...",
|
|
245
242
|
checkCategories: ["spacing", "color", "alignment", "sizing", "missing"]
|
|
246
243
|
)
|
|
247
|
-
|
|
248
|
-
|
|
244
|
+
7. (AI reads VQA report, applies fix suggestions to code)
|
|
245
|
+
8. Repeat steps 3-7 until VQA status = PASS
|
|
249
246
|
```
|
|
250
247
|
|
|
251
248
|
---
|
|
@@ -415,6 +412,61 @@ DevLens works great alongside:
|
|
|
415
412
|
|
|
416
413
|
---
|
|
417
414
|
|
|
415
|
+
## Prototype Exploration (v0.5.0)
|
|
416
|
+
|
|
417
|
+
In addition to static Figma frame comparison, DevLens can now explore full prototypes and mocks — both web-hosted (Vercel, Netlify) and Figma prototypes.
|
|
418
|
+
|
|
419
|
+
### Bidirectional Prompting Flow
|
|
420
|
+
|
|
421
|
+
```
|
|
422
|
+
Developer gives Figma link
|
|
423
|
+
└─► devlens_check_prototype(url)
|
|
424
|
+
└─► "Figma design found! Prototype connections exist."
|
|
425
|
+
└─► "ACTION NEEDED: provide prototype/mock URL"
|
|
426
|
+
|
|
427
|
+
Developer gives prototype/mock URL
|
|
428
|
+
└─► devlens_check_prototype(url)
|
|
429
|
+
└─► "Web prototype found! 12 screens discovered."
|
|
430
|
+
└─► "ACTION NEEDED: provide Figma design link"
|
|
431
|
+
|
|
432
|
+
Both URLs provided
|
|
433
|
+
└─► devlens_explore_prototype(prototypeUrl, figmaUrl)
|
|
434
|
+
└─► Full exploration + enriched design tokens
|
|
435
|
+
└─► Near-100% build accuracy
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
### Workflow 1: Dev gives Figma link first
|
|
439
|
+
|
|
440
|
+
```
|
|
441
|
+
1. "Here's the Figma: https://figma.com/design/ABC123/MyApp?node-id=10-200"
|
|
442
|
+
2. devlens_check_prototype(url) → "8 screens, prototype connections found!"
|
|
443
|
+
3. AI asks: "Is there a prototype link for this design?"
|
|
444
|
+
4. Dev: "https://figma.com/proto/ABC123/MyApp"
|
|
445
|
+
5. devlens_explore_prototype(prototypeUrl, figmaUrl) → Full flow report
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### Workflow 2: Dev gives prototype/mock URL first
|
|
449
|
+
|
|
450
|
+
```
|
|
451
|
+
1. "Check this prototype: https://productprototype.vercel.app"
|
|
452
|
+
2. devlens_check_prototype(url) → "12 screens discovered!"
|
|
453
|
+
3. AI asks: "Is there a Figma file for this?"
|
|
454
|
+
4. Dev: "https://figma.com/design/XYZ/JioAICloud?node-id=5-100"
|
|
455
|
+
5. devlens_explore_prototype(prototypeUrl, figmaUrl) → Full flow report
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### What you get from exploration
|
|
459
|
+
|
|
460
|
+
- High-res screenshot of every screen
|
|
461
|
+
- Colour palette per screen
|
|
462
|
+
- Typography detected from headings
|
|
463
|
+
- Component inventory (cards, tabs, galleries, nav bars)
|
|
464
|
+
- Interactive element map (buttons, links, inputs)
|
|
465
|
+
- Flow diagram showing screen connections
|
|
466
|
+
- Design tokens aggregated across all screens
|
|
467
|
+
|
|
468
|
+
---
|
|
469
|
+
|
|
418
470
|
## Troubleshooting
|
|
419
471
|
|
|
420
472
|
### Similarity is always low (< 50%)
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
# DevLens MCP Installation Guide
|
|
2
|
+
|
|
3
|
+
A step-by-step visual guide for setting up DevLens in your development environment.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
Before starting, ensure you have:
|
|
10
|
+
- **Node.js 18+** installed (`node -v` to check)
|
|
11
|
+
- **npm** (comes with Node.js)
|
|
12
|
+
- Access to the **JioOmni Azure DevOps** organization
|
|
13
|
+
- **Cursor IDE** (or Claude Desktop / Claude Code)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Step 1: Create an Azure DevOps Personal Access Token (PAT)
|
|
18
|
+
|
|
19
|
+
The PAT authenticates you with the private DevLens package registry.
|
|
20
|
+
|
|
21
|
+
1. Open your browser and go to:
|
|
22
|
+
```
|
|
23
|
+
https://dev.azure.com/JioOmni/_usersSettings/tokens
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
> **Screenshot 1** — Azure DevOps "Personal Access Tokens" page showing the token list
|
|
27
|
+
|
|
28
|
+
2. Click the **"+ New Token"** button in the top-right corner.
|
|
29
|
+
|
|
30
|
+
> **Screenshot 2** — The "New Token" button highlighted on the tokens page
|
|
31
|
+
|
|
32
|
+
3. Fill in the token creation form:
|
|
33
|
+
- **Name**: `devlens-mcp` (or any name you prefer)
|
|
34
|
+
- **Organization**: `JioOmni`
|
|
35
|
+
- **Expiration**: Choose a suitable duration (e.g., 90 days or custom)
|
|
36
|
+
- **Scopes**: Click **"Custom defined"**, then check **Packaging > Read**
|
|
37
|
+
|
|
38
|
+
> **Screenshot 3** — The "Create a new personal access token" form with fields filled in. Name set to "devlens-mcp", scope showing Packaging > Read checked.
|
|
39
|
+
|
|
40
|
+
4. Click **"Create"**. Your PAT will be displayed **once** — copy it immediately.
|
|
41
|
+
|
|
42
|
+
> **Screenshot 4** — The "Success!" dialog showing the generated PAT with the copy button highlighted. Add a callout: "Copy this now! You won't be able to see it again."
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Step 2: Configure npm Authentication
|
|
47
|
+
|
|
48
|
+
Open your terminal and run these commands. Replace `YOUR_PAT` with the token you copied in Step 1.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Encode your PAT
|
|
52
|
+
TOKEN=$(echo -n "YOUR_PAT" | base64)
|
|
53
|
+
|
|
54
|
+
# Configure npm to authenticate with the DevLens registry
|
|
55
|
+
npm config set //pkgs.dev.azure.com/JioOmni/_packaging/devlens/npm/registry/:username "JioOmni"
|
|
56
|
+
npm config set //pkgs.dev.azure.com/JioOmni/_packaging/devlens/npm/registry/:_password "$TOKEN"
|
|
57
|
+
npm config set //pkgs.dev.azure.com/JioOmni/_packaging/devlens/npm/registry/:email "you@ril.com"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
> **Screenshot 5** — Terminal showing the three `npm config set` commands executed successfully (no output = success)
|
|
61
|
+
|
|
62
|
+
**Verify**: Run `npm config list` — you should see the Azure registry entries.
|
|
63
|
+
|
|
64
|
+
> **Screenshot 6** — Terminal showing `npm config list` output with the Azure Artifacts registry entries visible
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Step 3: Install DevLens Globally
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm install -g devlens-mcp@latest --registry=https://pkgs.dev.azure.com/JioOmni/_packaging/devlens/npm/registry/
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
> **Screenshot 7** — Terminal showing successful `npm install -g` output with the `+ devlens-mcp@0.5.x` confirmation line
|
|
75
|
+
|
|
76
|
+
**Verify**: Run `devlens-mcp --version` — you should see the version number.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
devlens-mcp --version
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
> **Screenshot 8** — Terminal showing `devlens-mcp --version` output (e.g., "devlens-mcp v0.5.2")
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Step 4: Configure Your IDE
|
|
87
|
+
|
|
88
|
+
### For Cursor
|
|
89
|
+
|
|
90
|
+
1. Create or edit the file `~/.cursor/mcp.json`:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
mkdir -p ~/.cursor
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
2. Open `~/.cursor/mcp.json` in any editor and paste this configuration:
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"mcpServers": {
|
|
101
|
+
"devlens": {
|
|
102
|
+
"command": "devlens-mcp",
|
|
103
|
+
"args": [],
|
|
104
|
+
"env": {
|
|
105
|
+
"METRO_PORT": "8081"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
> **Screenshot 9** — The `~/.cursor/mcp.json` file open in an editor showing the configuration above
|
|
113
|
+
|
|
114
|
+
3. **Completely quit Cursor** (Cmd+Q on Mac, not just close the window) and reopen it.
|
|
115
|
+
|
|
116
|
+
4. Open a project and verify DevLens is connected. You should see "devlens" in the MCP server list.
|
|
117
|
+
|
|
118
|
+
> **Screenshot 10** — Cursor IDE showing the MCP servers panel with "devlens" listed and connected (green indicator)
|
|
119
|
+
|
|
120
|
+
5. Test it! Ask the AI: **"List running devices"** or **"Take a screenshot"**
|
|
121
|
+
|
|
122
|
+
> **Screenshot 11** — Cursor AI chat showing a successful DevLens tool call (e.g., `devlens_list_devices` returning a device list)
|
|
123
|
+
|
|
124
|
+
### For Claude Desktop
|
|
125
|
+
|
|
126
|
+
1. Open the Claude Desktop config file:
|
|
127
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
128
|
+
- **Windows**: `%APPDATA%/Claude/claude_desktop_config.json`
|
|
129
|
+
|
|
130
|
+
2. Add the DevLens MCP server:
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"mcpServers": {
|
|
135
|
+
"devlens": {
|
|
136
|
+
"command": "devlens-mcp",
|
|
137
|
+
"args": [],
|
|
138
|
+
"env": {
|
|
139
|
+
"METRO_PORT": "8081"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
3. Restart Claude Desktop.
|
|
147
|
+
|
|
148
|
+
### For Claude Code (CLI)
|
|
149
|
+
|
|
150
|
+
Run this single command:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
claude mcp add devlens -- devlens-mcp
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Step 5: Add Figma Token (Optional)
|
|
159
|
+
|
|
160
|
+
For Figma comparison features (`devlens_compare_with_figma`, `devlens_vqa_validate`):
|
|
161
|
+
|
|
162
|
+
1. Go to https://www.figma.com/settings
|
|
163
|
+
|
|
164
|
+
> **Screenshot 12** — Figma Settings page showing the "Personal access tokens" section
|
|
165
|
+
|
|
166
|
+
2. Click **"Generate new token"** under "Personal access tokens"
|
|
167
|
+
- **Description**: `devlens`
|
|
168
|
+
- **Expiration**: No expiration (or your preference)
|
|
169
|
+
- **Scopes**: Select **File content > Read-only**
|
|
170
|
+
|
|
171
|
+
> **Screenshot 13** — Figma token creation dialog with "File content: Read-only" scope selected
|
|
172
|
+
|
|
173
|
+
3. Copy the token (starts with `figd_...`)
|
|
174
|
+
|
|
175
|
+
4. Add it to your MCP config in the `env` section:
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"mcpServers": {
|
|
180
|
+
"devlens": {
|
|
181
|
+
"command": "devlens-mcp",
|
|
182
|
+
"args": [],
|
|
183
|
+
"env": {
|
|
184
|
+
"METRO_PORT": "8081",
|
|
185
|
+
"FIGMA_TOKEN": "figd_xxxxx"
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
5. Restart your IDE.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## One-Command Installer (Alternative)
|
|
197
|
+
|
|
198
|
+
If you prefer a fully automated setup, copy-paste this entire block into your terminal:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
bash <(cat << 'DEVLENS_INSTALL'
|
|
202
|
+
#!/usr/bin/env bash
|
|
203
|
+
set -e
|
|
204
|
+
echo "Create PAT at: https://dev.azure.com/JioOmni/_usersSettings/tokens (scope: Packaging -> Read)"
|
|
205
|
+
read -rsp "Paste your Azure PAT: " PAT && echo
|
|
206
|
+
TOKEN=$(echo -n "$PAT" | base64)
|
|
207
|
+
REGISTRY_KEY="//pkgs.dev.azure.com/JioOmni/_packaging/devlens/npm/registry/"
|
|
208
|
+
npm config set "${REGISTRY_KEY}:username" "JioOmni"
|
|
209
|
+
npm config set "${REGISTRY_KEY}:_password" "$TOKEN"
|
|
210
|
+
npm config set "${REGISTRY_KEY}:email" "npm@jio.com"
|
|
211
|
+
echo "Installing DevLens..."
|
|
212
|
+
npm install -g devlens-mcp@latest --registry=https://pkgs.dev.azure.com/JioOmni/_packaging/devlens/npm/registry/
|
|
213
|
+
mkdir -p ~/.cursor
|
|
214
|
+
node -e "
|
|
215
|
+
const fs = require('fs');
|
|
216
|
+
const p = require('path').join(require('os').homedir(), '.cursor', 'mcp.json');
|
|
217
|
+
let cfg = {};
|
|
218
|
+
try { cfg = JSON.parse(fs.readFileSync(p, 'utf-8')); } catch {}
|
|
219
|
+
if (!cfg.mcpServers) cfg.mcpServers = {};
|
|
220
|
+
cfg.mcpServers.devlens = { command: 'devlens-mcp', args: [], env: { METRO_PORT: '8081' } };
|
|
221
|
+
fs.writeFileSync(p, JSON.stringify(cfg, null, 2) + '\n');
|
|
222
|
+
"
|
|
223
|
+
echo "Done! Run: devlens-mcp --version to verify, then restart Cursor."
|
|
224
|
+
DEVLENS_INSTALL
|
|
225
|
+
)
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
> **Screenshot 14** — Terminal showing the one-command installer running: PAT prompt, installation progress, and success message
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Updating DevLens
|
|
233
|
+
|
|
234
|
+
To update to the latest version:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
npm update -g devlens-mcp --registry=https://pkgs.dev.azure.com/JioOmni/_packaging/devlens/npm/registry/
|
|
238
|
+
devlens-mcp --version
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Then restart your IDE.
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Troubleshooting
|
|
246
|
+
|
|
247
|
+
### "npm ERR! 401 Unauthorized" or "403 Forbidden"
|
|
248
|
+
|
|
249
|
+
Your PAT doesn't have the correct permissions or has expired.
|
|
250
|
+
- Create a new PAT at https://dev.azure.com/JioOmni/_usersSettings/tokens
|
|
251
|
+
- Ensure the scope includes **Packaging > Read**
|
|
252
|
+
- Re-run the npm config commands from Step 2
|
|
253
|
+
|
|
254
|
+
### "command not found: devlens-mcp"
|
|
255
|
+
|
|
256
|
+
The global npm bin directory isn't in your PATH.
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
# Check where npm installs global packages
|
|
260
|
+
npm bin -g
|
|
261
|
+
|
|
262
|
+
# Add to your shell profile (~/.zshrc or ~/.bashrc)
|
|
263
|
+
export PATH="$(npm bin -g):$PATH"
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### DevLens not showing in Cursor
|
|
267
|
+
|
|
268
|
+
1. Verify the config file exists: `cat ~/.cursor/mcp.json`
|
|
269
|
+
2. Verify DevLens is installed: `devlens-mcp --version`
|
|
270
|
+
3. Completely quit Cursor (Cmd+Q) and reopen — do not just reload the window
|
|
271
|
+
4. Check Cursor's MCP logs for errors
|
|
272
|
+
|
|
273
|
+
### npx cache errors
|
|
274
|
+
|
|
275
|
+
If you previously used the npx setup, clear the cache:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
rm -rf ~/.npm/_npx
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Then use the global install method described above.
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Summary
|
|
286
|
+
|
|
287
|
+
| Step | Action | Time |
|
|
288
|
+
|------|--------|------|
|
|
289
|
+
| 1 | Create Azure DevOps PAT | 1 min |
|
|
290
|
+
| 2 | Configure npm auth | 30 sec |
|
|
291
|
+
| 3 | Install globally | 30 sec |
|
|
292
|
+
| 4 | Configure IDE | 30 sec |
|
|
293
|
+
| 5 | (Optional) Add Figma token | 1 min |
|
|
294
|
+
| **Total** | | **~3 min** |
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Need Help?
|
|
299
|
+
|
|
300
|
+
- **Repository**: https://dev.azure.com/JioOmni/OmniAI/_git/mcp-devlens
|
|
301
|
+
- **Azure Artifacts Feed**: https://dev.azure.com/JioOmni/OmniAI/_artifacts/feed/devlens
|
|
302
|
+
- Contact the DevLens team on your internal Slack/Teams channel
|
package/docs/setup-guide.md
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
# DevLens Setup Guide
|
|
2
2
|
|
|
3
|
+
> **New here?** See the [Visual Installation Guide](./installation-guide.md) for a step-by-step walkthrough with screenshots.
|
|
4
|
+
|
|
3
5
|
## 1-Minute Install (Cursor IDE)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
**Step 1 — Install globally** (one-time, requires [Azure PAT setup](./installation-guide.md#step-1-create-an-azure-devops-personal-access-token-pat)):
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g devlens-mcp@latest --registry=https://pkgs.dev.azure.com/JioOmni/_packaging/devlens/npm/registry/
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Step 2 — Configure Cursor.** Add this to `~/.cursor/mcp.json` and restart Cursor:
|
|
6
14
|
|
|
7
15
|
```json
|
|
8
16
|
{
|
|
9
17
|
"mcpServers": {
|
|
10
18
|
"devlens": {
|
|
11
|
-
"command": "
|
|
12
|
-
"args": [
|
|
19
|
+
"command": "devlens-mcp",
|
|
20
|
+
"args": [],
|
|
13
21
|
"env": {
|
|
14
22
|
"METRO_PORT": "8081"
|
|
15
23
|
}
|
|
@@ -20,9 +28,7 @@ Add this to `~/.cursor/mcp.json` and restart Cursor:
|
|
|
20
28
|
|
|
21
29
|
That's it. DevLens tools will appear in Cursor's MCP panel after restart.
|
|
22
30
|
|
|
23
|
-
> **
|
|
24
|
-
>
|
|
25
|
-
> **Why `/bin/zsh -l`?** Cursor doesn't load your shell profile, so `node` from nvm/fnm isn't in PATH. Using `/bin/zsh -l` loads your login profile first. DevLens v0.4.0+ handles this automatically — if you put `/bin/bash` but use zsh, it will auto-correct.
|
|
31
|
+
> **Why global install over npx?** The `npx` approach had frequent issues: cache corruption, permission errors, slow cold starts with the private Azure Artifacts registry. Global install (`npm install -g`) is faster, more reliable, and avoids the `/bin/zsh -l` shell wrapper that was previously needed.
|
|
26
32
|
|
|
27
33
|
---
|
|
28
34
|
|
|
@@ -30,33 +36,23 @@ That's it. DevLens tools will appear in Cursor's MCP panel after restart.
|
|
|
30
36
|
|
|
31
37
|
### Claude Code
|
|
32
38
|
```bash
|
|
33
|
-
claude mcp add devlens --
|
|
39
|
+
claude mcp add devlens -- devlens-mcp
|
|
34
40
|
```
|
|
35
|
-
> Claude Code loads shell profiles automatically, so no `/bin/zsh` wrapper needed.
|
|
36
41
|
|
|
37
42
|
### Claude Desktop
|
|
38
|
-
Edit `~/Library/Application Support/Claude/claude_desktop_config.json
|
|
43
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%/Claude/claude_desktop_config.json` (Windows):
|
|
39
44
|
```json
|
|
40
45
|
{
|
|
41
46
|
"mcpServers": {
|
|
42
47
|
"devlens": {
|
|
43
|
-
"command": "
|
|
44
|
-
"args": [
|
|
48
|
+
"command": "devlens-mcp",
|
|
49
|
+
"args": [],
|
|
45
50
|
"env": { "METRO_PORT": "8081" }
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
53
|
}
|
|
49
54
|
```
|
|
50
55
|
|
|
51
|
-
### Local Development (Build from Source)
|
|
52
|
-
```bash
|
|
53
|
-
git clone https://JioOmni@dev.azure.com/JioOmni/OmniAI/_git/mcp-devlens
|
|
54
|
-
cd mcp-devlens && npm install && npm run build
|
|
55
|
-
npm run register # auto-registers with Claude Code
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
For Cursor with local build, use `"command": "node"` and `"args": ["/absolute/path/to/mcp-devlens/dist/bin/cli.js"]` instead of the zsh wrapper.
|
|
59
|
-
|
|
60
56
|
---
|
|
61
57
|
|
|
62
58
|
## Prerequisites
|
|
@@ -92,8 +88,8 @@ Full example with all optional vars:
|
|
|
92
88
|
{
|
|
93
89
|
"mcpServers": {
|
|
94
90
|
"devlens": {
|
|
95
|
-
"command": "
|
|
96
|
-
"args": [
|
|
91
|
+
"command": "devlens-mcp",
|
|
92
|
+
"args": [],
|
|
97
93
|
"env": {
|
|
98
94
|
"METRO_PORT": "8081",
|
|
99
95
|
"FIGMA_TOKEN": "figd_xxxxx",
|
|
@@ -174,7 +170,7 @@ For the full VQA workflow guide with report format details, see [Figma Workflow]
|
|
|
174
170
|
|
|
175
171
|
## Figma Token Setup
|
|
176
172
|
|
|
177
|
-
Required for `devlens_compare_with_figma
|
|
173
|
+
Required only for `devlens_compare_with_figma`.
|
|
178
174
|
|
|
179
175
|
1. Go to [figma.com/settings](https://www.figma.com/settings)
|
|
180
176
|
2. Scroll to **Personal access tokens** → **Generate new token**
|
|
@@ -231,8 +227,8 @@ Optional. Enables `devlens_ds_context` for design-token-aware code generation.
|
|
|
231
227
|
{
|
|
232
228
|
"mcpServers": {
|
|
233
229
|
"devlens": {
|
|
234
|
-
"command": "
|
|
235
|
-
"args": [
|
|
230
|
+
"command": "devlens-mcp",
|
|
231
|
+
"args": [],
|
|
236
232
|
"env": {
|
|
237
233
|
"METRO_PORT": "8081",
|
|
238
234
|
"FIGMA_TOKEN": "figd_xxxxx",
|
|
@@ -251,78 +247,63 @@ Ask your AI: *"Load the design system context"* — it should return token names
|
|
|
251
247
|
|
|
252
248
|
## Troubleshooting
|
|
253
249
|
|
|
254
|
-
### Fix:
|
|
250
|
+
### Fix: "command not found: devlens-mcp"
|
|
255
251
|
|
|
256
|
-
|
|
257
|
-
```json
|
|
258
|
-
{
|
|
259
|
-
"command": "/opt/homebrew/bin/node",
|
|
260
|
-
"args": ["-l", "-c", "npx devlens-mcp@latest"]
|
|
261
|
-
}
|
|
262
|
-
```
|
|
263
|
-
This is incorrect — `-l` and `-c` are shell flags (zsh/bash), not node flags. Node ignores or errors on them.
|
|
252
|
+
The global npm bin directory isn't in your PATH.
|
|
264
253
|
|
|
265
|
-
|
|
254
|
+
```bash
|
|
255
|
+
# Check where npm installs global packages
|
|
256
|
+
npm bin -g
|
|
266
257
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
{
|
|
270
|
-
"command": "/bin/zsh",
|
|
271
|
-
"args": ["-l", "-c", "npx devlens-mcp@latest"]
|
|
272
|
-
}
|
|
258
|
+
# Add to your shell profile (~/.zshrc or ~/.bashrc)
|
|
259
|
+
export PATH="$(npm bin -g):$PATH"
|
|
273
260
|
```
|
|
274
261
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
### Fix: `env: node: No such file or directory`
|
|
262
|
+
Alternatively, check `devlens-mcp` is installed: `npm list -g devlens-mcp`
|
|
278
263
|
|
|
279
|
-
|
|
264
|
+
---
|
|
280
265
|
|
|
281
|
-
|
|
282
|
-
```json
|
|
283
|
-
{
|
|
284
|
-
"command": "/bin/zsh",
|
|
285
|
-
"args": ["-l", "-c", "npx devlens-mcp@latest"]
|
|
286
|
-
}
|
|
287
|
-
```
|
|
266
|
+
### Fix: npm ERR! 401/403 Unauthorized
|
|
288
267
|
|
|
289
|
-
|
|
268
|
+
Your Azure PAT doesn't have the correct permissions or has expired.
|
|
290
269
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
270
|
+
1. Create a new PAT at https://dev.azure.com/JioOmni/_usersSettings/tokens
|
|
271
|
+
2. Ensure the scope includes **Packaging > Read**
|
|
272
|
+
3. Re-run the npm config commands from the [Installation Guide](./installation-guide.md#step-2-configure-npm-authentication)
|
|
294
273
|
|
|
295
274
|
---
|
|
296
275
|
|
|
297
276
|
### Fix: "No server info found" / DevLens tools not showing
|
|
298
277
|
|
|
299
|
-
This means Cursor couldn't start the MCP server. Check
|
|
300
|
-
|
|
301
|
-
1. **Is the JSON valid?** Paste your `~/.cursor/mcp.json` into [jsonlint.com](https://jsonlint.com) to check for syntax errors (trailing commas, missing quotes, etc.)
|
|
278
|
+
This means Cursor couldn't start the MCP server. Check in order:
|
|
302
279
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
3. **
|
|
306
|
-
|
|
307
|
-
npx devlens-mcp@latest
|
|
308
|
-
```
|
|
309
|
-
- If this hangs (no output) — that's correct, it's waiting for MCP input via stdin. Press `Ctrl+C`.
|
|
310
|
-
- If it errors with `env: node: No such file` — see the [nvm/PATH fix](#fix-nvmpath-issue-env-node-no-such-file-or-directory) above.
|
|
311
|
-
- If it errors with `Cannot find module` — clear the npx cache: `rm -rf ~/.npm/_npx/*devlens*` and try again.
|
|
312
|
-
|
|
313
|
-
4. **Restart Cursor completely** (quit and reopen, not just reload window).
|
|
280
|
+
1. **Is DevLens installed?** Run `devlens-mcp --version` in Terminal.
|
|
281
|
+
2. **Is the JSON valid?** Paste your `~/.cursor/mcp.json` into [jsonlint.com](https://jsonlint.com) to check for syntax errors.
|
|
282
|
+
3. **Is the config correct?** It should be `"command": "devlens-mcp"` with `"args": []`.
|
|
283
|
+
4. **Restart Cursor completely** (Cmd+Q and reopen, not just reload window).
|
|
314
284
|
|
|
315
285
|
---
|
|
316
286
|
|
|
317
|
-
### Fix:
|
|
287
|
+
### Fix: Migrating from the old npx setup
|
|
318
288
|
|
|
319
|
-
If you
|
|
289
|
+
If you previously used the `npx` / `/bin/zsh -l` wrapper approach:
|
|
320
290
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
291
|
+
1. Install globally:
|
|
292
|
+
```bash
|
|
293
|
+
npm install -g devlens-mcp@latest --registry=https://pkgs.dev.azure.com/JioOmni/_packaging/devlens/npm/registry/
|
|
294
|
+
```
|
|
295
|
+
2. Update `~/.cursor/mcp.json` — replace:
|
|
296
|
+
```json
|
|
297
|
+
"command": "/bin/zsh",
|
|
298
|
+
"args": ["-l", "-c", "npx devlens-mcp@latest"]
|
|
299
|
+
```
|
|
300
|
+
with:
|
|
301
|
+
```json
|
|
302
|
+
"command": "devlens-mcp",
|
|
303
|
+
"args": []
|
|
304
|
+
```
|
|
305
|
+
3. Clear the old npx cache: `rm -rf ~/.npm/_npx`
|
|
306
|
+
4. Restart Cursor.
|
|
326
307
|
|
|
327
308
|
---
|
|
328
309
|
|
|
@@ -343,7 +324,7 @@ Then restart Cursor. npx will re-download the latest version.
|
|
|
343
324
|
|
|
344
325
|
## What's Available
|
|
345
326
|
|
|
346
|
-
DevLens provides **
|
|
327
|
+
DevLens provides **43 tools** across 11 categories:
|
|
347
328
|
|
|
348
329
|
| Category | Tools | Count |
|
|
349
330
|
|----------|-------|-------|
|
|
@@ -351,10 +332,27 @@ DevLens provides **37 tools** across 9 categories:
|
|
|
351
332
|
| App Management | launch_app, terminate_app, install_app, list_apps | 4 |
|
|
352
333
|
| Snapshot & Elements | snapshot, find_element, wait_for_element, wait_for_screen, element_info | 5 |
|
|
353
334
|
| Interaction | tap, type, swipe, scroll, long_press, press_button, fill_form, capture_flow | 8 |
|
|
354
|
-
| Screenshots & Visual | screenshot, compare_screenshot, element_screenshot, compare_images, compare_with_figma
|
|
335
|
+
| Screenshots & Visual | screenshot, compare_screenshot, element_screenshot, compare_images, compare_with_figma | 5 |
|
|
355
336
|
| React Native / Metro | metro_status, metro_logs, component_tree, hot_reload, network_requests, dismiss_overlays | 6 |
|
|
356
337
|
| Navigation | open_url, go_back | 2 |
|
|
357
338
|
| Design System | ds_context | 1 |
|
|
358
339
|
| Analysis & VQA | analyze, vqa_validate | 2 |
|
|
340
|
+
| Prototype Explorer | check_prototype, explore_prototype, prototype_screen | 3 |
|
|
341
|
+
|
|
342
|
+
### Prototype Explorer (v0.5.0)
|
|
343
|
+
|
|
344
|
+
The prototype explorer tools let AI agents explore web-hosted or Figma prototypes:
|
|
345
|
+
|
|
346
|
+
```
|
|
347
|
+
Developer gives Figma link ──► DevLens asks: "Prototype link bhi do"
|
|
348
|
+
Developer gives prototype ──► DevLens asks: "Figma design link bhi do"
|
|
349
|
+
Both links together = Near-100% build accuracy
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
**Web prototypes** (Vercel, Netlify, etc.) are crawled in a headless browser; every route is visited, screenshots captured, and design tokens extracted.
|
|
353
|
+
|
|
354
|
+
**Figma prototypes** are navigated using the Figma REST API flow graph combined with headless Chrome interaction.
|
|
355
|
+
|
|
356
|
+
Requires the `puppeteer` package (bundled with DevLens).
|
|
359
357
|
|
|
360
358
|
See the [Tool Reference](./tool-reference.md) for detailed parameter docs.
|