From e08ef93bab385788e825a84180f1ba44afe9f068 Mon Sep 17 00:00:00 2001 From: Lei Xu Date: Mon, 28 Apr 2025 09:50:18 +0000 Subject: [PATCH 1/2] fix: Update license_type property to use undefined instead of null for better type handling --- server/src/lib/githubEnrichment.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/lib/githubEnrichment.ts b/server/src/lib/githubEnrichment.ts index 80a20cf..61d46ad 100644 --- a/server/src/lib/githubEnrichment.ts +++ b/server/src/lib/githubEnrichment.ts @@ -37,7 +37,7 @@ export interface EnrichedMcpServer extends McpServer { latest_commit_id?: string; fork_count?: number; owner_name?: string; - license_type?: string | null; + license_type?: string | undefined; } /** @@ -115,7 +115,7 @@ export interface GithubRepoInfo { latest_commit_id: string; fork_count: number; owner_name: string; - license_type: string | null; // Will be null if no license information available + license_type: string | undefined; // Will be undefined if no license information available } /** @@ -161,7 +161,7 @@ export async function fetchGithubInfo(githubUrl: string): Promise Date: Mon, 28 Apr 2025 10:04:27 +0000 Subject: [PATCH 2/2] feat: Add githubLatestCommit and githubForks fields to MCPServer interface; enhance sorting by githubStars in search_servers route --- client/src/types.ts | 3 +++ server/src/lib/mcpServers.ts | 8 +++++++- server/src/routes/hub.ts | 7 ++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/client/src/types.ts b/client/src/types.ts index 8844d57..4a2afb4 100644 --- a/client/src/types.ts +++ b/client/src/types.ts @@ -23,4 +23,7 @@ export interface MCPServer { features?: string[]; prerequisites?: string[]; lastEnrichmentTime?: number; + githubLatestCommit?: string; + githubForks?: number; + licenseType?: string | null; } \ No newline at end of file diff --git a/server/src/lib/mcpServers.ts b/server/src/lib/mcpServers.ts index c8fc562..1d970dd 100644 --- a/server/src/lib/mcpServers.ts +++ b/server/src/lib/mcpServers.ts @@ -23,7 +23,13 @@ export interface McpServer { createdAt?: string; updatedAt?: string; hubId: string; - [key: string]: string | number | boolean | string[] | undefined; + isOfficialIntegration?: boolean; + isReferenceServer?: boolean; + isCommunityServer?: boolean; + githubLatestCommit?: string; + githubForks?: number; + licenseType?: string | null; + [key: string]: string | number | boolean | string[] | null | undefined; } // In-memory cache for MCP servers data - now keyed by locale diff --git a/server/src/routes/hub.ts b/server/src/routes/hub.ts index 91e8072..9e3d56d 100644 --- a/server/src/routes/hub.ts +++ b/server/src/routes/hub.ts @@ -187,13 +187,14 @@ router.post('/search_servers', async (req: Request, res: Response): Promise { // If a is recommended and b is not, a comes first if (a.isRecommended && !b.isRecommended) return -1; // If b is recommended and a is not, b comes first if (!a.isRecommended && b.isRecommended) return 1; - // If both have the same recommendation status, maintain original order - return 0; + // If both have the same recommendation status, sort by githubStars (descending) + return (b.githubStars || 0) - (a.githubStars || 0); }); // Apply pagination if parameters are provided @@ -231,7 +232,7 @@ router.post('/search_servers', async (req: Request, res: Response): Promise