mlgym-deploy 2.10.0 → 3.0.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.
@@ -0,0 +1,285 @@
1
+ # MCP v3.0.0 - Monolithic Workflow Architecture
2
+
3
+ ## Release Date
4
+ 2025-11-02
5
+
6
+ ## Breaking Changes
7
+
8
+ ### ❌ Removed 7 Atomic Tools
9
+
10
+ The following tools have been **completely removed**:
11
+ - `mlgym_auth_status` - replaced by `mlgym_status`
12
+ - `mlgym_authenticate` - now handled internally by `mlgym_deploy`
13
+ - `mlgym_project_analyze` - now handled internally by `mlgym_deploy`
14
+ - `mlgym_project_status` - replaced by `mlgym_status`
15
+ - `mlgym_project_init` - replaced by `mlgym_deploy`
16
+ - `mlgym_project_prepare` - now handled internally by `mlgym_deploy`
17
+ - `mlgym_smart_deploy` - replaced by `mlgym_deploy`
18
+
19
+ ### ✅ Added 2 Monolithic Tools
20
+
21
+ #### 1. `mlgym_deploy` (Primary Tool)
22
+ Complete deployment workflow in a single call.
23
+
24
+ **What it does internally:**
25
+ 1. Checks cached authentication (or authenticates with provided credentials)
26
+ 2. Analyzes project to detect type/framework
27
+ 3. Checks if project already exists
28
+ 4. Generates Dockerfile if needed
29
+ 5. Creates GitLab project
30
+ 6. Configures Coolify deployment
31
+ 7. Pushes code and monitors deployment
32
+
33
+ **Required Parameters:**
34
+ - `project_name` - Project name (lowercase, hyphens allowed)
35
+ - `project_description` - Description (min 10 chars)
36
+
37
+ **Optional Parameters:**
38
+ - `email` - Email (optional if already authenticated)
39
+ - `password` - Password (optional if already authenticated)
40
+ - `hostname` - Deployment hostname (defaults to project_name)
41
+ - `local_path` - Project directory (defaults to current directory)
42
+ - `project_type` - Override auto-detection (nodejs/python/static/go)
43
+ - `framework` - Override auto-detection (nextjs/express/react/vue/flask/fastapi/html)
44
+ - `package_manager` - Package manager (npm/yarn, defaults to npm)
45
+
46
+ **Example Usage:**
47
+ ```javascript
48
+ mlgym_deploy({
49
+ project_name: "my-app",
50
+ project_description: "My awesome application",
51
+ email: "user@example.com", // Optional if cached
52
+ password: "pass123", // Optional if cached
53
+ hostname: "myapp" // Optional, defaults to project_name
54
+ })
55
+ ```
56
+
57
+ #### 2. `mlgym_status` (Read-Only Tool)
58
+ Check current authentication and project configuration status.
59
+
60
+ **Parameters:**
61
+ - `local_path` - Directory to check (optional, defaults to current directory)
62
+
63
+ **Returns:**
64
+ - Authentication status (authenticated, email)
65
+ - Project configuration (configured, name, namespace, git_remote)
66
+ - Project analysis (type, framework, has_dockerfile)
67
+
68
+ ---
69
+
70
+ ## Architecture Changes
71
+
72
+ ### Before (v2.10.0) - Atomic Tools
73
+ ```
74
+ AI orchestrates 7 separate tools
75
+
76
+ AI decides which tool to call next
77
+
78
+ AI interprets each response
79
+
80
+ AI makes next decision
81
+
82
+ 35+ AI decision points
83
+ ```
84
+
85
+ **Problems:**
86
+ - AI loses context across multi-turn conversations
87
+ - AI makes probabilistic decisions (unreliable)
88
+ - 5-10 user interactions required
89
+ - ~60% success rate
90
+
91
+ ### After (v3.0.0) - Monolithic Workflow
92
+ ```
93
+ AI gathers all parameters from user
94
+
95
+ AI calls mlgym_deploy once
96
+
97
+ Server executes entire workflow internally
98
+
99
+ Server returns final result
100
+
101
+ 3 AI decision points
102
+ ```
103
+
104
+ **Benefits:**
105
+ - Server maintains state throughout workflow
106
+ - Deterministic execution (like CLI)
107
+ - 1-2 user interactions required
108
+ - ~90%+ expected success rate
109
+
110
+ ---
111
+
112
+ ## Implementation Details
113
+
114
+ ### New DeploymentWorkflow Class
115
+ Server-side state machine that manages the entire deployment process:
116
+
117
+ ```javascript
118
+ class DeploymentWorkflow {
119
+ - currentStep: tracks current workflow step
120
+ - authToken: maintains authentication
121
+ - projectAnalysis: caches project detection
122
+ - gitlabProject: stores created project
123
+ - steps: detailed execution log
124
+
125
+ Methods:
126
+ - ensureAuth(): handles authentication (cached or new)
127
+ - analyzeProject(): detects project type/framework
128
+ - checkExisting(): verifies if project already exists
129
+ - prepareProject(): generates Dockerfile if needed
130
+ - createAndDeployProject(): creates GitLab + Coolify resources
131
+ - getRecoverySuggestion(): provides helpful error guidance
132
+ }
133
+ ```
134
+
135
+ ### Execution Flow
136
+
137
+ **mlgym_deploy() function:**
138
+ 1. Creates DeploymentWorkflow instance
139
+ 2. Calls workflow.ensureAuth(email, password)
140
+ 3. Calls workflow.checkExisting(local_path)
141
+ 4. Returns early if project exists
142
+ 5. Calls workflow.analyzeProject(local_path)
143
+ 6. Calls workflow.prepareProject(type, framework)
144
+ 7. Calls workflow.createAndDeployProject(params)
145
+ 8. Returns comprehensive result with all workflow steps
146
+
147
+ **All operations are atomic** - if any step fails, workflow stops and returns detailed error with:
148
+ - Error message
149
+ - Failed step name
150
+ - Recovery suggestion
151
+ - Complete workflow log
152
+
153
+ ---
154
+
155
+ ## Comparison to CLI
156
+
157
+ | Aspect | CLI v2.0.9 | MCP v2.10.0 (Old) | MCP v3.0.0 (New) |
158
+ |--------|------------|-------------------|------------------|
159
+ | **Tools/Commands** | 1 | 7 | 2 |
160
+ | **User Interactions** | 1 | 5-10 | 1-2 |
161
+ | **AI Decision Points** | N/A | 35+ | 3 |
162
+ | **State Management** | In-process | AI memory | Server-side |
163
+ | **Success Rate** | 99% | 60% | 90%+ |
164
+ | **Matches CLI UX** | - | No | Yes |
165
+
166
+ ---
167
+
168
+ ## Migration Guide
169
+
170
+ ### For AI Systems (Cursor/Claude)
171
+
172
+ **Old Workflow (v2.10.0):**
173
+ ```
174
+ 1. Call mlgym_auth_status
175
+ 2. Call mlgym_authenticate if needed
176
+ 3. Call mlgym_project_analyze
177
+ 4. Call mlgym_project_status
178
+ 5. Call mlgym_project_init with gathered params
179
+ 6. Handle errors at each step
180
+ ```
181
+
182
+ **New Workflow (v3.0.0):**
183
+ ```
184
+ 1. Ask user for project_name and project_description
185
+ 2. Ask for email/password if not cached
186
+ 3. Call mlgym_deploy with all params
187
+ 4. Done!
188
+ ```
189
+
190
+ ### For Users
191
+
192
+ **No changes required!**
193
+
194
+ The new version is more reliable and requires fewer interactions. Simply tell the AI what you want to deploy:
195
+
196
+ > "Deploy my app as 'my-project' - it's a test application"
197
+
198
+ The AI will gather the minimal required information and call `mlgym_deploy` once.
199
+
200
+ ---
201
+
202
+ ## Benefits Summary
203
+
204
+ ### ✅ Reduced Complexity
205
+ - **7 tools → 2 tools** (71% reduction)
206
+ - **35+ decision points → 3 decision points** (91% reduction)
207
+ - **5-10 interactions → 1-2 interactions** (80% reduction)
208
+
209
+ ### ✅ Improved Reliability
210
+ - Server-side state management (no AI memory issues)
211
+ - Atomic workflows (all-or-nothing execution)
212
+ - Deterministic behavior (same input = same output)
213
+ - Better error handling with recovery suggestions
214
+
215
+ ### ✅ Better UX
216
+ - Faster deployments (fewer round-trips)
217
+ - Clearer error messages
218
+ - Matches CLI abstraction level
219
+ - Comprehensive workflow logging
220
+
221
+ ---
222
+
223
+ ## Technical Notes
224
+
225
+ ### Backward Compatibility
226
+ **None.** This is a breaking release (v2 → v3).
227
+
228
+ Old tools are completely removed. Users must upgrade to v3.0.0 and use new tools.
229
+
230
+ ### Dependencies
231
+ No changes. Still uses:
232
+ - `@modelcontextprotocol/sdk`: ^0.6.0
233
+ - `axios`: ^1.6.0
234
+
235
+ ### Testing
236
+ Syntax validated with `node --check index.js` ✅
237
+
238
+ Recommended testing:
239
+ 1. Test mlgym_status with existing project
240
+ 2. Test mlgym_deploy with new project
241
+ 3. Test mlgym_deploy with cached authentication
242
+ 4. Test error recovery (invalid hostname, missing params, etc.)
243
+
244
+ ---
245
+
246
+ ## Files Modified
247
+
248
+ 1. **mcp-server/index.js**
249
+ - Bumped version to 3.0.0
250
+ - Added DeploymentWorkflow class (175 lines)
251
+ - Added deployProject() function (95 lines)
252
+ - Added getStatus() function (55 lines)
253
+ - Removed 7 old tool definitions
254
+ - Added 2 new tool definitions
255
+ - Updated tool execution handler
256
+
257
+ 2. **mcp-server/package.json**
258
+ - Version: 2.10.0 → 3.0.0
259
+ - Updated description
260
+ - Updated mcp.tools metadata
261
+
262
+ 3. **mcp-server/index.js.backup-atomic**
263
+ - Created backup of v2.10.0 for reference
264
+
265
+ ---
266
+
267
+ ## Rationale
268
+
269
+ See [Why CLI Works Perfectly vs MCP Struggles.md](../Why CLI Works Perfectly vs MCP Struggles.md) for detailed analysis of why this architectural change was necessary.
270
+
271
+ **TL;DR:** The previous atomic tool approach required AI to orchestrate 7 separate tools across multiple conversations, leading to context loss and unreliable behavior. The new monolithic approach moves orchestration server-side, reducing AI to simple parameter gathering + single tool invocation.
272
+
273
+ ---
274
+
275
+ ## Credits
276
+
277
+ **Architecture Design:** Analysis of CLI reliability vs MCP struggles
278
+ **Implementation:** MCP v3.0.0 monolithic workflow
279
+ **Inspiration:** CLI's deterministic execution model
280
+
281
+ ---
282
+
283
+ **Version:** 3.0.0
284
+ **Status:** ✅ Ready for Testing
285
+ **Next Steps:** Deploy to production after validation