@velt-js/mcp-installer 0.1.0

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 ADDED
@@ -0,0 +1,373 @@
1
+ # Velt MCP Installer
2
+
3
+ An MCP (Model Context Protocol) server that provides AI-assisted installation of Velt collaboration features into React and Next.js projects.
4
+
5
+ ## Setup
6
+
7
+ Add the Velt MCP server to your coding IDE. Pick the section that matches your editor.
8
+
9
+ ### Claude Code
10
+
11
+ Run this command in your terminal:
12
+
13
+ ```bash
14
+ claude mcp add velt-installer -- npx -y @velt-js/mcp-installer
15
+ ```
16
+
17
+ ### Cursor
18
+
19
+ Add to `.cursor/mcp.json` in your project (or global config):
20
+
21
+ ```json
22
+ {
23
+ "mcpServers": {
24
+ "velt-installer": {
25
+ "command": "npx",
26
+ "args": ["-y", "@velt-js/mcp-installer"]
27
+ }
28
+ }
29
+ }
30
+ ```
31
+
32
+ ### Windsurf
33
+
34
+ Add to your Windsurf MCP config:
35
+
36
+ ```json
37
+ {
38
+ "mcpServers": {
39
+ "velt-installer": {
40
+ "command": "npx",
41
+ "args": ["-y", "@velt-js/mcp-installer"]
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ ### Claude Desktop
48
+
49
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
50
+
51
+ ```json
52
+ {
53
+ "mcpServers": {
54
+ "velt-installer": {
55
+ "command": "npx",
56
+ "args": ["-y", "@velt-js/mcp-installer"]
57
+ }
58
+ }
59
+ }
60
+ ```
61
+
62
+ ### Any other MCP-compatible IDE
63
+
64
+ The server runs over stdio. Use this command:
65
+
66
+ ```
67
+ npx -y @velt-js/mcp-installer
68
+ ```
69
+
70
+ Add it to your IDE's MCP server configuration with `command: "npx"` and `args: ["-y", "@velt-js/mcp-installer"]`.
71
+
72
+ ---
73
+
74
+ After adding the config, **restart your IDE** to load the MCP server.
75
+
76
+ ## Usage
77
+
78
+ In your AI chat, say:
79
+
80
+ ```
81
+ install velt
82
+ ```
83
+
84
+ The AI will walk you through:
85
+
86
+ 1. Confirming your project directory
87
+ 2. Providing your Velt API key and auth token (from https://console.velt.dev)
88
+ 3. Selecting features (or typing SKIP for CLI-only mode)
89
+ 4. Choosing VeltProvider location
90
+ 5. Choosing corner position for Velt UI components
91
+ 6. Reviewing the implementation plan
92
+ 7. Approving and applying the plan
93
+
94
+ ## Installation Modes
95
+
96
+ ### Guided Mode (Default)
97
+
98
+ Full interactive installation with plan generation and user approval:
99
+
100
+ 1. Confirm project directory (validates React/Next.js project)
101
+ 2. Provide API key and auth token
102
+ 3. Select features (comments, presence, cursors, notifications, recorder, CRDT)
103
+ 4. Choose VeltProvider location (app/page.tsx recommended)
104
+ 5. Choose corner position for Velt features (top-left/top-right/bottom-left/bottom-right)
105
+ 6. Tool generates implementation plan
106
+ 7. User reviews and approves the plan
107
+ 8. AI applies the plan step-by-step
108
+ 9. Full QA validation
109
+
110
+ ### CLI-Only Mode (SKIP)
111
+
112
+ Fast scaffolding without feature integration:
113
+
114
+ 1. Confirm project directory
115
+ 2. Provide API key and auth token
116
+ 3. Type **SKIP** at feature selection
117
+ 4. Velt CLI runs, creates scaffold files
118
+ 5. Basic QA validation
119
+ 6. TODO checklist for manual setup
120
+
121
+ **When to use SKIP:**
122
+ - You're experienced with Velt
123
+ - You want to wire features yourself
124
+ - You just need the base files
125
+
126
+ ## How SKIP Works
127
+
128
+ At the feature selection prompt (Step 4), the AI will show:
129
+
130
+ ```
131
+ Select features to install OR type SKIP for CLI-only:
132
+
133
+ Comments (specify type: freestyle/popover/page/text/inline/tiptap/lexical/slate)
134
+ Presence
135
+ Cursors
136
+ Notifications
137
+ Recorder
138
+ CRDT (specify editor: tiptap/codemirror/blocknote)
139
+
140
+ SKIP = CLI scaffolding only, no feature integration
141
+ ```
142
+
143
+ If you type `SKIP` (case-insensitive):
144
+ - Runs Velt CLI scaffolding (creates base files)
145
+ - Runs basic QA validation
146
+ - Returns TODO checklist for manual setup
147
+ - Does NOT generate an implementation plan
148
+ - Does NOT modify project files beyond CLI scaffolding
149
+
150
+ ## Plan/Apply Workflow (Guided Mode)
151
+
152
+ The guided mode uses a multi-step workflow with **discovery consent** and **verification**:
153
+
154
+ ```
155
+ PHASE 1: COLLECT INFO (AI asks questions one at a time)
156
+ Step 1: Confirm project directory
157
+ Step 2: Get API key
158
+ Step 3: Get auth token
159
+ Step 4: Select features (or type SKIP)
160
+ Step 5: Choose VeltProvider location
161
+ Step 6: Choose corner position
162
+
163
+ PHASE 2: CLI + DISCOVERY CONSENT
164
+ Tool Call #1: mode="guided", stage="plan"
165
+ -> Run CLI + Scan Codebase
166
+ -> status="awaiting_discovery_consent"
167
+ AI asks: "Scan codebase for wiring info? [YES/NO]"
168
+
169
+ PHASE 3A: SCAN PATH (if YES)
170
+ Tool Call #2: discoveryConsent="yes"
171
+ -> Run Discovery Scan
172
+ -> status="awaiting_discovery_verification"
173
+ AI shows findings, asks: "Verify? [CONFIRM ALL/EDIT/UNSURE]"
174
+ Tool Call #3: discoveryVerification={status:"confirmed"}
175
+ -> Proceeds to PHASE 4
176
+
177
+ PHASE 3B: MANUAL PATH (if NO)
178
+ Tool Call #2: discoveryConsent="no"
179
+ -> status="awaiting_manual_wiring_answers"
180
+ AI asks questionnaire (document ID, user auth, JWT, init location)
181
+ Tool Call #3: manualWiring={...}
182
+ -> Proceeds to PHASE 4
183
+
184
+ PHASE 4: PLAN GENERATION
185
+ -> Generate Plan with Wiring
186
+ -> status="plan_generated"
187
+ AI presents plan, asks: "Would you like me to implement?"
188
+
189
+ PHASE 5: APPLY
190
+ Tool Call #4: mode="guided", stage="apply", approved=true
191
+ -> Full QA Validation
192
+ -> status="apply_complete"
193
+ ```
194
+
195
+ ### Tool Response Statuses
196
+
197
+ | Status | Meaning | Next Action |
198
+ |--------|---------|-------------|
199
+ | `awaiting_discovery_consent` | CLI done, need YES/NO for scanning | Ask user, call with `discoveryConsent` |
200
+ | `awaiting_discovery_verification` | Scan done, need verification | Show findings, call with `discoveryVerification` |
201
+ | `awaiting_manual_wiring_answers` | User said NO, need questionnaire | Ask questionnaire, call with `manualWiring` |
202
+ | `plan_generated` | Plan ready with verified/manual wiring | Present plan, ask approval |
203
+ | `apply_complete` | Installation complete | Show results |
204
+ | `cli_only_complete` | SKIP mode complete | Show TODO checklist |
205
+
206
+ ## Generated Code Pattern
207
+
208
+ The installer follows this architecture pattern (based on Velt sample apps):
209
+
210
+ ### File Structure
211
+
212
+ ```
213
+ app/
214
+ ├── layout.tsx # Wraps with AppUserProvider
215
+ ├── page.tsx # Contains VeltProvider with authProvider hook
216
+ └── userAuth/
217
+ ├── AppUserContext.tsx # User context provider
218
+ └── useAppUser.tsx # User data hook
219
+
220
+ components/velt/
221
+ ├── VeltInitializeUser.tsx # Exports useVeltAuthProvider hook
222
+ ├── VeltInitializeDocument.tsx # Exports useCurrentDocument hook
223
+ └── VeltCollaboration.tsx # All Velt feature components
224
+
225
+ app/api/velt/token/
226
+ └── route.ts # JWT token generation API
227
+ ```
228
+
229
+ ### layout.tsx Pattern
230
+
231
+ ```tsx
232
+ import { AppUserProvider } from './userAuth/AppUserContext'
233
+
234
+ export default function RootLayout({ children }) {
235
+ return (
236
+ <html><body>
237
+ <AppUserProvider>{children}</AppUserProvider>
238
+ </body></html>
239
+ )
240
+ }
241
+ ```
242
+
243
+ ### page.tsx Pattern
244
+
245
+ ```tsx
246
+ "use client";
247
+ import { VeltProvider } from '@veltdev/react';
248
+ import { useVeltAuthProvider } from '@/components/velt/VeltInitializeUser';
249
+ import { useCurrentDocument } from '@/components/velt/VeltInitializeDocument';
250
+ import { VeltCollaboration } from '@/components/velt/VeltCollaboration';
251
+
252
+ export default function Page() {
253
+ const { authProvider } = useVeltAuthProvider();
254
+ const { documentId } = useCurrentDocument();
255
+
256
+ return (
257
+ <VeltProvider apiKey={VELT_API_KEY} authProvider={authProvider}>
258
+ <VeltCollaboration documentId={documentId} />
259
+ {/* Your page content */}
260
+ </VeltProvider>
261
+ );
262
+ }
263
+ ```
264
+
265
+ ### Corner Positioning
266
+
267
+ All Velt feature components (presence, notifications, comments sidebar) are grouped in the user's chosen corner:
268
+
269
+ ```tsx
270
+ // VeltCollaboration.tsx
271
+ <div className="fixed top-4 right-4 z-50 flex flex-col gap-2">
272
+ <VeltPresence />
273
+ <VeltNotificationsTool />
274
+ <VeltCommentsSidebar />
275
+ </div>
276
+ <VeltCursor />
277
+ ```
278
+
279
+ ## Source Priority: Agent Skills First
280
+
281
+ The MCP uses a three-tier source priority system for implementation guidance:
282
+
283
+ ### Prerequisite
284
+
285
+ Install Velt Agent Skills into your AI editor:
286
+
287
+ ```bash
288
+ npx skills add velt-js/agent-skills
289
+ ```
290
+
291
+ This installs four skills:
292
+ - `velt-setup-best-practices` — VeltProvider setup, authentication, document identity, project structure
293
+ - `velt-comments-best-practices` — All comment types (freestyle, popover, page, text, tiptap, lexical, slate)
294
+ - `velt-crdt-best-practices` — Tiptap, BlockNote, CodeMirror, ReactFlow CRDT patterns
295
+ - `velt-notifications-best-practices` — Notification setup, customization, delivery
296
+
297
+ ### Source Priority Order
298
+
299
+ | Priority | Source | When to Use |
300
+ |----------|--------|-------------|
301
+ | 1 (Primary) | **Agent Skills** | Always use first for features with skills coverage |
302
+ | 2 (Secondary) | **Docs URLs** (docs.velt.dev) | Only for features WITHOUT skills: presence, cursors, recorder |
303
+ | 3 (Tertiary) | **Velt Docs MCP** | Only for user follow-up questions AFTER implementation |
304
+
305
+ ## Host App Wiring Discovery
306
+
307
+ The guided mode includes automatic discovery of integration points in your codebase:
308
+
309
+ ### What It Scans For
310
+
311
+ 1. **Document ID Source**: Dynamic route params, query params, database fetches, state variables
312
+ 2. **User Authentication**: Next-Auth, Clerk, Auth0, Firebase Auth, Supabase Auth, custom auth
313
+ 3. **Setup Location**: Root layout, specific pages, custom providers
314
+ 4. **JWT Authentication**: Token generation endpoints, bearer auth patterns
315
+
316
+ If it can't determine something with confidence, it emits explicit questions rather than guessing.
317
+
318
+ ## Framework Support
319
+
320
+ | Framework | Support Level | "use client" Directives |
321
+ |-----------|--------------|------------------------|
322
+ | **Next.js (App Router)** | Full | Auto-applied |
323
+ | **Next.js (Pages Router)** | Full | N/A |
324
+ | **Vite + React** | Full | Not needed |
325
+ | **Create React App** | Full | Not needed |
326
+ | **Plain React** | Full | Not needed |
327
+
328
+ ## Available Tools
329
+
330
+ | Tool | Description |
331
+ |------|-------------|
332
+ | `install_velt_interactive` | Unified installer with guided or CLI-only mode |
333
+ | `install_velt_freestyle` | Legacy installer for basic freestyle comments |
334
+ | `take_project_screenshot` | Capture screenshot of running app |
335
+ | `detect_comment_placement` | Analyze project structure for comment placement |
336
+
337
+ ## Features
338
+
339
+ - Guided mode with plan generation and user approval
340
+ - CLI-only mode (SKIP) for quick scaffolding
341
+ - Comments (8 types: freestyle, popover, page, text, inline, tiptap, lexical, slate)
342
+ - Presence (live user avatars)
343
+ - Cursors (real-time cursor tracking)
344
+ - Notifications
345
+ - Recorder
346
+ - CRDT (collaborative editing: Tiptap, CodeMirror, BlockNote)
347
+ - Basic and full integration validation
348
+ - Automatic framework detection
349
+ - "use client" directive handling for Next.js
350
+
351
+ ## Development
352
+
353
+ ```bash
354
+ # Clone the repo
355
+ git clone https://github.com/velt-js/mcp-installer.git
356
+ cd mcp-installer
357
+
358
+ # Install dependencies
359
+ npm install
360
+
361
+ # Start the server (stdio)
362
+ npm start
363
+
364
+ # Watch mode
365
+ npm run dev
366
+
367
+ # Test JSON-RPC
368
+ echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | node bin/mcp-server.js
369
+ ```
370
+
371
+ ## License
372
+
373
+ MIT
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Velt MCP Installer Server Entry Point
5
+ *
6
+ * This MCP server provides tools for installing Velt with freestyle comments
7
+ * in Next.js projects using an orchestrator pattern.
8
+ */
9
+
10
+ import { fileURLToPath } from 'url';
11
+ import { dirname, join } from 'path';
12
+ import { createServer } from '../src/index.js';
13
+
14
+ const __filename = fileURLToPath(import.meta.url);
15
+ const __dirname = dirname(__filename);
16
+
17
+ // Start the MCP server
18
+ createServer().catch((error) => {
19
+ console.error('Failed to start MCP server:', error);
20
+ process.exit(1);
21
+ });
22
+
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@velt-js/mcp-installer",
3
+ "version": "0.1.0",
4
+ "description": "MCP server for AI-assisted installation of Velt collaboration features into React and Next.js projects",
5
+ "type": "module",
6
+ "main": "src/index.js",
7
+ "bin": {
8
+ "velt-mcp-server": "./bin/mcp-server.js"
9
+ },
10
+ "files": [
11
+ "bin/",
12
+ "src/",
13
+ "!src/utils/local-cli.js",
14
+ "README.md"
15
+ ],
16
+ "publishConfig": {
17
+ "access": "public",
18
+ "registry": "https://registry.npmjs.org/"
19
+ },
20
+ "scripts": {
21
+ "start": "node bin/mcp-server.js",
22
+ "dev": "node --watch bin/mcp-server.js"
23
+ },
24
+ "keywords": [
25
+ "velt",
26
+ "mcp",
27
+ "installer",
28
+ "nextjs",
29
+ "react",
30
+ "collaboration",
31
+ "model-context-protocol"
32
+ ],
33
+ "author": "Velt",
34
+ "license": "MIT",
35
+ "dependencies": {
36
+ "@modelcontextprotocol/sdk": "^0.5.0",
37
+ "playwright": "^1.48.0"
38
+ },
39
+ "engines": {
40
+ "node": ">=18.0.0"
41
+ }
42
+ }