Add OAuth functionality, MCP tools, and feature tests

- 🔒 Added migrations for `oauth_access_tokens`, `oauth_refresh_tokens`, `oauth_auth_codes`, `oauth_clients`, and `oauth_device_codes`.
- 🤖 Created MCP tools (Meetups, Cities, Venues, Courses, Lecturers) for managing entities with authentication and validation.
- 🛠️ Implemented Passport-backed OAuth API guard configuration and validation endpoints.
-  Added comprehensive feature tests for MCP tools and OAuth functionality (access control, validation, and token-based authentication).
This commit is contained in:
HolgerHatGarKeineNode
2026-06-08 09:37:00 +02:00
parent 3cad5f5636
commit d0544bfac9
67 changed files with 3948 additions and 83 deletions
@@ -0,0 +1,48 @@
<?php
namespace App\Mcp\Tools\CourseEvent;
use App\Models\CourseEvent;
use Illuminate\Contracts\JsonSchema\JsonSchema;
use Illuminate\JsonSchema\Types\Type;
use Laravel\Mcp\Request;
use Laravel\Mcp\Response;
use Laravel\Mcp\Server\Attributes\Description;
use Laravel\Mcp\Server\Tool;
use Laravel\Mcp\Server\Tools\Annotations\IsReadOnly;
#[IsReadOnly]
#[Description('Listet alle vom authentifizierten Nutzer erstellten Kurs-Events (inkl. Kurs und Veranstaltungsort), absteigend nach Startdatum. Optional nach Kurs filterbar.')]
class ListMyCourseEventsTool extends Tool
{
public function handle(Request $request): Response
{
$user = $request->user();
if ($user === null) {
return Response::error('Nicht authentifiziert.');
}
$events = CourseEvent::query()
->with(['course:id,name', 'venue:id,name'])
->where('created_by', $user->getAuthIdentifier())
->when(
$request->filled('course_id'),
fn ($query) => $query->where('course_id', $request->integer('course_id'))
)
->orderByDesc('from')
->get();
return Response::json($events);
}
/**
* @return array<string, Type>
*/
public function schema(JsonSchema $schema): array
{
return [
'course_id' => $schema->integer()->description('Filtert die Kurs-Events auf einen bestimmten Kurs.'),
];
}
}