@crush-protocol/mcp-client 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +786 -94
- package/dist/cli.js +10 -14
- package/dist/setup/setupClients.d.ts +3 -2
- package/dist/setup/setupClients.js +113 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,200 +1,892 @@
|
|
|
1
1
|
# Crush Protocol MCP Client
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@crush-protocol/mcp-client)
|
|
4
|
+
[](./LICENSE)
|
|
4
5
|
|
|
5
6
|
`@crush-protocol/mcp-client` is the npm entrypoint for Crush Protocol MCP.
|
|
6
7
|
|
|
7
|
-
Crush Protocol is an AI-native quantitative trading product. It lets an MCP host connect to Crush and use trading-focused tools for
|
|
8
|
+
Crush Protocol is an AI-native quantitative trading product. It lets an MCP host connect to Crush and use trading-focused tools for strategy research, backtest creation, live strategy management, and market data discovery.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
- backtest creation and result retrieval
|
|
11
|
-
- live strategy management
|
|
12
|
-
- market data and signal discovery
|
|
10
|
+
## Quick Setup
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
```sh
|
|
13
|
+
npx -y @crush-protocol/mcp-client setup --all
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
This writes MCP config for all **9** supported hosts: Cursor, Claude Code, Codex, Gemini CLI, OpenCode, VS Code, Windsurf, Claude Desktop, Warp.
|
|
17
|
+
|
|
18
|
+
To target a single host: `npx -y @crush-protocol/mcp-client setup --cursor`
|
|
19
|
+
|
|
20
|
+
**[All Client Configurations →](#client-configuration)**
|
|
21
|
+
|
|
22
|
+
## Connection Modes
|
|
23
|
+
|
|
24
|
+
| Mode | Transport | Auth | Best For |
|
|
25
|
+
|------|-----------|------|----------|
|
|
26
|
+
| **Local** | stdio (npx) | OAuth — browser opens automatically | Most MCP clients |
|
|
27
|
+
| **Remote** | Streamable HTTP | OAuth — browser opens automatically | Clients with native HTTP support |
|
|
15
28
|
|
|
16
|
-
|
|
29
|
+
**Remote Server URL:** `https://crush-mcp-ats.dev.xexlab.com/mcp`
|
|
17
30
|
|
|
18
|
-
|
|
19
|
-
|
|
31
|
+
Authentication is automatic (OAuth 2.1 Authorization Code + PKCE). On first use, a browser window opens for login; tokens are cached locally for reuse.
|
|
32
|
+
|
|
33
|
+
For hosts that support URL-only MCP (Remote mode), the full flow is:
|
|
34
|
+
|
|
35
|
+
1. Host connects to the MCP URL
|
|
36
|
+
2. Server returns `401` with `WWW-Authenticate` header
|
|
37
|
+
3. Host performs OAuth discovery and dynamic client registration
|
|
38
|
+
4. Completes Authorization Code + PKCE via browser
|
|
39
|
+
5. Persists tokens locally and reconnects
|
|
40
|
+
|
|
41
|
+
If a host cannot complete OAuth automatically, pre-authorize with:
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
npx -y @crush-protocol/mcp-client login
|
|
20
45
|
```
|
|
21
46
|
|
|
22
|
-
##
|
|
47
|
+
## Available Tools
|
|
48
|
+
|
|
49
|
+
**Market Data** — `list_tables` · `list_tokens` · `list_indicators` · `list_timeframes` · `get_data_range` · `check_query_size` · `fetch_ohlcv` · `fetch_indicator` · `fetch_news` · `get_connection_config` · `save_custom_indicator` · `list_custom_indicators` · `get_custom_indicator` · `delete_custom_indicator`
|
|
50
|
+
|
|
51
|
+
**Backtest** — `get_backtest_config_schema` · `get_available_tokens` · `validate_expression` · `create_backtest` · `list_backtests`
|
|
52
|
+
|
|
53
|
+
**Strategy** — `create_strategy` · `list_strategies` · `get_strategy` · `update_strategy` · `delete_strategy` · `toggle_strategy` · `get_strategy_logs`
|
|
23
54
|
|
|
24
|
-
|
|
55
|
+
**Signal** — `get_signal_metadata` · `get_signals_by_category`
|
|
25
56
|
|
|
26
|
-
|
|
57
|
+
**Utilities** — `search_tokens` · `get_token_info` · `get_trending_tokens` · `get_alpha_feed` · `get_token_feed`
|
|
58
|
+
|
|
59
|
+
Detailed tool guidance is in [INSTRUCTIONS.md](./INSTRUCTIONS.md).
|
|
60
|
+
|
|
61
|
+
## Client Configuration
|
|
27
62
|
|
|
28
63
|
### Cursor
|
|
29
64
|
|
|
30
|
-
|
|
65
|
+
[](https://cursor.com/install-mcp?name=crush-protocol&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjcnVzaC1wcm90b2NvbC9tY3AtY2xpZW50Il19)
|
|
66
|
+
|
|
67
|
+
[Cursor MCP docs](https://docs.cursor.com/context/model-context-protocol)
|
|
31
68
|
|
|
32
|
-
|
|
69
|
+
Go to: `Settings` → `Cursor Settings` → `MCP` → `Add new global MCP server`
|
|
33
70
|
|
|
34
|
-
|
|
71
|
+
#### Local Server Connection
|
|
35
72
|
|
|
36
73
|
```json
|
|
37
74
|
{
|
|
38
75
|
"mcpServers": {
|
|
39
76
|
"crush-protocol": {
|
|
40
77
|
"command": "npx",
|
|
41
|
-
"args": ["-y", "@crush-protocol/mcp-client"
|
|
78
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
#### Remote Server Connection
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"mcpServers": {
|
|
89
|
+
"crush-protocol": {
|
|
90
|
+
"url": "https://crush-mcp-ats.dev.xexlab.com/mcp"
|
|
42
91
|
}
|
|
43
92
|
}
|
|
44
93
|
}
|
|
45
94
|
```
|
|
46
95
|
|
|
96
|
+
---
|
|
97
|
+
|
|
47
98
|
### Claude Code
|
|
48
99
|
|
|
100
|
+
[Claude Code MCP docs](https://docs.anthropic.com/en/docs/claude-code/mcp)
|
|
101
|
+
|
|
102
|
+
#### Local Server Connection
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
claude mcp add --scope user crush-protocol -- npx -y @crush-protocol/mcp-client
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
#### Remote Server Connection
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
claude mcp add --scope user --transport http crush-protocol https://crush-mcp-ats.dev.xexlab.com/mcp
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### OpenCode
|
|
117
|
+
|
|
118
|
+
[OpenCode MCP docs](https://opencode.ai/docs/mcp-servers)
|
|
119
|
+
|
|
120
|
+
Add to `~/.config/opencode/opencode.json`:
|
|
121
|
+
|
|
122
|
+
#### Local Server Connection
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"$schema": "https://opencode.ai/config.json",
|
|
127
|
+
"mcp": {
|
|
128
|
+
"crush-protocol": {
|
|
129
|
+
"type": "local",
|
|
130
|
+
"command": ["npx", "-y", "@crush-protocol/mcp-client"],
|
|
131
|
+
"enabled": true
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### Remote Server Connection
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"$schema": "https://opencode.ai/config.json",
|
|
142
|
+
"mcp": {
|
|
143
|
+
"crush-protocol": {
|
|
144
|
+
"type": "remote",
|
|
145
|
+
"url": "https://crush-mcp-ats.dev.xexlab.com/mcp",
|
|
146
|
+
"enabled": true
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
### OpenAI Codex
|
|
155
|
+
|
|
156
|
+
[OpenAI Codex MCP docs](https://developers.openai.com/codex/mcp)
|
|
157
|
+
|
|
158
|
+
#### Using CLI
|
|
159
|
+
|
|
49
160
|
```sh
|
|
50
|
-
|
|
51
|
-
-- npx -y @crush-protocol/mcp-client \
|
|
52
|
-
--url https://crush-mcp-ats.dev.xexlab.com/mcp
|
|
161
|
+
codex mcp add crush-protocol -- npx -y @crush-protocol/mcp-client
|
|
53
162
|
```
|
|
54
163
|
|
|
55
|
-
|
|
164
|
+
#### Local Server Connection
|
|
56
165
|
|
|
57
166
|
Add to `~/.codex/config.toml`:
|
|
58
167
|
|
|
59
168
|
```toml
|
|
60
169
|
[mcp_servers.crush-protocol]
|
|
61
170
|
command = "npx"
|
|
62
|
-
args = ["-y", "@crush-protocol/mcp-client"
|
|
171
|
+
args = ["-y", "@crush-protocol/mcp-client"]
|
|
63
172
|
startup_timeout_ms = 20000
|
|
64
173
|
```
|
|
65
174
|
|
|
66
|
-
|
|
175
|
+
#### Remote Server Connection
|
|
176
|
+
|
|
177
|
+
```toml
|
|
178
|
+
[mcp_servers.crush-protocol]
|
|
179
|
+
url = "https://crush-mcp-ats.dev.xexlab.com/mcp"
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
### Google Gemini CLI
|
|
185
|
+
|
|
186
|
+
[Gemini CLI Configuration](https://google-gemini.github.io/gemini-cli/docs/tools/mcp-server.html)
|
|
67
187
|
|
|
68
188
|
Add to `~/.gemini/settings.json`:
|
|
69
189
|
|
|
190
|
+
#### Remote Server Connection
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"mcpServers": {
|
|
195
|
+
"crush-protocol": {
|
|
196
|
+
"httpUrl": "https://crush-mcp-ats.dev.xexlab.com/mcp"
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### Local Server Connection
|
|
203
|
+
|
|
70
204
|
```json
|
|
71
205
|
{
|
|
72
206
|
"mcpServers": {
|
|
73
207
|
"crush-protocol": {
|
|
74
208
|
"command": "npx",
|
|
75
|
-
"args": ["-y", "@crush-protocol/mcp-client"
|
|
209
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
76
210
|
}
|
|
77
211
|
}
|
|
78
212
|
}
|
|
79
213
|
```
|
|
80
214
|
|
|
81
|
-
|
|
215
|
+
---
|
|
82
216
|
|
|
83
|
-
|
|
217
|
+
### VS Code
|
|
218
|
+
|
|
219
|
+
[VS Code MCP docs](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)
|
|
220
|
+
|
|
221
|
+
Add to `.vscode/mcp.json`:
|
|
222
|
+
|
|
223
|
+
#### Remote Server Connection
|
|
84
224
|
|
|
85
225
|
```json
|
|
86
226
|
{
|
|
87
|
-
"
|
|
88
|
-
"mcp": {
|
|
227
|
+
"servers": {
|
|
89
228
|
"crush-protocol": {
|
|
90
|
-
"type": "
|
|
91
|
-
"
|
|
92
|
-
"enabled": true
|
|
229
|
+
"type": "http",
|
|
230
|
+
"url": "https://crush-mcp-ats.dev.xexlab.com/mcp"
|
|
93
231
|
}
|
|
94
232
|
}
|
|
95
233
|
}
|
|
96
234
|
```
|
|
97
235
|
|
|
98
|
-
|
|
236
|
+
#### Local Server Connection
|
|
99
237
|
|
|
100
|
-
|
|
238
|
+
```json
|
|
239
|
+
{
|
|
240
|
+
"servers": {
|
|
241
|
+
"crush-protocol": {
|
|
242
|
+
"type": "stdio",
|
|
243
|
+
"command": "npx",
|
|
244
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
```
|
|
101
249
|
|
|
102
|
-
|
|
103
|
-
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
### Windsurf
|
|
253
|
+
|
|
254
|
+
[Windsurf MCP docs](https://docs.windsurf.com/windsurf/cascade/mcp)
|
|
255
|
+
|
|
256
|
+
#### Remote Server Connection
|
|
257
|
+
|
|
258
|
+
```json
|
|
259
|
+
{
|
|
260
|
+
"mcpServers": {
|
|
261
|
+
"crush-protocol": {
|
|
262
|
+
"serverUrl": "https://crush-mcp-ats.dev.xexlab.com/mcp"
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
104
266
|
```
|
|
105
267
|
|
|
106
|
-
|
|
268
|
+
#### Local Server Connection
|
|
107
269
|
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
npx
|
|
113
|
-
|
|
270
|
+
```json
|
|
271
|
+
{
|
|
272
|
+
"mcpServers": {
|
|
273
|
+
"crush-protocol": {
|
|
274
|
+
"command": "npx",
|
|
275
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
114
279
|
```
|
|
115
280
|
|
|
116
|
-
|
|
281
|
+
---
|
|
117
282
|
|
|
118
|
-
|
|
283
|
+
### Claude Desktop
|
|
119
284
|
|
|
120
|
-
|
|
121
|
-
- `get_available_tokens`
|
|
122
|
-
- `create_backtest`
|
|
123
|
-
- `get_backtest_result`
|
|
124
|
-
- `list_backtests`
|
|
125
|
-
- `create_strategy`
|
|
126
|
-
- `list_strategies`
|
|
127
|
-
- `toggle_strategy`
|
|
128
|
-
- `get_strategy_logs`
|
|
285
|
+
[Claude Desktop MCP docs](https://modelcontextprotocol.io/quickstart/user)
|
|
129
286
|
|
|
130
|
-
|
|
287
|
+
Edit `claude_desktop_config.json`:
|
|
131
288
|
|
|
132
|
-
|
|
289
|
+
#### Local Server Connection
|
|
133
290
|
|
|
134
|
-
|
|
291
|
+
```json
|
|
292
|
+
{
|
|
293
|
+
"mcpServers": {
|
|
294
|
+
"crush-protocol": {
|
|
295
|
+
"command": "npx",
|
|
296
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
```
|
|
135
301
|
|
|
136
|
-
|
|
302
|
+
---
|
|
137
303
|
|
|
138
|
-
|
|
139
|
-
- the client completes browser OAuth when needed
|
|
140
|
-
- tokens are stored locally for reuse
|
|
304
|
+
### Kiro
|
|
141
305
|
|
|
142
|
-
|
|
306
|
+
[Kiro MCP docs](https://kiro.dev/docs/mcp/configuration/)
|
|
143
307
|
|
|
144
|
-
|
|
145
|
-
- `CRUSH_OAUTH_ACCESS_TOKEN=<access-token>`
|
|
308
|
+
Navigate `Kiro` → `MCP Servers` → `+ Add`, paste the configuration:
|
|
146
309
|
|
|
147
|
-
|
|
310
|
+
#### Remote Server Connection
|
|
148
311
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
312
|
+
```json
|
|
313
|
+
{
|
|
314
|
+
"mcpServers": {
|
|
315
|
+
"crush-protocol": {
|
|
316
|
+
"url": "https://crush-mcp-ats.dev.xexlab.com/mcp"
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
```
|
|
152
321
|
|
|
153
|
-
|
|
322
|
+
#### Local Server Connection
|
|
154
323
|
|
|
155
|
-
```
|
|
156
|
-
|
|
324
|
+
```json
|
|
325
|
+
{
|
|
326
|
+
"mcpServers": {
|
|
327
|
+
"crush-protocol": {
|
|
328
|
+
"command": "npx",
|
|
329
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
157
333
|
```
|
|
158
334
|
|
|
159
|
-
|
|
335
|
+
---
|
|
160
336
|
|
|
161
|
-
|
|
337
|
+
### Roo Code
|
|
162
338
|
|
|
163
|
-
|
|
339
|
+
[Roo Code MCP docs](https://docs.roocode.com/features/mcp/using-mcp-in-roo)
|
|
164
340
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
341
|
+
#### Remote Server Connection
|
|
342
|
+
|
|
343
|
+
```json
|
|
344
|
+
{
|
|
345
|
+
"mcpServers": {
|
|
346
|
+
"crush-protocol": {
|
|
347
|
+
"type": "streamable-http",
|
|
348
|
+
"url": "https://crush-mcp-ats.dev.xexlab.com/mcp"
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
#### Local Server Connection
|
|
355
|
+
|
|
356
|
+
```json
|
|
357
|
+
{
|
|
358
|
+
"mcpServers": {
|
|
359
|
+
"crush-protocol": {
|
|
360
|
+
"command": "npx",
|
|
361
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
### Cline
|
|
370
|
+
|
|
371
|
+
[Cline MCP Marketplace](https://cline.bot/mcp-marketplace)
|
|
372
|
+
|
|
373
|
+
#### Remote Server Connection
|
|
374
|
+
|
|
375
|
+
```json
|
|
376
|
+
{
|
|
377
|
+
"mcpServers": {
|
|
378
|
+
"crush-protocol": {
|
|
379
|
+
"url": "https://crush-mcp-ats.dev.xexlab.com/mcp",
|
|
380
|
+
"type": "streamableHttp"
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
171
384
|
```
|
|
172
385
|
|
|
173
|
-
|
|
386
|
+
#### Local Server Connection
|
|
174
387
|
|
|
175
|
-
```
|
|
176
|
-
|
|
388
|
+
```json
|
|
389
|
+
{
|
|
390
|
+
"mcpServers": {
|
|
391
|
+
"crush-protocol": {
|
|
392
|
+
"command": "npx",
|
|
393
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
### Trae
|
|
402
|
+
|
|
403
|
+
[Trae MCP docs](https://docs.trae.ai/ide/model-context-protocol?_lang=en)
|
|
404
|
+
|
|
405
|
+
#### Remote Server Connection
|
|
406
|
+
|
|
407
|
+
```json
|
|
408
|
+
{
|
|
409
|
+
"mcpServers": {
|
|
410
|
+
"crush-protocol": {
|
|
411
|
+
"url": "https://crush-mcp-ats.dev.xexlab.com/mcp"
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
#### Local Server Connection
|
|
418
|
+
|
|
419
|
+
```json
|
|
420
|
+
{
|
|
421
|
+
"mcpServers": {
|
|
422
|
+
"crush-protocol": {
|
|
423
|
+
"command": "npx",
|
|
424
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
### Augment Code
|
|
433
|
+
|
|
434
|
+
1. Click hamburger menu → Settings → Tools → `+ Add MCP`
|
|
435
|
+
2. Enter command: `npx -y @crush-protocol/mcp-client`
|
|
436
|
+
3. Name: `crush-protocol` → Click Add
|
|
437
|
+
|
|
438
|
+
Manual config in VS Code settings:
|
|
439
|
+
|
|
440
|
+
```json
|
|
441
|
+
"augment.advanced": {
|
|
442
|
+
"mcpServers": [
|
|
443
|
+
{
|
|
444
|
+
"name": "crush-protocol",
|
|
445
|
+
"command": "npx",
|
|
446
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
447
|
+
}
|
|
448
|
+
]
|
|
449
|
+
}
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
---
|
|
177
453
|
|
|
178
|
-
|
|
179
|
-
serverUrl: "https://crush-mcp-ats.dev.xexlab.com/mcp",
|
|
180
|
-
});
|
|
454
|
+
### Copilot Coding Agent
|
|
181
455
|
|
|
182
|
-
|
|
456
|
+
[GitHub Copilot MCP docs](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/agents/copilot-coding-agent/extending-copilot-coding-agent-with-mcp)
|
|
183
457
|
|
|
184
|
-
|
|
185
|
-
|
|
458
|
+
#### Remote Server Connection
|
|
459
|
+
|
|
460
|
+
```json
|
|
461
|
+
{
|
|
462
|
+
"mcpServers": {
|
|
463
|
+
"crush-protocol": {
|
|
464
|
+
"type": "http",
|
|
465
|
+
"url": "https://crush-mcp-ats.dev.xexlab.com/mcp"
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
```
|
|
186
470
|
|
|
187
|
-
|
|
471
|
+
#### Local Server Connection
|
|
188
472
|
|
|
189
|
-
|
|
473
|
+
```json
|
|
474
|
+
{
|
|
475
|
+
"mcpServers": {
|
|
476
|
+
"crush-protocol": {
|
|
477
|
+
"type": "local",
|
|
478
|
+
"command": "npx",
|
|
479
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
190
483
|
```
|
|
191
484
|
|
|
192
|
-
|
|
485
|
+
---
|
|
486
|
+
|
|
487
|
+
### Copilot CLI
|
|
488
|
+
|
|
489
|
+
Add to `~/.copilot/mcp-config.json`:
|
|
193
490
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
491
|
+
#### Remote Server Connection
|
|
492
|
+
|
|
493
|
+
```json
|
|
494
|
+
{
|
|
495
|
+
"mcpServers": {
|
|
496
|
+
"crush-protocol": {
|
|
497
|
+
"type": "http",
|
|
498
|
+
"url": "https://crush-mcp-ats.dev.xexlab.com/mcp"
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
#### Local Server Connection
|
|
505
|
+
|
|
506
|
+
```json
|
|
507
|
+
{
|
|
508
|
+
"mcpServers": {
|
|
509
|
+
"crush-protocol": {
|
|
510
|
+
"type": "local",
|
|
511
|
+
"command": "npx",
|
|
512
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
---
|
|
519
|
+
|
|
520
|
+
### Amazon Q Developer CLI
|
|
521
|
+
|
|
522
|
+
[Amazon Q Developer CLI docs](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-mcp-configuration.html)
|
|
523
|
+
|
|
524
|
+
```json
|
|
525
|
+
{
|
|
526
|
+
"mcpServers": {
|
|
527
|
+
"crush-protocol": {
|
|
528
|
+
"command": "npx",
|
|
529
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
---
|
|
536
|
+
|
|
537
|
+
### Warp
|
|
538
|
+
|
|
539
|
+
[Warp MCP docs](https://docs.warp.dev/knowledge-and-collaboration/mcp#adding-an-mcp-server)
|
|
540
|
+
|
|
541
|
+
Navigate `Settings` → `AI` → `Manage MCP servers` → `+ Add`:
|
|
542
|
+
|
|
543
|
+
```json
|
|
544
|
+
{
|
|
545
|
+
"crush-protocol": {
|
|
546
|
+
"command": "npx",
|
|
547
|
+
"args": ["-y", "@crush-protocol/mcp-client"],
|
|
548
|
+
"env": {},
|
|
549
|
+
"working_directory": null,
|
|
550
|
+
"start_on_launch": true
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
---
|
|
556
|
+
|
|
557
|
+
### Amp
|
|
558
|
+
|
|
559
|
+
[Amp MCP docs](https://ampcode.com/manual#mcp)
|
|
560
|
+
|
|
561
|
+
```sh
|
|
562
|
+
amp mcp add crush-protocol https://crush-mcp-ats.dev.xexlab.com/mcp
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
---
|
|
566
|
+
|
|
567
|
+
### Zed
|
|
568
|
+
|
|
569
|
+
[Zed Context Server docs](https://zed.dev/docs/assistant/context-servers)
|
|
570
|
+
|
|
571
|
+
Add to `settings.json`:
|
|
572
|
+
|
|
573
|
+
```json
|
|
574
|
+
{
|
|
575
|
+
"context_servers": {
|
|
576
|
+
"crush-protocol": {
|
|
577
|
+
"source": "custom",
|
|
578
|
+
"command": "npx",
|
|
579
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
---
|
|
586
|
+
|
|
587
|
+
### JetBrains AI Assistant
|
|
588
|
+
|
|
589
|
+
[JetBrains AI Assistant docs](https://www.jetbrains.com/help/ai-assistant/configure-an-mcp-server.html)
|
|
590
|
+
|
|
591
|
+
Go to `Settings` → `Tools` → `AI Assistant` → `Model Context Protocol (MCP)` → `+ Add`
|
|
592
|
+
|
|
593
|
+
#### Remote Server Connection
|
|
594
|
+
|
|
595
|
+
```json
|
|
596
|
+
{
|
|
597
|
+
"mcpServers": {
|
|
598
|
+
"crush-protocol": {
|
|
599
|
+
"url": "https://crush-mcp-ats.dev.xexlab.com/mcp"
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
#### Local Server Connection
|
|
606
|
+
|
|
607
|
+
```json
|
|
608
|
+
{
|
|
609
|
+
"mcpServers": {
|
|
610
|
+
"crush-protocol": {
|
|
611
|
+
"command": "npx",
|
|
612
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
---
|
|
619
|
+
|
|
620
|
+
### Qwen Code
|
|
621
|
+
|
|
622
|
+
[Qwen Code MCP docs](https://qwenlm.github.io/qwen-code-docs/en/users/features/mcp/)
|
|
623
|
+
|
|
624
|
+
#### Using CLI
|
|
625
|
+
|
|
626
|
+
```sh
|
|
627
|
+
qwen mcp add crush-protocol npx -y @crush-protocol/mcp-client
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
#### Remote Server Connection
|
|
631
|
+
|
|
632
|
+
Add to `~/.qwen/settings.json`:
|
|
633
|
+
|
|
634
|
+
```json
|
|
635
|
+
{
|
|
636
|
+
"mcpServers": {
|
|
637
|
+
"crush-protocol": {
|
|
638
|
+
"httpUrl": "https://crush-mcp-ats.dev.xexlab.com/mcp"
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
#### Local Server Connection
|
|
645
|
+
|
|
646
|
+
```json
|
|
647
|
+
{
|
|
648
|
+
"mcpServers": {
|
|
649
|
+
"crush-protocol": {
|
|
650
|
+
"command": "npx",
|
|
651
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
---
|
|
658
|
+
|
|
659
|
+
### LM Studio
|
|
660
|
+
|
|
661
|
+
[LM Studio MCP Support](https://lmstudio.ai/blog/lmstudio-v0.3.17)
|
|
662
|
+
|
|
663
|
+
Navigate `Program` → `Install` → `Edit mcp.json`:
|
|
664
|
+
|
|
665
|
+
```json
|
|
666
|
+
{
|
|
667
|
+
"mcpServers": {
|
|
668
|
+
"crush-protocol": {
|
|
669
|
+
"command": "npx",
|
|
670
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
---
|
|
677
|
+
|
|
678
|
+
### Visual Studio 2022
|
|
679
|
+
|
|
680
|
+
[Visual Studio MCP docs](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022)
|
|
681
|
+
|
|
682
|
+
#### Remote Server Connection
|
|
683
|
+
|
|
684
|
+
```json
|
|
685
|
+
{
|
|
686
|
+
"inputs": [],
|
|
687
|
+
"servers": {
|
|
688
|
+
"crush-protocol": {
|
|
689
|
+
"type": "http",
|
|
690
|
+
"url": "https://crush-mcp-ats.dev.xexlab.com/mcp"
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
#### Local Server Connection
|
|
697
|
+
|
|
698
|
+
```json
|
|
699
|
+
{
|
|
700
|
+
"mcp": {
|
|
701
|
+
"servers": {
|
|
702
|
+
"crush-protocol": {
|
|
703
|
+
"type": "stdio",
|
|
704
|
+
"command": "npx",
|
|
705
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
---
|
|
713
|
+
|
|
714
|
+
### BoltAI
|
|
715
|
+
|
|
716
|
+
[BoltAI docs](https://docs.boltai.com/docs/plugins/mcp-servers)
|
|
717
|
+
|
|
718
|
+
```json
|
|
719
|
+
{
|
|
720
|
+
"mcpServers": {
|
|
721
|
+
"crush-protocol": {
|
|
722
|
+
"command": "npx",
|
|
723
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
---
|
|
730
|
+
|
|
731
|
+
### Perplexity Desktop
|
|
732
|
+
|
|
733
|
+
[Perplexity MCP docs](https://www.perplexity.ai/help-center/en/articles/11502712-local-and-remote-mcps-for-perplexity)
|
|
734
|
+
|
|
735
|
+
Navigate `Perplexity` → `Settings` → `Connectors` → `Add Connector` → `Advanced`
|
|
736
|
+
|
|
737
|
+
Server Name: `crush-protocol`
|
|
738
|
+
|
|
739
|
+
```json
|
|
740
|
+
{
|
|
741
|
+
"args": ["-y", "@crush-protocol/mcp-client"],
|
|
742
|
+
"command": "npx",
|
|
743
|
+
"env": {}
|
|
744
|
+
}
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
---
|
|
748
|
+
|
|
749
|
+
### Kilo Code
|
|
750
|
+
|
|
751
|
+
[Kilo Code docs](https://kilocode.ai)
|
|
752
|
+
|
|
753
|
+
#### Remote Server Connection
|
|
754
|
+
|
|
755
|
+
```json
|
|
756
|
+
{
|
|
757
|
+
"mcpServers": {
|
|
758
|
+
"crush-protocol": {
|
|
759
|
+
"type": "streamable-http",
|
|
760
|
+
"url": "https://crush-mcp-ats.dev.xexlab.com/mcp"
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
#### Local Server Connection
|
|
767
|
+
|
|
768
|
+
```json
|
|
769
|
+
{
|
|
770
|
+
"mcpServers": {
|
|
771
|
+
"crush-protocol": {
|
|
772
|
+
"command": "npx",
|
|
773
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
---
|
|
780
|
+
|
|
781
|
+
### Zencoder
|
|
782
|
+
|
|
783
|
+
1. Go to Zencoder menu → Agent tools → Add custom MCP
|
|
784
|
+
2. Paste:
|
|
785
|
+
|
|
786
|
+
```json
|
|
787
|
+
{
|
|
788
|
+
"command": "npx",
|
|
789
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
790
|
+
}
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
---
|
|
794
|
+
|
|
795
|
+
### Qodo Gen
|
|
796
|
+
|
|
797
|
+
[Qodo Gen docs](https://docs.qodo.ai/qodo-documentation/qodo-gen/qodo-gen-chat/agentic-mode/agentic-tools-mcps)
|
|
798
|
+
|
|
799
|
+
Open Qodo Gen chat → Connect more tools → `+ Add new MCP`:
|
|
800
|
+
|
|
801
|
+
#### Remote Server Connection
|
|
802
|
+
|
|
803
|
+
```json
|
|
804
|
+
{
|
|
805
|
+
"mcpServers": {
|
|
806
|
+
"crush-protocol": {
|
|
807
|
+
"url": "https://crush-mcp-ats.dev.xexlab.com/mcp"
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
#### Local Server Connection
|
|
814
|
+
|
|
815
|
+
```json
|
|
816
|
+
{
|
|
817
|
+
"mcpServers": {
|
|
818
|
+
"crush-protocol": {
|
|
819
|
+
"command": "npx",
|
|
820
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
---
|
|
827
|
+
|
|
828
|
+
### Using Bun or Deno
|
|
829
|
+
|
|
830
|
+
#### Bun
|
|
831
|
+
|
|
832
|
+
```json
|
|
833
|
+
{
|
|
834
|
+
"mcpServers": {
|
|
835
|
+
"crush-protocol": {
|
|
836
|
+
"command": "bunx",
|
|
837
|
+
"args": ["-y", "@crush-protocol/mcp-client"]
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
#### Deno
|
|
844
|
+
|
|
845
|
+
```json
|
|
846
|
+
{
|
|
847
|
+
"mcpServers": {
|
|
848
|
+
"crush-protocol": {
|
|
849
|
+
"command": "deno",
|
|
850
|
+
"args": [
|
|
851
|
+
"run",
|
|
852
|
+
"--allow-env",
|
|
853
|
+
"--allow-net",
|
|
854
|
+
"--allow-read",
|
|
855
|
+
"--allow-write",
|
|
856
|
+
"npm:@crush-protocol/mcp-client"
|
|
857
|
+
]
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
```
|
|
862
|
+
|
|
863
|
+
---
|
|
864
|
+
|
|
865
|
+
### Windows
|
|
866
|
+
|
|
867
|
+
Use `cmd` as the command wrapper:
|
|
868
|
+
|
|
869
|
+
```json
|
|
870
|
+
{
|
|
871
|
+
"mcpServers": {
|
|
872
|
+
"crush-protocol": {
|
|
873
|
+
"command": "cmd",
|
|
874
|
+
"args": ["/c", "npx", "-y", "@crush-protocol/mcp-client"]
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
```
|
|
879
|
+
|
|
880
|
+
## CLI Usage
|
|
881
|
+
|
|
882
|
+
```sh
|
|
883
|
+
npx -y @crush-protocol/mcp-client login # 预授权 OAuth(浏览器登录)
|
|
884
|
+
npx -y @crush-protocol/mcp-client setup --all # 写入所有客户端配置
|
|
885
|
+
npx -y @crush-protocol/mcp-client tools:list # 列出可用工具
|
|
886
|
+
npx -y @crush-protocol/mcp-client ping # 测试连通性
|
|
887
|
+
npx -y @crush-protocol/mcp-client backtest:schema # 获取回测配置 schema
|
|
888
|
+
npx -y @crush-protocol/mcp-client backtest:list --limit 10
|
|
889
|
+
```
|
|
198
890
|
|
|
199
891
|
## License
|
|
200
892
|
|
package/dist/cli.js
CHANGED
|
@@ -4,10 +4,10 @@ import { BacktestClient } from "./backtest/backtestClient.js";
|
|
|
4
4
|
import { ClickHouseDirectClient } from "./clickhouse/directClient.js";
|
|
5
5
|
import { OAuthRemoteMcpClient } from "./mcp/oauthRemoteClient.js";
|
|
6
6
|
import { RemoteMcpClient } from "./mcp/remoteClient.js";
|
|
7
|
-
import { installClientConfig } from "./setup/setupClients.js";
|
|
8
|
-
const
|
|
7
|
+
import { ALL_TARGETS, installClientConfig } from "./setup/setupClients.js";
|
|
8
|
+
const MCP_SERVER_URL = "https://crush-mcp-ats.dev.xexlab.com/mcp";
|
|
9
9
|
const printUsage = () => {
|
|
10
|
-
console.log(`\ncrush-mcp-client\n\nGeneral:\n login
|
|
10
|
+
console.log(`\ncrush-mcp-client\n\nGeneral:\n login\n setup [--cursor] [--claude] [--codex] [--gemini] [--opencode] [--all] [--scope user|project]\n tools:list [--token TOKEN]\n tool:call --name TOOL_NAME [--args JSON] [--token TOKEN]\n ping [--token TOKEN]\n\nBacktest:\n backtest:schema [--token TOKEN]\n backtest:tokens [--platform PLATFORM] [--token TOKEN]\n backtest:validate --expression JSON [--data-source kline|factors] [--token TOKEN]\n backtest:create --config JSON [--backtest-id ID] [--token TOKEN]\n backtest:list [--status STATUS] [--limit N] [--offset N] [--token TOKEN]\n\nClickHouse:\n clickhouse:list-tables [--ch-host HOST --ch-port PORT --ch-user USER --ch-password PASS --ch-database DB]\n clickhouse:query --sql SQL [--ch-host HOST --ch-port PORT --ch-user USER --ch-password PASS --ch-database DB --ch-row-cap N]\n\nAuth:\n --token TOKEN uses a provided OAuth access token.\n Without --token, OAuth runs automatically in the browser when needed.\n\nEnv:\n CRUSH_OAUTH_ACCESS_TOKEN\n CH_HOST, CH_PORT, CH_USER, CH_PASSWORD, CH_DATABASE, CH_ROW_CAP\n`);
|
|
11
11
|
};
|
|
12
12
|
const parseFlags = (args) => {
|
|
13
13
|
const flags = {};
|
|
@@ -32,15 +32,12 @@ const requireString = (value, message) => {
|
|
|
32
32
|
}
|
|
33
33
|
return value;
|
|
34
34
|
};
|
|
35
|
-
const getServerUrl = (
|
|
36
|
-
? flags.url
|
|
37
|
-
: (process.env.CRUSH_MCP_SERVER_URL ?? DEFAULT_MCP_SERVER_URL);
|
|
35
|
+
const getServerUrl = () => MCP_SERVER_URL;
|
|
38
36
|
const getSetupTargets = (flags) => {
|
|
39
|
-
const explicitTargets = ["cursor", "claude", "codex", "gemini", "opencode"].filter((target) => flags[target] === true);
|
|
40
37
|
if (flags.all === true) {
|
|
41
|
-
return [
|
|
38
|
+
return [...ALL_TARGETS];
|
|
42
39
|
}
|
|
43
|
-
return
|
|
40
|
+
return ALL_TARGETS.filter((target) => flags[target] === true);
|
|
44
41
|
};
|
|
45
42
|
/**
|
|
46
43
|
* 创建 MCP 客户端(统一认证入口)
|
|
@@ -54,7 +51,7 @@ const getSetupTargets = (flags) => {
|
|
|
54
51
|
* - 无 token → 自动拉起浏览器登录
|
|
55
52
|
*/
|
|
56
53
|
const createSmartClient = (flags) => {
|
|
57
|
-
const serverUrl = getServerUrl(
|
|
54
|
+
const serverUrl = getServerUrl();
|
|
58
55
|
// 显式传了 token → 用简单客户端
|
|
59
56
|
const explicitToken = typeof flags.token === "string" ? flags.token : process.env.CRUSH_OAUTH_ACCESS_TOKEN || "";
|
|
60
57
|
if (explicitToken) {
|
|
@@ -116,7 +113,7 @@ const run = async () => {
|
|
|
116
113
|
const flags = parseFlags(rest);
|
|
117
114
|
switch (command) {
|
|
118
115
|
case "login": {
|
|
119
|
-
const serverUrl = getServerUrl(
|
|
116
|
+
const serverUrl = getServerUrl();
|
|
120
117
|
const client = new OAuthRemoteMcpClient({ serverUrl });
|
|
121
118
|
try {
|
|
122
119
|
await client.ensureAuthorized();
|
|
@@ -130,16 +127,15 @@ const run = async () => {
|
|
|
130
127
|
case "setup": {
|
|
131
128
|
const targets = getSetupTargets(flags);
|
|
132
129
|
if (targets.length === 0) {
|
|
133
|
-
throw new Error(
|
|
130
|
+
throw new Error(`Specify at least one setup target: ${ALL_TARGETS.map((t) => "--" + t).join(", ")}, or --all`);
|
|
134
131
|
}
|
|
135
132
|
const rawScope = typeof flags.scope === "string" ? flags.scope : "user";
|
|
136
133
|
if (rawScope !== "user" && rawScope !== "project") {
|
|
137
134
|
throw new Error("Invalid --scope. Expected 'user' or 'project'.");
|
|
138
135
|
}
|
|
139
136
|
const scope = rawScope;
|
|
140
|
-
const serverUrl = getServerUrl(flags);
|
|
141
137
|
for (const target of targets) {
|
|
142
|
-
const location = installClientConfig(target,
|
|
138
|
+
const location = installClientConfig(target, scope);
|
|
143
139
|
console.log(`[setup] ${target}: configured (${location})`);
|
|
144
140
|
}
|
|
145
141
|
return;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export type SetupTarget = "cursor" | "claude" | "codex" | "gemini" | "opencode";
|
|
1
|
+
export type SetupTarget = "cursor" | "claude" | "codex" | "gemini" | "opencode" | "vscode" | "windsurf" | "claude-desktop" | "warp";
|
|
2
2
|
export type SetupScope = "user" | "project";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const ALL_TARGETS: readonly SetupTarget[];
|
|
4
|
+
export declare const installClientConfig: (target: SetupTarget, scope: SetupScope) => string;
|
|
@@ -4,6 +4,18 @@ import os from "node:os";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
const SERVER_NAME = "crush-protocol";
|
|
6
6
|
const PACKAGE_NAME = "@crush-protocol/mcp-client";
|
|
7
|
+
const REMOTE_URL = "https://crush-mcp-ats.dev.xexlab.com/mcp";
|
|
8
|
+
export const ALL_TARGETS = [
|
|
9
|
+
"cursor",
|
|
10
|
+
"claude",
|
|
11
|
+
"codex",
|
|
12
|
+
"gemini",
|
|
13
|
+
"opencode",
|
|
14
|
+
"vscode",
|
|
15
|
+
"windsurf",
|
|
16
|
+
"claude-desktop",
|
|
17
|
+
"warp",
|
|
18
|
+
];
|
|
7
19
|
const ensureDir = (filePath) => {
|
|
8
20
|
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
9
21
|
};
|
|
@@ -21,37 +33,39 @@ const writeJson = (filePath, value) => {
|
|
|
21
33
|
ensureDir(filePath);
|
|
22
34
|
fs.writeFileSync(filePath, `${JSON.stringify(value, null, 2)}\n`, "utf8");
|
|
23
35
|
};
|
|
24
|
-
const createNpxConfig = (
|
|
36
|
+
const createNpxConfig = () => ({
|
|
25
37
|
command: "npx",
|
|
26
|
-
args: ["-y", PACKAGE_NAME
|
|
38
|
+
args: ["-y", PACKAGE_NAME],
|
|
27
39
|
});
|
|
40
|
+
// ─── Cursor ─────────────────────────────────────────────
|
|
28
41
|
const getCursorConfigPath = (scope) => scope === "project"
|
|
29
42
|
? path.join(process.cwd(), ".cursor", "mcp.json")
|
|
30
43
|
: path.join(os.homedir(), ".cursor", "mcp.json");
|
|
31
|
-
const
|
|
32
|
-
const getOpenCodeConfigPath = (scope) => scope === "project"
|
|
33
|
-
? path.join(process.cwd(), "opencode.json")
|
|
34
|
-
: path.join(os.homedir(), ".config", "opencode", "opencode.json");
|
|
35
|
-
const getCodexConfigPath = () => path.join(os.homedir(), ".codex", "config.toml");
|
|
36
|
-
const installCursor = (serverUrl, scope) => {
|
|
44
|
+
const installCursor = (scope) => {
|
|
37
45
|
const filePath = getCursorConfigPath(scope);
|
|
38
46
|
const config = readJson(filePath);
|
|
39
47
|
const mcpServers = (config.mcpServers ?? {});
|
|
40
|
-
mcpServers[SERVER_NAME] = createNpxConfig(
|
|
48
|
+
mcpServers[SERVER_NAME] = createNpxConfig();
|
|
41
49
|
config.mcpServers = mcpServers;
|
|
42
50
|
writeJson(filePath, config);
|
|
43
51
|
return filePath;
|
|
44
52
|
};
|
|
45
|
-
|
|
53
|
+
// ─── Gemini CLI ─────────────────────────────────────────
|
|
54
|
+
const getGeminiConfigPath = () => path.join(os.homedir(), ".gemini", "settings.json");
|
|
55
|
+
const installGemini = () => {
|
|
46
56
|
const filePath = getGeminiConfigPath();
|
|
47
57
|
const config = readJson(filePath);
|
|
48
58
|
const mcpServers = (config.mcpServers ?? {});
|
|
49
|
-
mcpServers[SERVER_NAME] = createNpxConfig(
|
|
59
|
+
mcpServers[SERVER_NAME] = createNpxConfig();
|
|
50
60
|
config.mcpServers = mcpServers;
|
|
51
61
|
writeJson(filePath, config);
|
|
52
62
|
return filePath;
|
|
53
63
|
};
|
|
54
|
-
|
|
64
|
+
// ─── OpenCode ───────────────────────────────────────────
|
|
65
|
+
const getOpenCodeConfigPath = (scope) => scope === "project"
|
|
66
|
+
? path.join(process.cwd(), "opencode.json")
|
|
67
|
+
: path.join(os.homedir(), ".config", "opencode", "opencode.json");
|
|
68
|
+
const installOpenCode = (scope) => {
|
|
55
69
|
const filePath = getOpenCodeConfigPath(scope);
|
|
56
70
|
const config = readJson(filePath);
|
|
57
71
|
const mcp = (config.mcp ?? {});
|
|
@@ -60,18 +74,20 @@ const installOpenCode = (serverUrl, scope) => {
|
|
|
60
74
|
}
|
|
61
75
|
mcp[SERVER_NAME] = {
|
|
62
76
|
type: "local",
|
|
63
|
-
command: ["npx", "-y", PACKAGE_NAME
|
|
77
|
+
command: ["npx", "-y", PACKAGE_NAME],
|
|
64
78
|
enabled: true,
|
|
65
79
|
};
|
|
66
80
|
config.mcp = mcp;
|
|
67
81
|
writeJson(filePath, config);
|
|
68
82
|
return filePath;
|
|
69
83
|
};
|
|
70
|
-
|
|
84
|
+
// ─── OpenAI Codex ───────────────────────────────────────
|
|
85
|
+
const getCodexConfigPath = () => path.join(os.homedir(), ".codex", "config.toml");
|
|
86
|
+
const installCodex = () => {
|
|
71
87
|
const filePath = getCodexConfigPath();
|
|
72
88
|
const section = `[mcp_servers.${SERVER_NAME}]
|
|
73
89
|
command = "npx"
|
|
74
|
-
args = ["-y", "${PACKAGE_NAME}"
|
|
90
|
+
args = ["-y", "${PACKAGE_NAME}"]
|
|
75
91
|
startup_timeout_ms = 20000
|
|
76
92
|
`;
|
|
77
93
|
ensureDir(filePath);
|
|
@@ -82,11 +98,12 @@ startup_timeout_ms = 20000
|
|
|
82
98
|
}
|
|
83
99
|
return filePath;
|
|
84
100
|
};
|
|
85
|
-
|
|
101
|
+
// ─── Claude Code CLI ────────────────────────────────────
|
|
102
|
+
const installClaude = (scope) => {
|
|
86
103
|
const configJson = JSON.stringify({
|
|
87
104
|
type: "stdio",
|
|
88
105
|
command: "npx",
|
|
89
|
-
args: ["-y", PACKAGE_NAME
|
|
106
|
+
args: ["-y", PACKAGE_NAME],
|
|
90
107
|
});
|
|
91
108
|
const result = spawnSync("claude", ["mcp", "add-json", "--scope", scope, SERVER_NAME, configJson], {
|
|
92
109
|
stdio: "pipe",
|
|
@@ -101,18 +118,91 @@ const installClaude = (serverUrl, scope) => {
|
|
|
101
118
|
}
|
|
102
119
|
return "claude-managed-config";
|
|
103
120
|
};
|
|
104
|
-
|
|
121
|
+
// ─── VS Code ────────────────────────────────────────────
|
|
122
|
+
const getVSCodeConfigPath = (scope) => scope === "project"
|
|
123
|
+
? path.join(process.cwd(), ".vscode", "mcp.json")
|
|
124
|
+
: path.join(os.homedir(), ".vscode", "mcp.json");
|
|
125
|
+
const installVSCode = (scope) => {
|
|
126
|
+
const filePath = getVSCodeConfigPath(scope);
|
|
127
|
+
const config = readJson(filePath);
|
|
128
|
+
const servers = (config.servers ?? {});
|
|
129
|
+
servers[SERVER_NAME] = {
|
|
130
|
+
type: "stdio",
|
|
131
|
+
command: "npx",
|
|
132
|
+
args: ["-y", PACKAGE_NAME],
|
|
133
|
+
};
|
|
134
|
+
config.servers = servers;
|
|
135
|
+
writeJson(filePath, config);
|
|
136
|
+
return filePath;
|
|
137
|
+
};
|
|
138
|
+
// ─── Windsurf ───────────────────────────────────────────
|
|
139
|
+
const getWindsurfConfigPath = () => path.join(os.homedir(), ".codeium", "windsurf", "mcp_config.json");
|
|
140
|
+
const installWindsurf = () => {
|
|
141
|
+
const filePath = getWindsurfConfigPath();
|
|
142
|
+
const config = readJson(filePath);
|
|
143
|
+
const mcpServers = (config.mcpServers ?? {});
|
|
144
|
+
mcpServers[SERVER_NAME] = createNpxConfig();
|
|
145
|
+
config.mcpServers = mcpServers;
|
|
146
|
+
writeJson(filePath, config);
|
|
147
|
+
return filePath;
|
|
148
|
+
};
|
|
149
|
+
// ─── Claude Desktop ─────────────────────────────────────
|
|
150
|
+
const getClaudeDesktopConfigPath = () => {
|
|
151
|
+
const platform = os.platform();
|
|
152
|
+
if (platform === "darwin") {
|
|
153
|
+
return path.join(os.homedir(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
154
|
+
}
|
|
155
|
+
if (platform === "win32") {
|
|
156
|
+
return path.join(process.env.APPDATA ?? path.join(os.homedir(), "AppData", "Roaming"), "Claude", "claude_desktop_config.json");
|
|
157
|
+
}
|
|
158
|
+
// Linux
|
|
159
|
+
return path.join(os.homedir(), ".config", "Claude", "claude_desktop_config.json");
|
|
160
|
+
};
|
|
161
|
+
const installClaudeDesktop = () => {
|
|
162
|
+
const filePath = getClaudeDesktopConfigPath();
|
|
163
|
+
const config = readJson(filePath);
|
|
164
|
+
const mcpServers = (config.mcpServers ?? {});
|
|
165
|
+
mcpServers[SERVER_NAME] = createNpxConfig();
|
|
166
|
+
config.mcpServers = mcpServers;
|
|
167
|
+
writeJson(filePath, config);
|
|
168
|
+
return filePath;
|
|
169
|
+
};
|
|
170
|
+
// ─── Warp ───────────────────────────────────────────────
|
|
171
|
+
const getWarpConfigPath = () => path.join(os.homedir(), ".warp", "mcp_config.json");
|
|
172
|
+
const installWarp = () => {
|
|
173
|
+
const filePath = getWarpConfigPath();
|
|
174
|
+
const config = readJson(filePath);
|
|
175
|
+
config[SERVER_NAME] = {
|
|
176
|
+
command: "npx",
|
|
177
|
+
args: ["-y", PACKAGE_NAME],
|
|
178
|
+
env: {},
|
|
179
|
+
working_directory: null,
|
|
180
|
+
start_on_launch: true,
|
|
181
|
+
};
|
|
182
|
+
writeJson(filePath, config);
|
|
183
|
+
return filePath;
|
|
184
|
+
};
|
|
185
|
+
// ─── Router ─────────────────────────────────────────────
|
|
186
|
+
export const installClientConfig = (target, scope) => {
|
|
105
187
|
switch (target) {
|
|
106
188
|
case "cursor":
|
|
107
|
-
return installCursor(
|
|
189
|
+
return installCursor(scope);
|
|
108
190
|
case "claude":
|
|
109
|
-
return installClaude(
|
|
191
|
+
return installClaude(scope);
|
|
110
192
|
case "codex":
|
|
111
|
-
return installCodex(
|
|
193
|
+
return installCodex();
|
|
112
194
|
case "gemini":
|
|
113
|
-
return installGemini(
|
|
195
|
+
return installGemini();
|
|
114
196
|
case "opencode":
|
|
115
|
-
return installOpenCode(
|
|
197
|
+
return installOpenCode(scope);
|
|
198
|
+
case "vscode":
|
|
199
|
+
return installVSCode(scope);
|
|
200
|
+
case "windsurf":
|
|
201
|
+
return installWindsurf();
|
|
202
|
+
case "claude-desktop":
|
|
203
|
+
return installClaudeDesktop();
|
|
204
|
+
case "warp":
|
|
205
|
+
return installWarp();
|
|
116
206
|
default:
|
|
117
207
|
throw new Error(`Unsupported setup target: ${target}`);
|
|
118
208
|
}
|