@@ -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,50 @@ 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 ' ,
153
+ 'args ' => [
154
+ "{$ projectPath }/artisan " ,
155
+ 'loop:mcp:start ' ,
156
+ ...$ args ,
157
+ ],
158
+ ];
159
+
160
+ $ configJson = json_encode ($ config , JSON_UNESCAPED_SLASHES );
161
+
162
+ if ($ configJson ) {
163
+ $ configBase64 = base64_encode ($ configJson );
164
+ $ deeplink = "cursor://anysphere.cursor-deeplink/mcp/install?name=laravel-loop-mcp&config= {$ configBase64 }" ;
165
+ $ this ->info ('🎯🎯🎯 Cursor Deeplink: 🎯🎯🎯 ' );
166
+
167
+ $ this ->newLine ();
168
+
169
+ $ this ->table ([], [[$ deeplink ]]);
170
+
171
+ $ this ->newLine ();
172
+ $ this ->comment ('💡 Click on the link above or copy and paste it into your browser to install the MCP server in Cursor. ' );
173
+ }
174
+
175
+ $ this ->newLine ();
176
+ $ this ->comment ('📋 You can copy the following JSON configuration: ' );
177
+ $ this ->newLine ();
178
+
179
+ $ this ->table ([], [[
180
+ json_encode (['laravel-loop-mcp ' => $ config ], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ),
181
+ ]]);
182
+ }
183
+
136
184
private function generateJsonConfig (string $ projectPath , ?string $ userId , ?string $ userModel ): void
137
185
{
138
186
$ args = [
@@ -190,6 +238,51 @@ private function generateClaudeCodeHttpConfig(string $baseUrl, string $ssePath):
190
238
$ this ->additionalHttpSetupMessages ();
191
239
}
192
240
241
+ private function generateCursorHttpDeeplink (string $ baseUrl , string $ ssePath ): void
242
+ {
243
+ $ headers = $ this ->collectHeaders ();
244
+
245
+ $ config = [
246
+ 'transport ' => 'sse ' ,
247
+ 'url ' => rtrim ($ baseUrl , '/ ' ).$ ssePath ,
248
+ ];
249
+
250
+ if (! empty ($ headers )) {
251
+ $ config ['headers ' ] = [];
252
+ foreach ($ headers as $ header ) {
253
+ $ parts = explode (': ' , $ header , 2 );
254
+ if (count ($ parts ) === 2 ) {
255
+ $ config ['headers ' ][trim ($ parts [0 ])] = trim ($ parts [1 ]);
256
+ }
257
+ }
258
+ }
259
+
260
+ $ configJson = json_encode ($ config , JSON_UNESCAPED_SLASHES );
261
+ if ($ configJson ) {
262
+ $ configBase64 = base64_encode ($ configJson );
263
+ $ deeplink = "cursor://anysphere.cursor-deeplink/mcp/install?name=laravel-loop-mcp&config= {$ configBase64 }" ;
264
+
265
+ $ this ->comment ('🎯🎯🎯 Cursor HTTP + SSE Deeplink Configuration: 🎯🎯🎯 ' );
266
+ $ this ->newLine ();
267
+
268
+ $ this ->table ([], [[$ deeplink ]]);
269
+
270
+ $ this ->newLine ();
271
+ $ this ->comment ('💡 Click on the link above or copy and paste it into your browser to install the MCP server in Cursor. ' );
272
+ }
273
+
274
+ $ this ->newLine ();
275
+ $ this ->comment ('📋 You can copy the following JSON configuration: ' );
276
+ $ this ->newLine ();
277
+
278
+ $ this ->table ([], [[
279
+ json_encode (['laravel-loop-mcp ' => $ config ], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ),
280
+ ]]);
281
+
282
+ $ this ->newLine ();
283
+ $ this ->additionalHttpSetupMessages ();
284
+ }
285
+
193
286
/**
194
287
* @return array<string>
195
288
*/
0 commit comments