@nordsym/apiclaw 1.3.7 → 1.3.8
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 +420 -200
- package/convex/_generated/api.d.ts +4 -0
- package/convex/agents.ts +403 -0
- package/convex/directCall.ts +80 -0
- package/convex/earnProgress.ts +753 -0
- package/convex/logs.ts +17 -0
- package/convex/providerKeys.ts +82 -2
- package/convex/schema.ts +71 -2
- package/convex/workspaces.ts +84 -2
- package/dist/adapters/base.d.ts +112 -0
- package/dist/adapters/base.d.ts.map +1 -0
- package/dist/adapters/base.js +247 -0
- package/dist/adapters/base.js.map +1 -0
- package/dist/adapters/claude-desktop.d.ts +12 -0
- package/dist/adapters/claude-desktop.d.ts.map +1 -0
- package/dist/adapters/claude-desktop.js +36 -0
- package/dist/adapters/claude-desktop.js.map +1 -0
- package/dist/adapters/cline.d.ts +20 -0
- package/dist/adapters/cline.d.ts.map +1 -0
- package/dist/adapters/cline.js +77 -0
- package/dist/adapters/cline.js.map +1 -0
- package/dist/adapters/continue.d.ts +26 -0
- package/dist/adapters/continue.d.ts.map +1 -0
- package/dist/adapters/continue.js +68 -0
- package/dist/adapters/continue.js.map +1 -0
- package/dist/adapters/cursor.d.ts +12 -0
- package/dist/adapters/cursor.d.ts.map +1 -0
- package/dist/adapters/cursor.js +38 -0
- package/dist/adapters/cursor.js.map +1 -0
- package/dist/adapters/custom.d.ts +47 -0
- package/dist/adapters/custom.d.ts.map +1 -0
- package/dist/adapters/custom.js +146 -0
- package/dist/adapters/custom.js.map +1 -0
- package/dist/adapters/detect.d.ts +69 -0
- package/dist/adapters/detect.d.ts.map +1 -0
- package/dist/adapters/detect.js +158 -0
- package/dist/adapters/detect.js.map +1 -0
- package/dist/adapters/index.d.ts +21 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +23 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/windsurf.d.ts +12 -0
- package/dist/adapters/windsurf.d.ts.map +1 -0
- package/dist/adapters/windsurf.js +39 -0
- package/dist/adapters/windsurf.js.map +1 -0
- package/dist/bin.d.ts +9 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +19 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +34 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +312 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/index.d.ts +9 -0
- package/dist/cli/commands/index.d.ts.map +1 -0
- package/dist/cli/commands/index.js +9 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/restore.d.ts +50 -0
- package/dist/cli/commands/restore.d.ts.map +1 -0
- package/dist/cli/commands/restore.js +260 -0
- package/dist/cli/commands/restore.js.map +1 -0
- package/dist/cli/commands/setup.d.ts +19 -0
- package/dist/cli/commands/setup.d.ts.map +1 -0
- package/dist/cli/commands/setup.js +206 -0
- package/dist/cli/commands/setup.js.map +1 -0
- package/dist/cli/commands/uninstall.d.ts +37 -0
- package/dist/cli/commands/uninstall.d.ts.map +1 -0
- package/dist/cli/commands/uninstall.js +189 -0
- package/dist/cli/commands/uninstall.js.map +1 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +97 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/discovery.d.ts +6 -2
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +296 -2
- package/dist/discovery.js.map +1 -1
- package/dist/enterprise/env.d.ts +56 -0
- package/dist/enterprise/env.d.ts.map +1 -0
- package/dist/enterprise/env.js +124 -0
- package/dist/enterprise/env.js.map +1 -0
- package/dist/enterprise/index.d.ts +7 -0
- package/dist/enterprise/index.d.ts.map +1 -0
- package/dist/enterprise/index.js +7 -0
- package/dist/enterprise/index.js.map +1 -0
- package/dist/enterprise/script-generator.d.ts +32 -0
- package/dist/enterprise/script-generator.d.ts.map +1 -0
- package/dist/enterprise/script-generator.js +461 -0
- package/dist/enterprise/script-generator.js.map +1 -0
- package/dist/execute.d.ts +21 -0
- package/dist/execute.d.ts.map +1 -1
- package/dist/execute.js +231 -0
- package/dist/execute.js.map +1 -1
- package/dist/index.js +79 -7
- package/dist/index.js.map +1 -1
- package/dist/stripe.d.ts +1 -1
- package/dist/stripe.js +1 -1
- package/dist/stripe.js.map +1 -1
- package/dist/types.d.ts +29 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/colors.d.ts +111 -0
- package/dist/ui/colors.d.ts.map +1 -0
- package/dist/ui/colors.js +185 -0
- package/dist/ui/colors.js.map +1 -0
- package/dist/ui/errors.d.ts +69 -0
- package/dist/ui/errors.d.ts.map +1 -0
- package/dist/ui/errors.js +334 -0
- package/dist/ui/errors.js.map +1 -0
- package/dist/ui/index.d.ts +10 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +14 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/prompts.d.ts +88 -0
- package/dist/ui/prompts.d.ts.map +1 -0
- package/dist/ui/prompts.js +295 -0
- package/dist/ui/prompts.js.map +1 -0
- package/dist/ui/spinner.d.ts +112 -0
- package/dist/ui/spinner.d.ts.map +1 -0
- package/dist/ui/spinner.js +229 -0
- package/dist/ui/spinner.js.map +1 -0
- package/dist/utils/backup.d.ts +48 -0
- package/dist/utils/backup.d.ts.map +1 -0
- package/dist/utils/backup.js +182 -0
- package/dist/utils/backup.js.map +1 -0
- package/dist/utils/config.d.ts +80 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +221 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/os.d.ts +45 -0
- package/dist/utils/os.d.ts.map +1 -0
- package/dist/utils/os.js +106 -0
- package/dist/utils/os.js.map +1 -0
- package/dist/utils/paths.d.ts +38 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +160 -0
- package/dist/utils/paths.js.map +1 -0
- package/docs/PRD-BILLING.md +226 -0
- package/docs/PRD-EARN-SYSTEM.md +261 -0
- package/docs/PRD-MCP-AUTO-SETUP.md +623 -0
- package/docs/enterprise-deployment.md +728 -0
- package/landing/next.config.mjs +14 -0
- package/landing/public/stats.json +4 -2
- package/landing/scripts/generate-stats.js +12 -0
- package/landing/src/app/api/workspace-auth/magic-link/route.ts +6 -3
- package/landing/src/app/auth/verify/page.tsx +11 -4
- package/landing/src/app/docs/page.tsx +1 -1
- package/landing/src/app/join/page.tsx +49 -0
- package/landing/src/app/login/page.tsx +7 -1
- package/landing/src/app/page.tsx +13 -28
- package/landing/src/app/providers/register/page.tsx +1 -1
- package/landing/src/app/workspace/page.tsx +483 -710
- package/landing/src/components/CheckoutButton.tsx +1 -1
- package/landing/src/components/EarnCreditsTab.tsx +842 -0
- package/landing/src/lib/stats.json +3 -1
- package/package.json +9 -2
- package/src/adapters/base.ts +363 -0
- package/src/adapters/claude-desktop.ts +41 -0
- package/src/adapters/cline.ts +88 -0
- package/src/adapters/continue.ts +91 -0
- package/src/adapters/cursor.ts +43 -0
- package/src/adapters/custom.ts +188 -0
- package/src/adapters/detect.ts +202 -0
- package/src/adapters/index.ts +47 -0
- package/src/adapters/windsurf.ts +44 -0
- package/src/bin.ts +19 -0
- package/src/cli/commands/doctor.ts +367 -0
- package/src/cli/commands/index.ts +9 -0
- package/src/cli/commands/restore.ts +333 -0
- package/src/cli/commands/setup.ts +276 -0
- package/src/cli/commands/uninstall.ts +240 -0
- package/src/cli/index.ts +107 -0
- package/src/discovery.ts +328 -3
- package/src/enterprise/env.ts +156 -0
- package/src/enterprise/index.ts +7 -0
- package/src/enterprise/script-generator.ts +481 -0
- package/src/execute.ts +256 -0
- package/src/index.ts +85 -7
- package/src/stripe.ts +1 -1
- package/src/types.ts +32 -0
- package/src/ui/colors.ts +219 -0
- package/src/ui/errors.ts +394 -0
- package/src/ui/index.ts +17 -0
- package/src/ui/prompts.ts +390 -0
- package/src/ui/spinner.ts +325 -0
- package/src/utils/backup.ts +224 -0
- package/src/utils/config.ts +315 -0
- package/src/utils/os.ts +124 -0
- package/src/utils/paths.ts +203 -0
- package/landing/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
# PRD: APIClaw MCP Auto-Setup
|
|
2
|
+
|
|
3
|
+
**Version:** 1.0
|
|
4
|
+
**Date:** 2026-02-28
|
|
5
|
+
**Status:** Draft
|
|
6
|
+
**Owner:** NordSym
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Executive Summary
|
|
11
|
+
|
|
12
|
+
Enterprise-grade, platform-agnostic CLI tool that automatically configures APIClaw as an MCP server across all major AI coding assistants. Zero-friction onboarding for developers and fleet deployment for enterprises.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Problem Statement
|
|
17
|
+
|
|
18
|
+
### Current Pain
|
|
19
|
+
1. Manual JSON editing required to add MCP servers
|
|
20
|
+
2. Different config locations per client/OS
|
|
21
|
+
3. Easy to make syntax errors
|
|
22
|
+
4. No verification that setup worked
|
|
23
|
+
5. Enterprise: No way to deploy to entire dev team
|
|
24
|
+
|
|
25
|
+
### User Quotes
|
|
26
|
+
- "I just want it to work"
|
|
27
|
+
- "Why do I need to edit JSON in 2026?"
|
|
28
|
+
- "How do I roll this out to 50 developers?"
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Goals
|
|
33
|
+
|
|
34
|
+
| Goal | Metric |
|
|
35
|
+
|------|--------|
|
|
36
|
+
| Zero-config onboarding | <10 seconds from install to working |
|
|
37
|
+
| Universal compatibility | Support 100% of major MCP clients |
|
|
38
|
+
| Enterprise-ready | Fleet deployment in 1 command |
|
|
39
|
+
| Fail-safe | Never corrupt existing config |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Supported Platforms
|
|
44
|
+
|
|
45
|
+
### MCP Clients
|
|
46
|
+
|
|
47
|
+
| Client | Config Location (macOS) | Config Location (Windows) | Config Location (Linux) |
|
|
48
|
+
|--------|------------------------|---------------------------|------------------------|
|
|
49
|
+
| **Claude Desktop** | `~/Library/Application Support/Claude/claude_desktop_config.json` | `%APPDATA%\Claude\claude_desktop_config.json` | `~/.config/Claude/claude_desktop_config.json` |
|
|
50
|
+
| **Cursor** | `~/Library/Application Support/Cursor/User/globalStorage/cursor.mcp/config.json` | `%APPDATA%\Cursor\User\globalStorage\cursor.mcp\config.json` | `~/.config/Cursor/User/globalStorage/cursor.mcp/config.json` |
|
|
51
|
+
| **Windsurf** | `~/.codeium/windsurf/mcp_config.json` | `%USERPROFILE%\.codeium\windsurf\mcp_config.json` | `~/.codeium/windsurf/mcp_config.json` |
|
|
52
|
+
| **Cline (VS Code)** | `~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json` | `%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json` | `~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json` |
|
|
53
|
+
| **Continue** | `~/.continue/config.json` | `%USERPROFILE%\.continue\config.json` | `~/.continue/config.json` |
|
|
54
|
+
| **Custom** | User-specified path | User-specified path | User-specified path |
|
|
55
|
+
|
|
56
|
+
### Operating Systems
|
|
57
|
+
- macOS (Intel + Apple Silicon)
|
|
58
|
+
- Windows 10/11
|
|
59
|
+
- Linux (Ubuntu, Debian, Fedora, Arch)
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## CLI Commands
|
|
64
|
+
|
|
65
|
+
### Basic Setup
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Auto-detect and configure all found MCP clients
|
|
69
|
+
npx @nordsym/apiclaw setup
|
|
70
|
+
|
|
71
|
+
# Setup specific client only
|
|
72
|
+
npx @nordsym/apiclaw setup --client claude-desktop
|
|
73
|
+
npx @nordsym/apiclaw setup --client cursor
|
|
74
|
+
npx @nordsym/apiclaw setup --client windsurf
|
|
75
|
+
npx @nordsym/apiclaw setup --client cline
|
|
76
|
+
npx @nordsym/apiclaw setup --client continue
|
|
77
|
+
|
|
78
|
+
# Setup with custom config path
|
|
79
|
+
npx @nordsym/apiclaw setup --config /path/to/config.json
|
|
80
|
+
|
|
81
|
+
# Setup with workspace pre-linked
|
|
82
|
+
npx @nordsym/apiclaw setup --workspace ws_abc123
|
|
83
|
+
|
|
84
|
+
# Dry run (show what would happen)
|
|
85
|
+
npx @nordsym/apiclaw setup --dry-run
|
|
86
|
+
|
|
87
|
+
# Force overwrite existing APIClaw config
|
|
88
|
+
npx @nordsym/apiclaw setup --force
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Enterprise Commands
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Generate setup script for team deployment
|
|
95
|
+
npx @nordsym/apiclaw setup --enterprise --output setup-script.sh
|
|
96
|
+
|
|
97
|
+
# Generate config snippet (for manual distribution)
|
|
98
|
+
npx @nordsym/apiclaw setup --export-config
|
|
99
|
+
|
|
100
|
+
# Verify installation across clients
|
|
101
|
+
npx @nordsym/apiclaw doctor
|
|
102
|
+
|
|
103
|
+
# Remove APIClaw from all clients
|
|
104
|
+
npx @nordsym/apiclaw uninstall
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Setup Flow
|
|
110
|
+
|
|
111
|
+
### Standard Flow
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
115
|
+
│ $ npx @nordsym/apiclaw setup │
|
|
116
|
+
└─────────────────────────────────────────────────────────────┘
|
|
117
|
+
│
|
|
118
|
+
▼
|
|
119
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
120
|
+
│ 🔍 Detecting MCP clients... │
|
|
121
|
+
│ ✓ Claude Desktop found │
|
|
122
|
+
│ ✓ Cursor found │
|
|
123
|
+
│ ✗ Windsurf not found │
|
|
124
|
+
│ ✗ Cline not found │
|
|
125
|
+
└─────────────────────────────────────────────────────────────┘
|
|
126
|
+
│
|
|
127
|
+
▼
|
|
128
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
129
|
+
│ 📝 Configuring Claude Desktop... │
|
|
130
|
+
│ • Backing up existing config │
|
|
131
|
+
│ • Adding APIClaw to mcpServers │
|
|
132
|
+
│ ✓ Done │
|
|
133
|
+
│ │
|
|
134
|
+
│ 📝 Configuring Cursor... │
|
|
135
|
+
│ • Creating config directory │
|
|
136
|
+
│ • Adding APIClaw to mcpServers │
|
|
137
|
+
│ ✓ Done │
|
|
138
|
+
└─────────────────────────────────────────────────────────────┘
|
|
139
|
+
│
|
|
140
|
+
▼
|
|
141
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
142
|
+
│ ✅ APIClaw configured successfully! │
|
|
143
|
+
│ │
|
|
144
|
+
│ Next steps: │
|
|
145
|
+
│ 1. Restart Claude Desktop / Cursor │
|
|
146
|
+
│ 2. Ask your agent: "List available APIs" │
|
|
147
|
+
│ │
|
|
148
|
+
│ Need help? https://docs.apiclaw.com/setup │
|
|
149
|
+
└─────────────────────────────────────────────────────────────┘
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Interactive Flow (--wizard)
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
156
|
+
│ $ npx @nordsym/apiclaw setup --wizard │
|
|
157
|
+
└─────────────────────────────────────────────────────────────┘
|
|
158
|
+
│
|
|
159
|
+
▼
|
|
160
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
161
|
+
│ Which MCP clients do you want to configure? │
|
|
162
|
+
│ │
|
|
163
|
+
│ ◉ Claude Desktop (detected) │
|
|
164
|
+
│ ◉ Cursor (detected) │
|
|
165
|
+
│ ○ Windsurf (not detected) │
|
|
166
|
+
│ ○ Custom path... │
|
|
167
|
+
│ │
|
|
168
|
+
│ [Continue] │
|
|
169
|
+
└─────────────────────────────────────────────────────────────┘
|
|
170
|
+
│
|
|
171
|
+
▼
|
|
172
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
173
|
+
│ Review changes: │
|
|
174
|
+
│ │
|
|
175
|
+
│ Claude Desktop: │
|
|
176
|
+
│ + "apiclaw": { │
|
|
177
|
+
│ + "command": "npx", │
|
|
178
|
+
│ + "args": ["@nordsym/apiclaw"] │
|
|
179
|
+
│ + } │
|
|
180
|
+
│ │
|
|
181
|
+
│ [Apply] [Cancel] │
|
|
182
|
+
└─────────────────────────────────────────────────────────────┘
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Config Injection
|
|
188
|
+
|
|
189
|
+
### MCP Config Structure
|
|
190
|
+
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"mcpServers": {
|
|
194
|
+
"apiclaw": {
|
|
195
|
+
"command": "npx",
|
|
196
|
+
"args": ["@nordsym/apiclaw"],
|
|
197
|
+
"env": {
|
|
198
|
+
"APICLAW_WORKSPACE": "ws_abc123"
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Merge Strategy
|
|
206
|
+
|
|
207
|
+
1. **Read** existing config (or create empty object)
|
|
208
|
+
2. **Backup** to `config.backup.json`
|
|
209
|
+
3. **Deep merge** APIClaw into `mcpServers`
|
|
210
|
+
4. **Preserve** all other config keys
|
|
211
|
+
5. **Write** with pretty formatting
|
|
212
|
+
6. **Verify** JSON is valid before write
|
|
213
|
+
|
|
214
|
+
### Conflict Handling
|
|
215
|
+
|
|
216
|
+
| Scenario | Action |
|
|
217
|
+
|----------|--------|
|
|
218
|
+
| No existing config | Create new file |
|
|
219
|
+
| Config exists, no APIClaw | Add APIClaw |
|
|
220
|
+
| Config exists, APIClaw exists | Skip (or update with `--force`) |
|
|
221
|
+
| Config is malformed JSON | Abort with error, suggest manual fix |
|
|
222
|
+
| No write permission | Abort with error, show required permissions |
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Safety Features
|
|
227
|
+
|
|
228
|
+
### Backup System
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
Before: claude_desktop_config.json
|
|
232
|
+
After: claude_desktop_config.json (updated)
|
|
233
|
+
claude_desktop_config.backup.1709150400.json
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
- Timestamped backups
|
|
237
|
+
- Keep last 5 backups
|
|
238
|
+
- Restore command: `npx @nordsym/apiclaw restore`
|
|
239
|
+
|
|
240
|
+
### Validation
|
|
241
|
+
|
|
242
|
+
1. **Pre-write validation:**
|
|
243
|
+
- Parse resulting JSON
|
|
244
|
+
- Check required fields present
|
|
245
|
+
- Validate paths exist
|
|
246
|
+
|
|
247
|
+
2. **Post-write validation:**
|
|
248
|
+
- Re-read file
|
|
249
|
+
- Confirm APIClaw entry exists
|
|
250
|
+
- Check file permissions correct
|
|
251
|
+
|
|
252
|
+
### Rollback
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
# Restore from latest backup
|
|
256
|
+
npx @nordsym/apiclaw restore
|
|
257
|
+
|
|
258
|
+
# Restore specific backup
|
|
259
|
+
npx @nordsym/apiclaw restore --backup claude_desktop_config.backup.1709150400.json
|
|
260
|
+
|
|
261
|
+
# List available backups
|
|
262
|
+
npx @nordsym/apiclaw restore --list
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Enterprise Features
|
|
268
|
+
|
|
269
|
+
### Fleet Deployment Script
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
# Generate cross-platform setup script
|
|
273
|
+
npx @nordsym/apiclaw setup --enterprise --output deploy.sh
|
|
274
|
+
|
|
275
|
+
# Generated script includes:
|
|
276
|
+
# - OS detection
|
|
277
|
+
# - Client detection
|
|
278
|
+
# - Config injection
|
|
279
|
+
# - Verification
|
|
280
|
+
# - Error reporting to central endpoint
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Environment Variables
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# Pre-configure workspace for all users
|
|
287
|
+
export APICLAW_WORKSPACE="ws_enterprise_123"
|
|
288
|
+
export APICLAW_API_URL="https://api.company.com/apiclaw" # Self-hosted
|
|
289
|
+
export APICLAW_DISABLE_TELEMETRY="true"
|
|
290
|
+
|
|
291
|
+
npx @nordsym/apiclaw setup
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### MDM Integration (macOS)
|
|
295
|
+
|
|
296
|
+
```xml
|
|
297
|
+
<!-- Deploy via Jamf/Kandji/Mosyle -->
|
|
298
|
+
<plist>
|
|
299
|
+
<dict>
|
|
300
|
+
<key>mcpServers</key>
|
|
301
|
+
<dict>
|
|
302
|
+
<key>apiclaw</key>
|
|
303
|
+
<dict>
|
|
304
|
+
<key>command</key>
|
|
305
|
+
<string>npx</string>
|
|
306
|
+
<key>args</key>
|
|
307
|
+
<array>
|
|
308
|
+
<string>@nordsym/apiclaw</string>
|
|
309
|
+
</array>
|
|
310
|
+
</dict>
|
|
311
|
+
</dict>
|
|
312
|
+
</dict>
|
|
313
|
+
</plist>
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Group Policy (Windows)
|
|
317
|
+
|
|
318
|
+
```powershell
|
|
319
|
+
# Deploy via Group Policy / Intune
|
|
320
|
+
$config = @{
|
|
321
|
+
mcpServers = @{
|
|
322
|
+
apiclaw = @{
|
|
323
|
+
command = "npx"
|
|
324
|
+
args = @("@nordsym/apiclaw")
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
$config | ConvertTo-Json -Depth 10 | Set-Content "$env:APPDATA\Claude\claude_desktop_config.json"
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## Doctor Command
|
|
334
|
+
|
|
335
|
+
Diagnose issues with APIClaw setup:
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
$ npx @nordsym/apiclaw doctor
|
|
339
|
+
|
|
340
|
+
🔍 APIClaw Health Check
|
|
341
|
+
========================
|
|
342
|
+
|
|
343
|
+
System:
|
|
344
|
+
✓ Node.js v20.11.0
|
|
345
|
+
✓ npm 10.2.4
|
|
346
|
+
✓ npx available
|
|
347
|
+
|
|
348
|
+
MCP Clients:
|
|
349
|
+
✓ Claude Desktop
|
|
350
|
+
• Config: ~/.../claude_desktop_config.json
|
|
351
|
+
• APIClaw: Configured ✓
|
|
352
|
+
• Version: Latest
|
|
353
|
+
|
|
354
|
+
✓ Cursor
|
|
355
|
+
• Config: ~/.../config.json
|
|
356
|
+
• APIClaw: Configured ✓
|
|
357
|
+
• Version: Latest
|
|
358
|
+
|
|
359
|
+
✗ Windsurf
|
|
360
|
+
• Not installed
|
|
361
|
+
|
|
362
|
+
Connectivity:
|
|
363
|
+
✓ api.apiclaw.com reachable
|
|
364
|
+
✓ Workspace authenticated
|
|
365
|
+
|
|
366
|
+
Recent Issues:
|
|
367
|
+
None detected
|
|
368
|
+
|
|
369
|
+
Status: All systems operational ✓
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## Error Handling
|
|
375
|
+
|
|
376
|
+
### Common Errors
|
|
377
|
+
|
|
378
|
+
| Error | Cause | Resolution |
|
|
379
|
+
|-------|-------|------------|
|
|
380
|
+
| `ENOENT: config not found` | Client not installed | Install client or use `--config` |
|
|
381
|
+
| `EACCES: permission denied` | No write access | Run with sudo or fix permissions |
|
|
382
|
+
| `SyntaxError: JSON parse` | Corrupted config | Restore from backup |
|
|
383
|
+
| `APICLAW_EXISTS` | Already configured | Use `--force` to update |
|
|
384
|
+
| `NETWORK_ERROR` | Offline | Setup works offline, verify later |
|
|
385
|
+
|
|
386
|
+
### Error Output
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
$ npx @nordsym/apiclaw setup
|
|
390
|
+
|
|
391
|
+
❌ Error: Permission denied writing to claude_desktop_config.json
|
|
392
|
+
|
|
393
|
+
This usually means:
|
|
394
|
+
1. The config file is owned by another user
|
|
395
|
+
2. You need elevated permissions
|
|
396
|
+
|
|
397
|
+
Try:
|
|
398
|
+
sudo npx @nordsym/apiclaw setup
|
|
399
|
+
|
|
400
|
+
Or fix permissions:
|
|
401
|
+
chmod 644 ~/Library/Application\ Support/Claude/claude_desktop_config.json
|
|
402
|
+
|
|
403
|
+
Need help? https://docs.apiclaw.com/setup/permissions
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
## Implementation Plan
|
|
409
|
+
|
|
410
|
+
### Agent Deployment
|
|
411
|
+
|
|
412
|
+
**Total: 4 agents** (can run in parallel)
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
#### Agent 1: CLI Core
|
|
417
|
+
**Label:** `apiclaw-setup-cli`
|
|
418
|
+
|
|
419
|
+
**Scope:**
|
|
420
|
+
- CLI scaffold with Commander.js
|
|
421
|
+
- OS detection utility
|
|
422
|
+
- Config path resolver for all clients
|
|
423
|
+
- Backup system (timestamped, keep 5)
|
|
424
|
+
- JSON merge logic (preserve existing config)
|
|
425
|
+
|
|
426
|
+
**Output:**
|
|
427
|
+
- `src/cli/index.ts` - Entry point
|
|
428
|
+
- `src/cli/commands/setup.ts` - Setup command
|
|
429
|
+
- `src/utils/os.ts` - OS detection
|
|
430
|
+
- `src/utils/paths.ts` - Config path resolver
|
|
431
|
+
- `src/utils/backup.ts` - Backup system
|
|
432
|
+
- `src/utils/config.ts` - JSON merge logic
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
#### Agent 2: Client Adapters
|
|
437
|
+
**Label:** `apiclaw-setup-adapters`
|
|
438
|
+
|
|
439
|
+
**Scope:**
|
|
440
|
+
- Adapter interface
|
|
441
|
+
- Claude Desktop adapter (all OS)
|
|
442
|
+
- Cursor adapter (all OS)
|
|
443
|
+
- Windsurf adapter (all OS)
|
|
444
|
+
- Cline adapter (all OS)
|
|
445
|
+
- Continue adapter (all OS)
|
|
446
|
+
- Custom path adapter
|
|
447
|
+
- Auto-detection logic
|
|
448
|
+
|
|
449
|
+
**Output:**
|
|
450
|
+
- `src/adapters/base.ts` - Adapter interface
|
|
451
|
+
- `src/adapters/claude-desktop.ts`
|
|
452
|
+
- `src/adapters/cursor.ts`
|
|
453
|
+
- `src/adapters/windsurf.ts`
|
|
454
|
+
- `src/adapters/cline.ts`
|
|
455
|
+
- `src/adapters/continue.ts`
|
|
456
|
+
- `src/adapters/custom.ts`
|
|
457
|
+
- `src/adapters/detect.ts` - Auto-detect all
|
|
458
|
+
|
|
459
|
+
---
|
|
460
|
+
|
|
461
|
+
#### Agent 3: Enterprise & Doctor
|
|
462
|
+
**Label:** `apiclaw-setup-enterprise`
|
|
463
|
+
|
|
464
|
+
**Scope:**
|
|
465
|
+
- `--enterprise` script generator (bash + powershell)
|
|
466
|
+
- Environment variable handling
|
|
467
|
+
- `doctor` command (health check)
|
|
468
|
+
- `restore` command (rollback)
|
|
469
|
+
- `uninstall` command
|
|
470
|
+
|
|
471
|
+
**Output:**
|
|
472
|
+
- `src/cli/commands/doctor.ts`
|
|
473
|
+
- `src/cli/commands/restore.ts`
|
|
474
|
+
- `src/cli/commands/uninstall.ts`
|
|
475
|
+
- `src/enterprise/script-generator.ts`
|
|
476
|
+
- `src/enterprise/env.ts`
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
#### Agent 4: UX & Docs
|
|
481
|
+
**Label:** `apiclaw-setup-ux`
|
|
482
|
+
|
|
483
|
+
**Scope:**
|
|
484
|
+
- Colored output with ora spinners
|
|
485
|
+
- `--wizard` interactive mode
|
|
486
|
+
- `--dry-run` implementation
|
|
487
|
+
- Error messages with help links
|
|
488
|
+
- README.md
|
|
489
|
+
- MDM/Group Policy documentation
|
|
490
|
+
|
|
491
|
+
**Output:**
|
|
492
|
+
- `src/ui/spinner.ts`
|
|
493
|
+
- `src/ui/prompts.ts`
|
|
494
|
+
- `src/cli/commands/wizard.ts`
|
|
495
|
+
- `README.md`
|
|
496
|
+
- `docs/enterprise-deployment.md`
|
|
497
|
+
|
|
498
|
+
---
|
|
499
|
+
|
|
500
|
+
### Execution Order
|
|
501
|
+
|
|
502
|
+
```
|
|
503
|
+
┌─────────────────────────────────────────────────────────┐
|
|
504
|
+
│ SPAWN PARALLEL │
|
|
505
|
+
├─────────────────────────────────────────────────────────┤
|
|
506
|
+
│ │
|
|
507
|
+
│ Agent 1 Agent 2 Agent 3 Agent 4 │
|
|
508
|
+
│ CLI Core → Adapters → Enterprise UX │
|
|
509
|
+
│ │
|
|
510
|
+
│ [Foundation] [Depends on 1] [Depends on 1] [Any] │
|
|
511
|
+
│ │
|
|
512
|
+
└─────────────────────────────────────────────────────────┘
|
|
513
|
+
│
|
|
514
|
+
▼
|
|
515
|
+
┌─────────────────────────────────────────────────────────┐
|
|
516
|
+
│ INTEGRATION (Elder Brain) │
|
|
517
|
+
│ - Wire everything together │
|
|
518
|
+
│ - npm publish @nordsym/apiclaw │
|
|
519
|
+
│ - Test on all platforms │
|
|
520
|
+
└─────────────────────────────────────────────────────────┘
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
### Dependencies
|
|
524
|
+
|
|
525
|
+
| Agent | Depends On | Can Start |
|
|
526
|
+
|-------|------------|-----------|
|
|
527
|
+
| Agent 1 (CLI Core) | Nothing | Immediately |
|
|
528
|
+
| Agent 2 (Adapters) | Agent 1 | After Agent 1 |
|
|
529
|
+
| Agent 3 (Enterprise) | Agent 1 | After Agent 1 |
|
|
530
|
+
| Agent 4 (UX & Docs) | Nothing | Immediately |
|
|
531
|
+
|
|
532
|
+
**Parallel execution:** Agent 1 + Agent 4 first, then Agent 2 + Agent 3
|
|
533
|
+
|
|
534
|
+
---
|
|
535
|
+
|
|
536
|
+
## Technical Stack
|
|
537
|
+
|
|
538
|
+
```
|
|
539
|
+
@nordsym/apiclaw (CLI)
|
|
540
|
+
├── commander.js # CLI framework
|
|
541
|
+
├── inquirer.js # Interactive prompts
|
|
542
|
+
├── ora # Spinners
|
|
543
|
+
├── chalk # Colors
|
|
544
|
+
├── fs-extra # File operations
|
|
545
|
+
├── detect-indent # Preserve formatting
|
|
546
|
+
└── ajv # JSON validation
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
---
|
|
550
|
+
|
|
551
|
+
## Success Metrics
|
|
552
|
+
|
|
553
|
+
| Metric | Target |
|
|
554
|
+
|--------|--------|
|
|
555
|
+
| Setup success rate | >95% |
|
|
556
|
+
| Time to first API call | <30 seconds |
|
|
557
|
+
| Support tickets from setup | <5% of users |
|
|
558
|
+
| Enterprise deployments | 10+ companies |
|
|
559
|
+
|
|
560
|
+
---
|
|
561
|
+
|
|
562
|
+
## Open Questions
|
|
563
|
+
|
|
564
|
+
1. **Self-hosted support:** Should we support custom API endpoints from day 1?
|
|
565
|
+
2. **Auto-update:** Should setup auto-update APIClaw if already installed?
|
|
566
|
+
3. **Telemetry:** Collect anonymous setup success/failure metrics?
|
|
567
|
+
4. **GUI installer:** Worth building Electron app for non-CLI users?
|
|
568
|
+
|
|
569
|
+
---
|
|
570
|
+
|
|
571
|
+
## Appendix: Full Config Examples
|
|
572
|
+
|
|
573
|
+
### Claude Desktop (macOS)
|
|
574
|
+
|
|
575
|
+
```json
|
|
576
|
+
{
|
|
577
|
+
"mcpServers": {
|
|
578
|
+
"apiclaw": {
|
|
579
|
+
"command": "npx",
|
|
580
|
+
"args": ["-y", "@nordsym/apiclaw"]
|
|
581
|
+
},
|
|
582
|
+
"other-server": {
|
|
583
|
+
"command": "node",
|
|
584
|
+
"args": ["/path/to/server.js"]
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
### Cursor
|
|
591
|
+
|
|
592
|
+
```json
|
|
593
|
+
{
|
|
594
|
+
"mcpServers": {
|
|
595
|
+
"apiclaw": {
|
|
596
|
+
"command": "npx",
|
|
597
|
+
"args": ["-y", "@nordsym/apiclaw"],
|
|
598
|
+
"env": {
|
|
599
|
+
"APICLAW_WORKSPACE": "ws_123"
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
### Continue
|
|
607
|
+
|
|
608
|
+
```json
|
|
609
|
+
{
|
|
610
|
+
"models": [...],
|
|
611
|
+
"mcpServers": [
|
|
612
|
+
{
|
|
613
|
+
"name": "apiclaw",
|
|
614
|
+
"command": "npx",
|
|
615
|
+
"args": ["-y", "@nordsym/apiclaw"]
|
|
616
|
+
}
|
|
617
|
+
]
|
|
618
|
+
}
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
---
|
|
622
|
+
|
|
623
|
+
*Last updated: 2026-02-28*
|