Skip to content

Commit 3f6a4fe

Browse files
author
Lasim
committed
feat(frontend): add GitHub avatar support for MCP servers
1 parent e7eee4f commit 3f6a4fe

File tree

4 files changed

+50
-7
lines changed

4 files changed

+50
-7
lines changed

services/frontend/src/components/mcp-server/FeaturedMcpServers.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ const getServerDescription = (server: McpServer) => {
9999
return server.description || 'No description available'
100100
}
101101
102+
const getGitHubAvatarUrl = (server: McpServer) => {
103+
if (!server.github_account_id) return null
104+
return `https://avatars.githubusercontent.com/u/${server.github_account_id}?v=4&s=64`
105+
}
106+
102107
// Lifecycle
103108
onMounted(() => {
104109
fetchFeaturedServers()
@@ -151,10 +156,17 @@ onMounted(() => {
151156
<dl class="flex flex-wrap">
152157
<div class="flex-auto pt-6 pl-6">
153158
<dt
154-
class="text-sm/6 font-semibold text-gray-900 cursor-pointer hover:text-teal-700 transition-colors"
159+
class="text-sm/6 font-semibold text-gray-900 cursor-pointer hover:text-teal-700 transition-colors flex items-center gap-2"
155160
@click="handleServerClick(server)"
156161
:title="`View ${server.name} details`"
157162
>
163+
<img
164+
v-if="getGitHubAvatarUrl(server)"
165+
:src="getGitHubAvatarUrl(server)!"
166+
:alt="`${server.name} GitHub avatar`"
167+
class="h-8 w-8 rounded-md flex-shrink-0"
168+
@error="($event.target as HTMLImageElement).style.display = 'none'"
169+
/>
158170
{{ server.name }}
159171
</dt>
160172
</div>

services/frontend/src/views/admin/mcp-server-catalog/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export interface McpServer {
77
description: string
88
long_description?: string
99
github_url?: string
10+
github_account_id?: string
1011
git_branch?: string
1112
homepage_url?: string
1213
language: string
@@ -172,6 +173,7 @@ export interface CreateMcpServerRequest {
172173
description: string
173174
long_description?: string
174175
github_url?: string
176+
github_account_id?: string
175177
git_branch?: string
176178
homepage_url?: string
177179
language?: string
@@ -211,6 +213,7 @@ export interface UpdateMcpServerRequest {
211213
description?: string
212214
long_description?: string
213215
github_url?: string
216+
github_account_id?: string
214217
git_branch?: string
215218
homepage_url?: string
216219
language?: string

services/frontend/src/views/admin/mcp-server-catalog/view/[id].vue

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,11 @@ const handleEditServer = () => {
251251
const goBack = () => {
252252
router.push('/admin/mcp-server-catalog')
253253
}
254+
255+
const getGitHubAvatarUrl = (server: McpServer) => {
256+
if (!server.github_account_id) return null
257+
return `https://avatars.githubusercontent.com/u/${server.github_account_id}?v=4&s=128`
258+
}
254259
</script>
255260

256261
<template>
@@ -301,9 +306,18 @@ const goBack = () => {
301306
<!-- Server Details -->
302307
<ContentWrapper v-if="server">
303308
<!-- Basic Information Section -->
304-
<div class="px-4 sm:px-0">
305-
<h3 class="text-base/7 font-semibold text-gray-900">{{ t('mcpCatalog.edit.serverInformation') }}</h3>
306-
<p class="mt-1 max-w-2xl text-sm/6 text-gray-500">{{ t('mcpCatalog.edit.serverDetails') }}</p>
309+
<div class="px-4 sm:px-0 flex items-center gap-4">
310+
<img
311+
v-if="getGitHubAvatarUrl(server)"
312+
:src="getGitHubAvatarUrl(server)!"
313+
:alt="`${server.name} GitHub avatar`"
314+
class="h-12 w-12 rounded-lg flex-shrink-0"
315+
@error="($event.target as HTMLImageElement).style.display = 'none'"
316+
/>
317+
<div>
318+
<h3 class="text-base/7 font-semibold text-gray-900">{{ t('mcpCatalog.edit.serverInformation') }}</h3>
319+
<p class="mt-1 max-w-2xl text-sm/6 text-gray-500">{{ t('mcpCatalog.edit.serverDetails') }}</p>
320+
</div>
307321
</div>
308322
<div class="mt-6 border-t border-gray-100">
309323
<dl class="divide-y divide-gray-100">

services/frontend/src/views/mcp-server/view/[id].vue

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,11 @@ const installServer = () => {
194194
}
195195
})
196196
}
197+
198+
const getGitHubAvatarUrl = (server: McpServer) => {
199+
if (!server.github_account_id) return null
200+
return `https://avatars.githubusercontent.com/u/${server.github_account_id}?v=4&s=128`
201+
}
197202
</script>
198203

199204
<template>
@@ -231,9 +236,18 @@ const installServer = () => {
231236

232237
<!-- Server Details -->
233238
<ContentWrapper v-if="server">
234-
<div class="px-4 sm:px-0">
235-
<h3 class="text-base/7 font-semibold text-gray-900">{{ t('mcpInstallations.view.serverInformation') }}</h3>
236-
<p class="mt-1 max-w-2xl text-sm/6 text-gray-500">{{ t('mcpInstallations.view.serverDetails') }}</p>
239+
<div class="px-4 sm:px-0 flex items-center gap-4">
240+
<img
241+
v-if="getGitHubAvatarUrl(server)"
242+
:src="getGitHubAvatarUrl(server)!"
243+
:alt="`${server.name} GitHub avatar`"
244+
class="h-12 w-12 rounded-lg flex-shrink-0"
245+
@error="($event.target as HTMLImageElement).style.display = 'none'"
246+
/>
247+
<div>
248+
<h3 class="text-base/7 font-semibold text-gray-900">{{ t('mcpInstallations.view.serverInformation') }}</h3>
249+
<p class="mt-1 max-w-2xl text-sm/6 text-gray-500">{{ t('mcpInstallations.view.serverDetails') }}</p>
250+
</div>
237251
</div>
238252
<div class="mt-6 border-t border-gray-100">
239253
<dl class="divide-y divide-gray-100">

0 commit comments

Comments
 (0)