Skip to content

Commit 84e5152

Browse files
authored
Add option to pass guard (#22)
1 parent cf6cd26 commit 84e5152

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Commands/LoopMcpServerStartCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class LoopMcpServerStartCommand extends Command
1919
protected $signature = 'loop:mcp:start
2020
{--user-id= : The user ID to authenticate the requests with}
2121
{--user-model= : The model to use to authenticate the requests with}
22+
{--auth-guard= : The Auth guard to use to authenticate the requests with}
2223
{--debug : Enable debug mode}';
2324

2425
protected $description = 'Run the Laravel Loop MCP server';
@@ -30,6 +31,7 @@ public function handle(McpHandler $mcpHandler): int
3031
}
3132

3233
if ($this->option('user-id')) {
34+
$authGuard = $this->option('auth-guard') ?? config('auth.defaults.guard');
3335
$userModel = $this->option('user-model') ?? 'App\\Models\\User';
3436
$user = $userModel::find($this->option('user-id'));
3537

@@ -39,7 +41,7 @@ public function handle(McpHandler $mcpHandler): int
3941
return Command::FAILURE;
4042
}
4143

42-
Auth::login($user);
44+
Auth::guard($authGuard)->login($user);
4345

4446
if ($this->option('debug')) {
4547
$this->debug(sprintf('Authenticated with user ID %s', $this->option('user-id')));

0 commit comments

Comments
 (0)