mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-06-11 02:50:29 +00:00
8c68b19138
- 🛠️ Introduced generic Super-Admin MCP tools, including `list-models`, `describe-model`, `list-records`, `show-record`, `create-record`, and `update-record`. - 🛡️ Restricted modification of critical fields (e.g., passwords, roles, tokens) to enhance security. - ✅ Added extensive feature tests for Super-Admin functionality and access control. - 📜 Increased pagination length to accommodate new tools on a single page. - 🔗 Registered Super-Admin tools in `EinundzwanzigServer`.
35 lines
1.3 KiB
PHP
35 lines
1.3 KiB
PHP
<?php
|
|
|
|
use App\Mcp\Servers\EinundzwanzigServer;
|
|
use App\Mcp\Tools\CourseEvent\UpdateCourseEventTool;
|
|
use App\Mcp\Tools\Meetup\CreateMeetupTool;
|
|
use App\Mcp\Tools\Search\SearchCitiesTool;
|
|
|
|
it('rejects unauthenticated requests to the mcp endpoint', function () {
|
|
$this->postJson('/mcp', [
|
|
'jsonrpc' => '2.0',
|
|
'id' => 1,
|
|
'method' => 'tools/list',
|
|
])->assertUnauthorized();
|
|
});
|
|
|
|
it('registers every domain tool on the server', function () {
|
|
$property = (new ReflectionClass(EinundzwanzigServer::class))->getProperty('tools');
|
|
$tools = $property->getDefaultValue();
|
|
|
|
expect($tools)->toHaveCount(38)
|
|
->and($tools)->toContain(CreateMeetupTool::class)
|
|
->and($tools)->toContain(UpdateCourseEventTool::class)
|
|
->and($tools)->toContain(SearchCitiesTool::class);
|
|
});
|
|
|
|
it('serves every tool on a single tools/list page', function () {
|
|
$reflection = new ReflectionClass(EinundzwanzigServer::class);
|
|
$tools = $reflection->getProperty('tools')->getDefaultValue();
|
|
$defaultPerPage = $reflection->getProperty('defaultPaginationLength')->getDefaultValue();
|
|
|
|
// Some MCP clients (e.g. the Claude.ai web connector) only load the first
|
|
// tools/list page and do not follow the nextCursor, so every tool must fit on it.
|
|
expect($defaultPerPage)->toBeGreaterThanOrEqual(count($tools));
|
|
});
|