diff --git a/src/Website/Mcp/Routes/web.php b/src/Website/Mcp/Routes/web.php index b66b47f..ba2c815 100644 --- a/src/Website/Mcp/Routes/web.php +++ b/src/Website/Mcp/Routes/web.php @@ -6,17 +6,19 @@ use Core\Website\Mcp\Controllers\McpRegistryController; /* |-------------------------------------------------------------------------- -| MCP Portal Routes (mcp.host.uk.com) +| MCP Portal Routes (mcp.host.uk.com / mcp.lthn.test etc.) |-------------------------------------------------------------------------- | | 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'). +| */ -$mcpDomain = config('mcp.domain', 'mcp.host.uk.com'); +$mcpDomains = config('mcp.domains', [config('mcp.domain', 'mcp.host.uk.com')]); -Route::domain($mcpDomain)->name('mcp.')->group(function () { +$registerMcpRoutes = function () { // Agent discovery endpoint (always JSON) Route::get('.well-known/mcp-servers.json', [McpRegistryController::class, 'registry']) ->name('registry'); @@ -45,4 +47,12 @@ Route::domain($mcpDomain)->name('mcp.')->group(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); +}