@@ -87,6 +87,8 @@ private function generateStdioConfig(Providers $provider): void
87
87
88
88
if ($ provider === Providers::ClaudeCode) {
89
89
$ this ->generateClaudeCodeCommand ($ projectPath , $ userId , $ userModel );
90
+ } elseif ($ provider === Providers::Cursor) {
91
+ $ this ->generateCursorDeeplink ($ projectPath , $ userId , $ userModel );
90
92
} else {
91
93
$ this ->generateJsonConfig ($ projectPath , $ userId , $ userModel );
92
94
}
@@ -108,6 +110,8 @@ private function generateHttpSseConfig(Providers $provider): void
108
110
109
111
if ($ provider === Providers::ClaudeCode) {
110
112
$ this ->generateClaudeCodeHttpConfig ($ baseUrl , $ ssePath );
113
+ } elseif ($ provider === Providers::Cursor) {
114
+ $ this ->generateCursorHttpDeeplink ($ baseUrl , $ ssePath );
111
115
} else {
112
116
$ this ->generateJsonHttpConfig ($ provider , $ baseUrl , $ ssePath );
113
117
}
@@ -133,6 +137,42 @@ private function generateClaudeCodeCommand(string $projectPath, ?string $userId,
133
137
$ this ->comment ('💡 Copy and paste this command in your terminal to add the MCP server to Claude Code. ' );
134
138
}
135
139
140
+ private function generateCursorDeeplink (string $ projectPath , ?string $ userId , ?string $ userModel ): void
141
+ {
142
+ $ args = [];
143
+
144
+ if ($ userId ) {
145
+ $ args [] = "--user-id= {$ userId }" ;
146
+ if ($ userModel && $ userModel !== 'App \\Models \\User ' ) {
147
+ $ args [] = "--user-model= {$ userModel }" ;
148
+ }
149
+ }
150
+
151
+ $ config = [
152
+ 'command ' => "php {$ projectPath }/artisan loop:mcp:start " ,
153
+ 'args ' => $ args ,
154
+ ];
155
+
156
+ $ configJson = json_encode ($ config , JSON_UNESCAPED_SLASHES );
157
+ $ configBase64 = base64_encode ($ configJson );
158
+ $ deeplink = "cursor://anysphere.cursor-deeplink/mcp/install?name=laravel-loop-mcp&config= {$ configBase64 }" ;
159
+
160
+ $ this ->info ('🎯🎯🎯 Cursor Deeplink: 🎯🎯🎯 ' );
161
+ $ this ->newLine ();
162
+
163
+ $ this ->table ([], [[$ deeplink ]]);
164
+
165
+ $ this ->newLine ();
166
+ $ this ->comment ('💡 Click on the link above or copy and paste it into your browser to install the MCP server in Cursor. ' );
167
+ $ this ->newLine ();
168
+ $ this ->comment ('📋 Alternatively, you can copy the following JSON configuration manually: ' );
169
+ $ this ->newLine ();
170
+
171
+ $ this ->table ([], [[
172
+ json_encode (['laravel-loop-mcp ' => $ config ], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES )
173
+ ]]);
174
+ }
175
+
136
176
private function generateJsonConfig (string $ projectPath , ?string $ userId , ?string $ userModel ): void
137
177
{
138
178
$ args = [
@@ -159,9 +199,7 @@ private function generateJsonConfig(string $projectPath, ?string $userId, ?strin
159
199
$ this ->comment ('🎯🎯🎯 Please copy the following JSON configuration to your MCP client configuration file. 🎯🎯🎯 ' );
160
200
$ this ->newLine ();
161
201
162
- $ this ->table ([], [[
163
- json_encode ($ config , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ),
164
- ]]);
202
+ $ this ->line (json_encode ($ config , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ));
165
203
166
204
$ this ->newLine ();
167
205
$ this ->newLine ();
@@ -190,6 +228,48 @@ private function generateClaudeCodeHttpConfig(string $baseUrl, string $ssePath):
190
228
$ this ->additionalHttpSetupMessages ();
191
229
}
192
230
231
+ private function generateCursorHttpDeeplink (string $ baseUrl , string $ ssePath ): void
232
+ {
233
+ $ headers = $ this ->collectHeaders ();
234
+
235
+ $ config = [
236
+ 'transport ' => 'sse ' ,
237
+ 'url ' => rtrim ($ baseUrl , '/ ' ).$ ssePath ,
238
+ ];
239
+
240
+ if (!empty ($ headers )) {
241
+ $ config ['headers ' ] = [];
242
+ foreach ($ headers as $ header ) {
243
+ $ parts = explode (': ' , $ header , 2 );
244
+ if (count ($ parts ) === 2 ) {
245
+ $ config ['headers ' ][trim ($ parts [0 ])] = trim ($ parts [1 ]);
246
+ }
247
+ }
248
+ }
249
+
250
+ $ configJson = json_encode ($ config , JSON_UNESCAPED_SLASHES );
251
+ $ configBase64 = base64_encode ($ configJson );
252
+ $ deeplink = "cursor://anysphere.cursor-deeplink/mcp/install?name=laravel-loop-mcp&config= {$ configBase64 }" ;
253
+
254
+ $ this ->comment ('🎯🎯🎯 Cursor HTTP + SSE Deeplink Configuration: 🎯🎯🎯 ' );
255
+ $ this ->newLine ();
256
+
257
+ $ this ->table ([], [[$ deeplink ]]);
258
+
259
+ $ this ->newLine ();
260
+ $ this ->comment ('💡 Click on the link above or copy and paste it into your browser to install the MCP server in Cursor. ' );
261
+ $ this ->newLine ();
262
+ $ this ->comment ('📋 Alternatively, you can copy the following JSON configuration manually: ' );
263
+ $ this ->newLine ();
264
+
265
+ $ this ->table ([], [[
266
+ json_encode (['laravel-loop-mcp ' => $ config ], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES )
267
+ ]]);
268
+
269
+ $ this ->newLine ();
270
+ $ this ->additionalHttpSetupMessages ();
271
+ }
272
+
193
273
/**
194
274
* @return array<string>
195
275
*/
@@ -273,9 +353,7 @@ private function generateJsonHttpConfigWithProxy(string $baseUrl, array $headers
273
353
$ this ->comment ('🎯🎯🎯 Please copy the following JSON configuration to your MCP client configuration file. 🎯🎯🎯 ' );
274
354
$ this ->newLine ();
275
355
276
- $ this ->table ([], [[
277
- json_encode ($ config , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ),
278
- ]]);
356
+ $ this ->line (json_encode ($ config , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ));
279
357
280
358
$ this ->newLine ();
281
359
$ this ->additionalHttpSetupMessages ();
@@ -300,9 +378,7 @@ private function generateJsonHttpConfigFirstPartySupport(string $baseUrl, string
300
378
$ this ->comment ('🎯🎯🎯 Please copy the following JSON configuration to your MCP client configuration file. 🎯🎯🎯 ' );
301
379
$ this ->newLine ();
302
380
303
- $ this ->table ([], [[
304
- json_encode ($ config , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ),
305
- ]]);
381
+ $ this ->line (json_encode ($ config , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ));
306
382
307
383
$ this ->newLine ();
308
384
$ this ->newLine ();
0 commit comments