revert: simplify route file back to single config read

Multi-domain logic moved to app-level Boot (wildcard override).

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Snider 2026-03-03 17:08:51 +00:00
parent 27e1336b24
commit 91542fb009

View file

@ -6,19 +6,18 @@ use Core\Website\Mcp\Controllers\McpRegistryController;
/*
|--------------------------------------------------------------------------
| MCP Portal Routes (mcp.host.uk.com / mcp.lthn.test etc.)
| MCP Portal Routes
|--------------------------------------------------------------------------
|
| Public routes for the MCP server registry and documentation portal.
| These routes serve both human-readable docs and machine-readable JSON.
|
| Supports multiple domains via config('mcp.domains').
| Domain is set via config('mcp.domain') the app Boot may override
| this with a wildcard for multi-domain support.
|
*/
$mcpDomains = config('mcp.domains', [config('mcp.domain', 'mcp.host.uk.com')]);
$registerMcpRoutes = function () {
Route::domain(config('mcp.domain'))->name('mcp.')->group(function () {
// Agent discovery endpoint (always JSON)
Route::get('.well-known/mcp-servers.json', [McpRegistryController::class, 'registry'])
->name('registry');
@ -47,12 +46,4 @@ $registerMcpRoutes = function () {
// OpenAPI spec
Route::get('openapi.json', [McpRegistryController::class, 'openapi'])->name('openapi.json');
Route::get('openapi.yaml', [McpRegistryController::class, 'openapi'])->name('openapi.yaml');
};
// Primary domain gets named routes (mcp.landing, mcp.servers.index, etc.)
Route::domain($mcpDomains[0])->name('mcp.')->group($registerMcpRoutes);
// Additional domains get the same routes without named duplicates
foreach (array_slice($mcpDomains, 1) as $domain) {
Route::domain($domain)->group($registerMcpRoutes);
}
});