@tostudy-ai/mcp-setup 1.0.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 +149 -0
- package/bin/cli.js +6 -0
- package/dist/__tests__/e2e-diagnostic-repair-flow.test.d.ts +52 -0
- package/dist/__tests__/e2e-diagnostic-repair-flow.test.d.ts.map +1 -0
- package/dist/__tests__/e2e-diagnostic-repair-flow.test.js +720 -0
- package/dist/__tests__/e2e-diagnostic-repair-flow.test.js.map +1 -0
- package/dist/__tests__/e2e-wizard-flow.test.d.ts +43 -0
- package/dist/__tests__/e2e-wizard-flow.test.d.ts.map +1 -0
- package/dist/__tests__/e2e-wizard-flow.test.js +407 -0
- package/dist/__tests__/e2e-wizard-flow.test.js.map +1 -0
- package/dist/__tests__/ide-handlers.test.d.ts +10 -0
- package/dist/__tests__/ide-handlers.test.d.ts.map +1 -0
- package/dist/__tests__/ide-handlers.test.js +336 -0
- package/dist/__tests__/ide-handlers.test.js.map +1 -0
- package/dist/__tests__/install-command.test.d.ts +10 -0
- package/dist/__tests__/install-command.test.d.ts.map +1 -0
- package/dist/__tests__/install-command.test.js +237 -0
- package/dist/__tests__/install-command.test.js.map +1 -0
- package/dist/config.d.ts +51 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +117 -0
- package/dist/config.js.map +1 -0
- package/dist/detect.d.ts +42 -0
- package/dist/detect.d.ts.map +1 -0
- package/dist/detect.js +277 -0
- package/dist/detect.js.map +1 -0
- package/dist/diagnose.d.ts +36 -0
- package/dist/diagnose.d.ts.map +1 -0
- package/dist/diagnose.js +512 -0
- package/dist/diagnose.js.map +1 -0
- package/dist/ide-handlers/base.d.ts +36 -0
- package/dist/ide-handlers/base.d.ts.map +1 -0
- package/dist/ide-handlers/base.js +41 -0
- package/dist/ide-handlers/base.js.map +1 -0
- package/dist/ide-handlers/claude-code.d.ts +15 -0
- package/dist/ide-handlers/claude-code.d.ts.map +1 -0
- package/dist/ide-handlers/claude-code.js +50 -0
- package/dist/ide-handlers/claude-code.js.map +1 -0
- package/dist/ide-handlers/cursor.d.ts +15 -0
- package/dist/ide-handlers/cursor.d.ts.map +1 -0
- package/dist/ide-handlers/cursor.js +61 -0
- package/dist/ide-handlers/cursor.js.map +1 -0
- package/dist/ide-handlers/desktop.d.ts +16 -0
- package/dist/ide-handlers/desktop.d.ts.map +1 -0
- package/dist/ide-handlers/desktop.js +26 -0
- package/dist/ide-handlers/desktop.js.map +1 -0
- package/dist/ide-handlers/index.d.ts +21 -0
- package/dist/ide-handlers/index.d.ts.map +1 -0
- package/dist/ide-handlers/index.js +49 -0
- package/dist/ide-handlers/index.js.map +1 -0
- package/dist/ide-handlers/manual.d.ts +16 -0
- package/dist/ide-handlers/manual.d.ts.map +1 -0
- package/dist/ide-handlers/manual.js +34 -0
- package/dist/ide-handlers/manual.js.map +1 -0
- package/dist/ide-handlers/opencode.d.ts +15 -0
- package/dist/ide-handlers/opencode.d.ts.map +1 -0
- package/dist/ide-handlers/opencode.js +57 -0
- package/dist/ide-handlers/opencode.js.map +1 -0
- package/dist/ide-handlers/vscode.d.ts +16 -0
- package/dist/ide-handlers/vscode.d.ts.map +1 -0
- package/dist/ide-handlers/vscode.js +62 -0
- package/dist/ide-handlers/vscode.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +501 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts.d.ts +23 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +68 -0
- package/dist/prompts.js.map +1 -0
- package/dist/repair.d.ts +50 -0
- package/dist/repair.d.ts.map +1 -0
- package/dist/repair.js +588 -0
- package/dist/repair.js.map +1 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# @tostudy-ai/mcp-setup
|
|
2
|
+
|
|
3
|
+
CLI to configure Claude Code to connect to the Catalyst MCP server.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @tostudy-ai/mcp-setup
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Commands
|
|
12
|
+
|
|
13
|
+
### Default Setup
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx @tostudy-ai/mcp-setup # Interactive setup
|
|
17
|
+
npx @tostudy-ai/mcp-setup --api-key <key> # Setup with API key
|
|
18
|
+
npx @tostudy-ai/mcp-setup --url <url> # Custom platform URL
|
|
19
|
+
npx @tostudy-ai/mcp-setup --uninstall # Remove configuration
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Wizard (Step-by-Step)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx @tostudy-ai/mcp-setup wizard # Interactive wizard
|
|
26
|
+
npx @tostudy-ai/mcp-setup wizard --api-key <key> # Wizard with API key
|
|
27
|
+
npx @tostudy-ai/mcp-setup wizard --url <url> # Custom platform URL
|
|
28
|
+
npx @tostudy-ai/mcp-setup wizard --skip-diagnostics # Skip verification step
|
|
29
|
+
npx @tostudy-ai/mcp-setup wizard --auto-repair # Auto-fix detected issues
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The wizard guides through 4 steps:
|
|
33
|
+
1. Environment detection (Claude Code, IDEs)
|
|
34
|
+
2. API key configuration and validation
|
|
35
|
+
3. Save configuration
|
|
36
|
+
4. Diagnostics and verification
|
|
37
|
+
|
|
38
|
+
### Diagnose
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx @tostudy-ai/mcp-setup diagnose # Run diagnostics
|
|
42
|
+
npx @tostudy-ai/mcp-setup diagnose --json # JSON output
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Exits with code 1 if issues are found.
|
|
46
|
+
|
|
47
|
+
### Repair
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npx @tostudy-ai/mcp-setup repair # Auto-repair issues
|
|
51
|
+
npx @tostudy-ai/mcp-setup repair --api-key <key> # Repair with API key
|
|
52
|
+
npx @tostudy-ai/mcp-setup repair --url <url> # Custom platform URL
|
|
53
|
+
npx @tostudy-ai/mcp-setup repair --json # JSON output
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Install (Non-Interactive)
|
|
57
|
+
|
|
58
|
+
Used by the web setup wizard to configure a specific IDE in a single command:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npx @tostudy-ai/mcp-setup install --ide <ide> --key <key>
|
|
62
|
+
npx @tostudy-ai/mcp-setup install --ide cursor --key <key>
|
|
63
|
+
npx @tostudy-ai/mcp-setup install --ide vscode --key <key> --url http://localhost:3700
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Supported IDEs: `claude-code`, `cursor`, `vscode`, `desktop`, `opencode`, `manual`
|
|
67
|
+
|
|
68
|
+
| IDE | Config Location | Config Key |
|
|
69
|
+
|-----|----------------|------------|
|
|
70
|
+
| `claude-code` | Terminal (`claude mcp add`) | N/A |
|
|
71
|
+
| `cursor` | `~/.cursor/mcp.json` | `mcpServers` |
|
|
72
|
+
| `vscode` | `.vscode/mcp.json` | `servers` |
|
|
73
|
+
| `desktop` | Claude Desktop config | `mcpServers` |
|
|
74
|
+
| `opencode` | `~/.opencode/opencode.json` | `mcp` |
|
|
75
|
+
| `manual` | stdout (prints config) | N/A |
|
|
76
|
+
|
|
77
|
+
Each handler reads-then-merges config to preserve other MCP servers.
|
|
78
|
+
|
|
79
|
+
### Setup via Environment Variable
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
export TOSTUDY_API_KEY="your-api-key"
|
|
83
|
+
export TOSTUDY_PLATFORM_URL="https://tostudy.com" # optional
|
|
84
|
+
npx @tostudy-ai/mcp-setup
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Environment Variables
|
|
88
|
+
|
|
89
|
+
| Variable | Description | Default |
|
|
90
|
+
|----------|-------------|---------|
|
|
91
|
+
| `TOSTUDY_API_KEY` | Platform API key | - |
|
|
92
|
+
| `TOSTUDY_PLATFORM_URL` | Platform URL | `https://tostudy.com` |
|
|
93
|
+
|
|
94
|
+
## Getting Your API Key
|
|
95
|
+
|
|
96
|
+
1. Go to [tostudy.com/student/settings/mcp](https://tostudy.com/student/settings/mcp)
|
|
97
|
+
2. The setup wizard auto-detects your OS
|
|
98
|
+
3. Choose your IDE (step 2)
|
|
99
|
+
4. An API key is generated automatically (step 3)
|
|
100
|
+
5. Copy the `npx` command and run it in your terminal
|
|
101
|
+
|
|
102
|
+
## What the CLI Does
|
|
103
|
+
|
|
104
|
+
The CLI modifies the Claude Code configuration file:
|
|
105
|
+
|
|
106
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
107
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
108
|
+
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
|
|
109
|
+
|
|
110
|
+
Adds the following configuration:
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"mcpServers": {
|
|
115
|
+
"tostudy": {
|
|
116
|
+
"command": "npx",
|
|
117
|
+
"args": ["-y", "@tostudy-ai/mcp-server"],
|
|
118
|
+
"env": {
|
|
119
|
+
"TOSTUDY_API_KEY": "your-api-key",
|
|
120
|
+
"TOSTUDY_PLATFORM_URL": "https://tostudy.com"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## After Setup
|
|
128
|
+
|
|
129
|
+
1. Restart Claude Code
|
|
130
|
+
2. The MCP server will start automatically
|
|
131
|
+
3. Use `/courses` to see your enrolled courses
|
|
132
|
+
|
|
133
|
+
## Scripts
|
|
134
|
+
|
|
135
|
+
| Command | Description |
|
|
136
|
+
|---------|-------------|
|
|
137
|
+
| `pnpm build` | Build CLI |
|
|
138
|
+
| `pnpm type-check` | TypeScript validation |
|
|
139
|
+
| `pnpm test` | Run wizard e2e test |
|
|
140
|
+
| `pnpm test:e2e` | Run shell e2e test |
|
|
141
|
+
| `pnpm test:diagnostic-repair` | Run diagnostic/repair e2e test |
|
|
142
|
+
| `pnpm test:ide-handlers` | Run IDE handler unit tests |
|
|
143
|
+
| `pnpm test:install` | Run install command unit tests |
|
|
144
|
+
| `pnpm test:all` | Run all tests |
|
|
145
|
+
|
|
146
|
+
## Support
|
|
147
|
+
|
|
148
|
+
- Documentation: [tostudy.com/docs/mcp](https://tostudy.com/docs/mcp)
|
|
149
|
+
- Support: support@tostudy.com
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E2E Test: Diagnostic and Repair Flow
|
|
3
|
+
*
|
|
4
|
+
* This test verifies the end-to-end diagnostic and repair flow:
|
|
5
|
+
* 1. Simulate common issues (port conflict, missing config, invalid JSON, etc.)
|
|
6
|
+
* 2. Run mcp-setup diagnose command
|
|
7
|
+
* 3. Verify issue detected with clear description
|
|
8
|
+
* 4. Run mcp-setup repair command
|
|
9
|
+
* 5. Verify issue fixed and MCP configuration is valid
|
|
10
|
+
*
|
|
11
|
+
* NOTE: Port conflict tests require elevated permissions on some systems.
|
|
12
|
+
* Run with: npx tsx src/__tests__/e2e-diagnostic-repair-flow.test.ts
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Step 1: Test detection of missing config file
|
|
16
|
+
*/
|
|
17
|
+
declare function testMissingConfigDetection(): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Step 2: Test detection of invalid JSON config
|
|
20
|
+
*/
|
|
21
|
+
declare function testInvalidJsonDetection(): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Step 3: Test detection of missing MCP configuration
|
|
24
|
+
*/
|
|
25
|
+
declare function testMissingMcpConfigDetection(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Step 4: Test detection of API key issues
|
|
28
|
+
*/
|
|
29
|
+
declare function testApiKeyIssuesDetection(): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Step 5: Test detection of server URL issues
|
|
32
|
+
*/
|
|
33
|
+
declare function testServerUrlIssuesDetection(): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Step 6: Test detection of duplicate servers
|
|
36
|
+
*/
|
|
37
|
+
declare function testDuplicateServersDetection(): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Step 7: Test port conflict detection
|
|
40
|
+
*/
|
|
41
|
+
declare function testPortConflictDetection(): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Step 8: Complete diagnostic and repair flow
|
|
44
|
+
*/
|
|
45
|
+
declare function testCompleteFlow(): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Step 9: Test issue helper functions
|
|
48
|
+
*/
|
|
49
|
+
declare function testHelperFunctions(): Promise<void>;
|
|
50
|
+
declare function main(): Promise<void>;
|
|
51
|
+
export { testMissingConfigDetection, testInvalidJsonDetection, testMissingMcpConfigDetection, testApiKeyIssuesDetection, testServerUrlIssuesDetection, testDuplicateServersDetection, testPortConflictDetection, testCompleteFlow, testHelperFunctions, main as runDiagnosticRepairE2ETests, };
|
|
52
|
+
//# sourceMappingURL=e2e-diagnostic-repair-flow.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e2e-diagnostic-repair-flow.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/e2e-diagnostic-repair-flow.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA2RH;;GAEG;AACH,iBAAe,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC,CAuCzD;AAED;;GAEG;AACH,iBAAe,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC,CA4CvD;AAED;;GAEG;AACH,iBAAe,6BAA6B,IAAI,OAAO,CAAC,IAAI,CAAC,CA0C5D;AAED;;GAEG;AACH,iBAAe,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAkDxD;AAED;;GAEG;AACH,iBAAe,4BAA4B,IAAI,OAAO,CAAC,IAAI,CAAC,CAwD3D;AAED;;GAEG;AACH,iBAAe,6BAA6B,IAAI,OAAO,CAAC,IAAI,CAAC,CAoC5D;AAED;;GAEG;AACH,iBAAe,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAmCxD;AAED;;GAEG;AACH,iBAAe,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAoF/C;AAED;;GAEG;AACH,iBAAe,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CA4ElD;AAsCD,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAwCnC;AAQD,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,6BAA6B,EAC7B,yBAAyB,EACzB,4BAA4B,EAC5B,6BAA6B,EAC7B,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,IAAI,IAAI,2BAA2B,GACpC,CAAC"}
|