@igstack/app-catalog-frontend-core 6.15.0 → 6.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/dist/esm/api/infra/trpc.d.ts +36 -0
  2. package/dist/esm/internal.d.ts +1 -0
  3. package/dist/esm/internal.js +2 -0
  4. package/dist/esm/internal.js.map +1 -1
  5. package/dist/esm/lib/externalLink.d.ts +8 -0
  6. package/dist/esm/lib/externalLink.js +9 -0
  7. package/dist/esm/lib/externalLink.js.map +1 -0
  8. package/dist/esm/modules/appCatalog/context/AppCatalogContext.d.ts +3 -1
  9. package/dist/esm/modules/appCatalog/context/AppCatalogContext.js +2 -0
  10. package/dist/esm/modules/appCatalog/context/AppCatalogContext.js.map +1 -1
  11. package/dist/esm/modules/appCatalog/hooks/useUpdateApp.d.ts +36 -36
  12. package/dist/esm/modules/appCatalog/ui/components/SectionTabs.d.ts +2 -1
  13. package/dist/esm/modules/appCatalog/ui/components/SectionTabs.js +11 -1
  14. package/dist/esm/modules/appCatalog/ui/components/SectionTabs.js.map +1 -1
  15. package/dist/esm/modules/appCatalog/ui/components/SourcesList.d.ts +10 -0
  16. package/dist/esm/modules/appCatalog/ui/components/SourcesList.js +51 -0
  17. package/dist/esm/modules/appCatalog/ui/components/SourcesList.js.map +1 -0
  18. package/dist/esm/modules/appCatalog/ui/detail/AppDetails.js +9 -52
  19. package/dist/esm/modules/appCatalog/ui/detail/AppDetails.js.map +1 -1
  20. package/dist/esm/modules/communityTools/useCommunityTools.d.ts +6 -6
  21. package/dist/esm/modules/mcpCatalog/McpAccessLine.d.ts +5 -0
  22. package/dist/esm/modules/mcpCatalog/McpAccessLine.js +48 -0
  23. package/dist/esm/modules/mcpCatalog/McpAccessLine.js.map +1 -0
  24. package/dist/esm/modules/mcpCatalog/McpCatalogPage.d.ts +11 -0
  25. package/dist/esm/modules/mcpCatalog/McpCatalogPage.js +289 -0
  26. package/dist/esm/modules/mcpCatalog/McpCatalogPage.js.map +1 -0
  27. package/dist/esm/modules/mcpCatalog/McpInfoTiles.d.ts +5 -0
  28. package/dist/esm/modules/mcpCatalog/McpInfoTiles.js +88 -0
  29. package/dist/esm/modules/mcpCatalog/McpInfoTiles.js.map +1 -0
  30. package/dist/esm/modules/mcpCatalog/McpSafetyLines.d.ts +5 -0
  31. package/dist/esm/modules/mcpCatalog/McpSafetyLines.js +82 -0
  32. package/dist/esm/modules/mcpCatalog/McpSafetyLines.js.map +1 -0
  33. package/dist/esm/modules/mcpCatalog/McpSearchResult.d.ts +18 -0
  34. package/dist/esm/modules/mcpCatalog/McpSearchResult.js +150 -0
  35. package/dist/esm/modules/mcpCatalog/McpSearchResult.js.map +1 -0
  36. package/dist/esm/modules/mcpCatalog/McpServerDetail.d.ts +8 -0
  37. package/dist/esm/modules/mcpCatalog/McpServerDetail.js +116 -0
  38. package/dist/esm/modules/mcpCatalog/McpServerDetail.js.map +1 -0
  39. package/dist/esm/modules/mcpCatalog/McpServerRow.d.ts +10 -0
  40. package/dist/esm/modules/mcpCatalog/McpServerRow.js +75 -0
  41. package/dist/esm/modules/mcpCatalog/McpServerRow.js.map +1 -0
  42. package/dist/esm/modules/mcpCatalog/McpToolsTable.d.ts +5 -0
  43. package/dist/esm/modules/mcpCatalog/McpToolsTable.js +24 -0
  44. package/dist/esm/modules/mcpCatalog/McpToolsTable.js.map +1 -0
  45. package/dist/esm/modules/mcpCatalog/Triad.d.ts +13 -0
  46. package/dist/esm/modules/mcpCatalog/Triad.js +175 -0
  47. package/dist/esm/modules/mcpCatalog/Triad.js.map +1 -0
  48. package/dist/esm/modules/mcpCatalog/cart/McpCart.d.ts +15 -0
  49. package/dist/esm/modules/mcpCatalog/cart/McpCart.js +156 -0
  50. package/dist/esm/modules/mcpCatalog/cart/McpCart.js.map +1 -0
  51. package/dist/esm/modules/mcpCatalog/cart/useMcpCart.d.ts +11 -0
  52. package/dist/esm/modules/mcpCatalog/cart/useMcpCart.js +48 -0
  53. package/dist/esm/modules/mcpCatalog/cart/useMcpCart.js.map +1 -0
  54. package/dist/esm/modules/mcpCatalog/install/InstallButton.d.ts +12 -0
  55. package/dist/esm/modules/mcpCatalog/install/InstallButton.js +126 -0
  56. package/dist/esm/modules/mcpCatalog/install/InstallButton.js.map +1 -0
  57. package/dist/esm/modules/mcpCatalog/install/InstallMenu.d.ts +14 -0
  58. package/dist/esm/modules/mcpCatalog/install/InstallMenu.js +139 -0
  59. package/dist/esm/modules/mcpCatalog/install/InstallMenu.js.map +1 -0
  60. package/dist/esm/modules/mcpCatalog/install/WhatHappensDialog.d.ts +10 -0
  61. package/dist/esm/modules/mcpCatalog/install/WhatHappensDialog.js +161 -0
  62. package/dist/esm/modules/mcpCatalog/install/WhatHappensDialog.js.map +1 -0
  63. package/dist/esm/modules/mcpCatalog/install/installOptions.d.ts +40 -0
  64. package/dist/esm/modules/mcpCatalog/install/installOptions.js +204 -0
  65. package/dist/esm/modules/mcpCatalog/install/installOptions.js.map +1 -0
  66. package/dist/esm/modules/mcpCatalog/install/useMcpPrefs.d.ts +14 -0
  67. package/dist/esm/modules/mcpCatalog/install/useMcpPrefs.js +39 -0
  68. package/dist/esm/modules/mcpCatalog/install/useMcpPrefs.js.map +1 -0
  69. package/dist/esm/modules/mcpCatalog/searchMcpServers.d.ts +25 -0
  70. package/dist/esm/modules/mcpCatalog/searchMcpServers.js +44 -0
  71. package/dist/esm/modules/mcpCatalog/searchMcpServers.js.map +1 -0
  72. package/dist/esm/modules/mcpCatalog/signIn.d.ts +13 -0
  73. package/dist/esm/modules/mcpCatalog/signIn.js +29 -0
  74. package/dist/esm/modules/mcpCatalog/signIn.js.map +1 -0
  75. package/dist/esm/modules/mcpCatalog/useHasMcpServers.d.ts +8 -0
  76. package/dist/esm/modules/mcpCatalog/useHasMcpServers.js +13 -0
  77. package/dist/esm/modules/mcpCatalog/useHasMcpServers.js.map +1 -0
  78. package/dist/esm/modules/mcpCatalog/useMcpCatalogConfig.d.ts +7 -0
  79. package/dist/esm/modules/mcpCatalog/useMcpCatalogConfig.js +16 -0
  80. package/dist/esm/modules/mcpCatalog/useMcpCatalogConfig.js.map +1 -0
  81. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/classic/schemas.js +3 -3
  82. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/api.js +1 -1
  83. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/checks.js +1 -1
  84. package/dist/esm/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/schemas.js +2 -2
  85. package/dist/esm/routeTree.gen.d.ts +43 -17
  86. package/dist/esm/routeTree.gen.js +15 -3
  87. package/dist/esm/routeTree.gen.js.map +1 -1
  88. package/dist/esm/routes/_layout/community.$slug.d.ts +3 -3
  89. package/dist/esm/routes/_layout/community.d.ts +3 -3
  90. package/dist/esm/routes/_layout/mcp.$slug.d.ts +9 -0
  91. package/dist/esm/routes/_layout/mcp._slug.js +8 -0
  92. package/dist/esm/routes/_layout/mcp._slug.js.map +1 -0
  93. package/dist/esm/routes/_layout/mcp.d.ts +5 -1
  94. package/dist/esm/routes/_layout/mcp.js +45 -5
  95. package/dist/esm/routes/_layout/mcp.js.map +1 -1
  96. package/dist/esm/ui/button.d.ts +1 -1
  97. package/dist/esm/ui/components/header/Header.js +1 -5
  98. package/dist/esm/ui/components/header/Header.js.map +1 -1
  99. package/dist/esm/ui/empty.d.ts +1 -1
  100. package/dist/esm/ui/item.d.ts +1 -1
  101. package/dist/esm/userDb/AcDb.d.ts +10 -0
  102. package/dist/esm/userDb/AcDb.js +6 -0
  103. package/dist/esm/userDb/AcDb.js.map +1 -1
  104. package/package.json +4 -4
  105. package/src/__tests__/modules/communityTools/timeAgo.test.ts +16 -0
  106. package/src/internal.ts +1 -0
  107. package/src/lib/externalLink.ts +10 -0
  108. package/src/modules/appCatalog/context/AppCatalogContext.tsx +5 -0
  109. package/src/modules/appCatalog/ui/components/SectionTabs.tsx +14 -1
  110. package/src/modules/appCatalog/ui/components/SourcesList.tsx +62 -0
  111. package/src/modules/appCatalog/ui/detail/AppDetails.tsx +6 -52
  112. package/src/modules/mcpCatalog/McpAccessLine.tsx +54 -0
  113. package/src/modules/mcpCatalog/McpCatalogPage.tsx +324 -0
  114. package/src/modules/mcpCatalog/McpInfoTiles.tsx +112 -0
  115. package/src/modules/mcpCatalog/McpSafetyLines.tsx +89 -0
  116. package/src/modules/mcpCatalog/McpSearchResult.tsx +173 -0
  117. package/src/modules/mcpCatalog/McpServerDetail.tsx +145 -0
  118. package/src/modules/mcpCatalog/McpServerRow.tsx +78 -0
  119. package/src/modules/mcpCatalog/McpToolsTable.tsx +36 -0
  120. package/src/modules/mcpCatalog/Triad.tsx +213 -0
  121. package/src/modules/mcpCatalog/cart/McpCart.tsx +171 -0
  122. package/src/modules/mcpCatalog/cart/useMcpCart.ts +64 -0
  123. package/src/modules/mcpCatalog/install/InstallButton.tsx +154 -0
  124. package/src/modules/mcpCatalog/install/InstallMenu.tsx +160 -0
  125. package/src/modules/mcpCatalog/install/WhatHappensDialog.tsx +199 -0
  126. package/src/modules/mcpCatalog/install/installOptions.tsx +266 -0
  127. package/src/modules/mcpCatalog/install/useMcpPrefs.ts +55 -0
  128. package/src/modules/mcpCatalog/searchMcpServers.ts +84 -0
  129. package/src/modules/mcpCatalog/signIn.ts +34 -0
  130. package/src/modules/mcpCatalog/useHasMcpServers.ts +22 -0
  131. package/src/modules/mcpCatalog/useMcpCatalogConfig.ts +20 -0
  132. package/src/routeTree.gen.ts +36 -5
  133. package/src/routes/_layout/mcp.$slug.tsx +10 -0
  134. package/src/routes/_layout/mcp.tsx +63 -3
  135. package/src/ui/components/header/Header.tsx +1 -7
  136. package/src/userDb/AcDb.ts +13 -0
  137. package/dist/esm/modules/appCatalog/ui/pages/McpPage.d.ts +0 -11
  138. package/dist/esm/modules/appCatalog/ui/pages/McpPage.js +0 -227
  139. package/dist/esm/modules/appCatalog/ui/pages/McpPage.js.map +0 -1
  140. package/dist/esm/modules/appCatalog/utils/fetchMcpTools.d.ts +0 -32
  141. package/dist/esm/modules/appCatalog/utils/fetchMcpTools.js +0 -79
  142. package/dist/esm/modules/appCatalog/utils/fetchMcpTools.js.map +0 -1
  143. package/src/modules/appCatalog/ui/pages/McpPage.tsx +0 -275
  144. package/src/modules/appCatalog/utils/fetchMcpTools.ts +0 -140
@@ -0,0 +1,324 @@
1
+ import type { CatalogMcpServer } from '@igstack/app-catalog-backend-core'
2
+ import { Search, Sparkles, X } from 'lucide-react'
3
+ import { DynamicIcon, iconNames } from 'lucide-react/dynamic'
4
+ import type { IconName } from 'lucide-react/dynamic'
5
+ import type { ComponentProps } from 'react'
6
+ import { useMemo, useRef } from 'react'
7
+ import {
8
+ getGroupBySlug,
9
+ getPersonBySlug,
10
+ } from '../appCatalog/utils/resolveHelpers'
11
+ import { useAppCatalogContext } from '../appCatalog/context/AppCatalogContext'
12
+ import { cn } from '~/lib/utils'
13
+ import { McpCart } from './cart/McpCart'
14
+ import { useMcpCart } from './cart/useMcpCart'
15
+ import { useMcpPrefs } from './install/useMcpPrefs'
16
+ import { McpSearchResult } from './McpSearchResult'
17
+ import { McpServerRow } from './McpServerRow'
18
+ import { searchMcpServers } from './searchMcpServers'
19
+ import { Triad } from './Triad'
20
+ import {
21
+ useMcpCatalogConfig,
22
+ useSensitiveDataLabel,
23
+ } from './useMcpCatalogConfig'
24
+
25
+ const CHIP =
26
+ 'min-h-[30px] rounded-full border border-border bg-card px-3 py-1 text-[13px] font-semibold text-foreground transition-colors hover:border-ring aria-pressed:border-primary/40 aria-pressed:bg-accent aria-pressed:text-accent-foreground'
27
+
28
+ const SECTION_HEADING =
29
+ 'mx-auto mt-11 mb-3.5 flex max-w-[1100px] flex-wrap items-baseline gap-x-2.5 gap-y-1'
30
+
31
+ /** For an intent whose icon is not a lucide name. */
32
+ function FallbackIcon() {
33
+ return <Sparkles aria-hidden="true" className="size-[18px]" />
34
+ }
35
+
36
+ function isIconName(name: string): name is IconName {
37
+ return (iconNames as string[]).includes(name)
38
+ }
39
+
40
+ /** Configured categories first, in config order; the rest alphabetically by key. */
41
+ function groupByCategory(
42
+ servers: readonly CatalogMcpServer[],
43
+ categories: readonly { key: string; title: string }[],
44
+ ): { key: string; title: string; servers: CatalogMcpServer[] }[] {
45
+ const keys = [...new Set(servers.map((s) => s.category))]
46
+ const rank = (key: string) => {
47
+ const i = categories.findIndex((c) => c.key === key)
48
+ return i === -1 ? categories.length : i
49
+ }
50
+ return keys
51
+ .sort((a, b) => rank(a) - rank(b) || a.localeCompare(b))
52
+ .map((key) => ({
53
+ key,
54
+ title: categories.find((c) => c.key === key)?.title ?? key,
55
+ servers: servers
56
+ .filter((s) => s.category === key)
57
+ .sort((a, b) => a.displayName.localeCompare(b.displayName)),
58
+ }))
59
+ }
60
+
61
+ export interface McpCatalogPageProps {
62
+ /** `?q=`: the URL is the search's only home, so a shared link restores it. */
63
+ q: string
64
+ /** Every edit of the search, for the URL to carry. */
65
+ onQueryChange: (q: string) => void
66
+ }
67
+
68
+ const NO_SERVERS: CatalogMcpServer[] = []
69
+
70
+ /**
71
+ * The MCP servers tab. At rest it asks what your AI should be able to do and
72
+ * lists every server by category; a search turns the list into ranked answers.
73
+ */
74
+ export function McpCatalogPage({ q, onQueryChange }: McpCatalogPageProps) {
75
+ const {
76
+ mcpServers = NO_SERVERS,
77
+ isLoadingApps,
78
+ persons,
79
+ groups: ownerGroups,
80
+ } = useAppCatalogContext()
81
+ const config = useMcpCatalogConfig()
82
+ const { installed } = useMcpPrefs()
83
+ const cartShown = useMcpCart().servers.length > 0
84
+ const inputRef = useRef<HTMLInputElement>(null)
85
+ const setQuery = onQueryChange
86
+
87
+ const results = useMemo(
88
+ () =>
89
+ searchMcpServers(mcpServers, q, {
90
+ categoryTitle: (key) =>
91
+ config?.categories?.find((c) => c.key === key)?.title,
92
+ ownerName: (slug) => {
93
+ const person = getPersonBySlug(persons, slug)
94
+ return person
95
+ ? `${person.firstName} ${person.lastName}`
96
+ : getGroupBySlug(ownerGroups, slug)?.displayName
97
+ },
98
+ }),
99
+ [mcpServers, q, config?.categories, persons, ownerGroups],
100
+ )
101
+ const groups = useMemo(
102
+ () => groupByCategory(mcpServers, config?.categories ?? []),
103
+ [mcpServers, config?.categories],
104
+ )
105
+ const searching = q.trim() !== ''
106
+ const tryQueries = config?.tryQueries ?? []
107
+ const sensitiveLabel = useSensitiveDataLabel()
108
+
109
+ const tryChips = (queries: readonly string[]) => (
110
+ <div className="mt-2.5 flex flex-wrap items-center justify-center gap-1.5 text-[13px] text-muted-foreground">
111
+ <span>try:</span>
112
+ {queries.map((t) => (
113
+ <button
114
+ key={t}
115
+ type="button"
116
+ className={CHIP}
117
+ aria-pressed={q.trim().toLowerCase() === t.toLowerCase()}
118
+ onClick={() => setQuery(t)}
119
+ >
120
+ {t}
121
+ </button>
122
+ ))}
123
+ </div>
124
+ )
125
+
126
+ return (
127
+ <div className="min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]">
128
+ <div
129
+ className={cn(
130
+ 'mx-auto w-full max-w-[1100px] px-1 pt-5 pb-12',
131
+ // Room for the fixed cart bar, so it never covers the last row.
132
+ cartShown && 'pb-36',
133
+ )}
134
+ >
135
+ <section className="mx-auto max-w-[860px] text-center">
136
+ <h1 className="m-0 font-serif text-[40px] leading-[1.08] font-semibold tracking-[-.02em]">
137
+ What should <em className="text-primary not-italic">your AI</em> be
138
+ able to do?
139
+ </h1>
140
+ <p className="mx-auto mt-2.5 mb-[22px] max-w-[600px] text-[15.5px] text-muted-foreground">
141
+ Describe the job. We find the MCP servers that give your assistant
142
+ those tools.
143
+ </p>
144
+ <div className="relative">
145
+ <Search
146
+ aria-hidden="true"
147
+ className="absolute top-5 left-[18px] size-[18px] text-muted-foreground"
148
+ />
149
+ <input
150
+ ref={inputRef}
151
+ type="search"
152
+ value={q}
153
+ autoFocus
154
+ autoComplete="off"
155
+ spellCheck={false}
156
+ aria-label="Search MCP servers"
157
+ placeholder="e.g. “search logs”, “read a ticket”, “query the warehouse”"
158
+ onChange={(e) => setQuery(e.target.value)}
159
+ onKeyDown={(e) => {
160
+ if (e.key === 'Escape') setQuery('')
161
+ }}
162
+ className="h-[58px] w-full rounded-[calc(var(--radius)+4px)] border border-border bg-card pr-12 pl-[50px] text-[17px] text-foreground shadow-lg transition-[border-color,box-shadow] outline-none focus:border-ring focus:ring-[3px] focus:ring-ring/20 [&::-webkit-search-cancel-button]:hidden"
163
+ />
164
+ {searching && (
165
+ <button
166
+ type="button"
167
+ aria-label="Clear search"
168
+ className="absolute top-[13px] right-3 grid size-8 place-items-center rounded-lg text-muted-foreground hover:bg-muted"
169
+ onClick={() => {
170
+ setQuery('')
171
+ inputRef.current?.focus()
172
+ }}
173
+ >
174
+ <X aria-hidden="true" className="size-4" />
175
+ </button>
176
+ )}
177
+ </div>
178
+ {tryQueries.length > 0 && tryChips(tryQueries)}
179
+ </section>
180
+
181
+ {searching ? (
182
+ results.length === 0 ? (
183
+ <div className="mx-auto my-6 max-w-[700px] rounded-xl border border-dashed border-border p-7 text-center text-muted-foreground">
184
+ <b className="mb-1.5 block text-base text-foreground">
185
+ No server gives your AI “{q.trim()}” yet
186
+ </b>
187
+ Try a system name or a verb.
188
+ {tryQueries.length > 0 && tryChips(tryQueries)}
189
+ </div>
190
+ ) : (
191
+ <>
192
+ <div className={SECTION_HEADING}>
193
+ <h2 className="m-0 font-serif text-2xl font-semibold tracking-[-.01em]">
194
+ {results.length} way{results.length > 1 ? 's' : ''} to “
195
+ {q.trim()}”
196
+ </h2>
197
+ <span className="text-[13px] text-muted-foreground">
198
+ matched on tool names first, then descriptions
199
+ </span>
200
+ </div>
201
+ <div className="grid gap-2.5">
202
+ {results.map((hit, i) => (
203
+ <McpSearchResult
204
+ key={hit.server.slug}
205
+ hit={hit}
206
+ q={q}
207
+ best={i === 0}
208
+ installed={installed.has(hit.server.slug)}
209
+ />
210
+ ))}
211
+ </div>
212
+ </>
213
+ )
214
+ ) : (
215
+ <>
216
+ {(config?.intents?.length ?? 0) > 0 && (
217
+ <div className="mx-auto mt-9 grid grid-cols-[repeat(auto-fill,minmax(230px,1fr))] gap-2.5">
218
+ {config?.intents?.map((intent) => (
219
+ <button
220
+ key={intent.query}
221
+ type="button"
222
+ className="flex min-h-16 items-center gap-3 rounded-xl border border-border bg-card px-3.5 py-3 text-left transition-[border-color,box-shadow] hover:border-ring hover:shadow-lg"
223
+ onClick={() => setQuery(intent.query)}
224
+ >
225
+ <span className="grid size-9 shrink-0 place-items-center rounded-[10px] bg-primary/10 text-primary">
226
+ {isIconName(intent.icon) ? (
227
+ <DynamicIcon
228
+ name={intent.icon}
229
+ aria-hidden="true"
230
+ className="size-[18px]"
231
+ fallback={() => <FallbackIcon />}
232
+ />
233
+ ) : (
234
+ <FallbackIcon />
235
+ )}
236
+ </span>
237
+ <span>
238
+ <b className="block text-sm">{intent.title}</b>
239
+ <span className="text-[12.5px] text-muted-foreground">
240
+ {intent.caption}
241
+ </span>
242
+ </span>
243
+ </button>
244
+ ))}
245
+ </div>
246
+ )}
247
+
248
+ <div className={SECTION_HEADING}>
249
+ <h2 className="m-0 font-serif text-2xl font-semibold tracking-[-.01em]">
250
+ Every server
251
+ </h2>
252
+ {!isLoadingApps && (
253
+ <span className="text-[13px] text-muted-foreground">
254
+ {mcpServers.length} server
255
+ {mcpServers.length === 1 ? '' : 's'}
256
+ </span>
257
+ )}
258
+ <span className="ml-auto flex flex-wrap items-center gap-3.5 text-[12.5px] text-muted-foreground">
259
+ <LegendItem
260
+ server={{ access: 'write' }}
261
+ text="top: eye reads, pencil writes"
262
+ />
263
+ <LegendItem
264
+ server={{ access: 'read', requiredAppSlugs: ['other apps'] }}
265
+ text="left dot: needs access"
266
+ />
267
+ <LegendItem
268
+ server={{ access: 'read', sensitiveData: true }}
269
+ text={`right dot: ${sensitiveLabel.toLowerCase()}`}
270
+ />
271
+ </span>
272
+ </div>
273
+ <div className="columns-[3_300px] gap-7">
274
+ {groups.map((group) => (
275
+ <section
276
+ key={group.key}
277
+ data-testid="mcp-category"
278
+ aria-labelledby={`mcp-category-${group.key}`}
279
+ className="mb-[22px] break-inside-avoid"
280
+ >
281
+ <h3
282
+ id={`mcp-category-${group.key}`}
283
+ className="mb-1.5 flex gap-1.5 text-xs font-extrabold tracking-[.06em] text-muted-foreground uppercase"
284
+ >
285
+ <span
286
+ aria-hidden="true"
287
+ className="h-[3px] w-4 self-center rounded-full bg-primary"
288
+ />
289
+ {group.title}
290
+ </h3>
291
+ <ul className="m-0 list-none p-0">
292
+ {group.servers.map((server) => (
293
+ <McpServerRow
294
+ key={server.slug}
295
+ server={server}
296
+ installed={installed.has(server.slug)}
297
+ />
298
+ ))}
299
+ </ul>
300
+ </section>
301
+ ))}
302
+ </div>
303
+ </>
304
+ )}
305
+ </div>
306
+ <McpCart />
307
+ </div>
308
+ )
309
+ }
310
+
311
+ function LegendItem({
312
+ server,
313
+ text,
314
+ }: {
315
+ server: ComponentProps<typeof Triad>['server']
316
+ text: string
317
+ }) {
318
+ return (
319
+ <span className="inline-flex items-center gap-1.5">
320
+ <Triad server={server} size={20} decorative />
321
+ {text}
322
+ </span>
323
+ )
324
+ }
@@ -0,0 +1,112 @@
1
+ import type { CatalogMcpServer } from '@igstack/app-catalog-backend-core'
2
+ import { BookOpen, MessageCircle, User } from 'lucide-react'
3
+ import type { ReactNode } from 'react'
4
+ import { useAppCatalogContext } from '../appCatalog/context/AppCatalogContext'
5
+ import { SourcePulse } from '../appCatalog/ui/components/SourcePulse'
6
+ import { useSourceUrlsWithPulse } from '../appCatalog/ui/components/SourcesList'
7
+ import {
8
+ getGroupBySlug,
9
+ getPersonBySlug,
10
+ } from '../appCatalog/utils/resolveHelpers'
11
+ import { displayUrl } from '../appCatalog/utils/displayUrl'
12
+
13
+ const TILE =
14
+ 'relative flex aspect-square w-[120px] min-w-0 flex-col gap-1 rounded-[var(--radius)] border border-border bg-card p-3 text-foreground transition-colors'
15
+ const LINK_TILE = `${TILE} has-[a:hover]:border-ring`
16
+ const ICON = 'size-5 text-primary'
17
+ /** The icon row; pushes the label and value to the bottom of the square. */
18
+ const HEAD = 'mb-auto flex items-start justify-between'
19
+ const LABEL =
20
+ 'text-[11px] font-extrabold tracking-[.06em] text-muted-foreground uppercase'
21
+ const VALUE =
22
+ 'line-clamp-2 text-[13px] leading-[1.3] font-bold [overflow-wrap:anywhere]'
23
+ /** The tile's link covers the whole square, so the tile is the click target. */
24
+ const STRETCHED = 'after:absolute after:inset-0 after:content-[""]'
25
+
26
+ function LinkTile({
27
+ icon,
28
+ label,
29
+ value,
30
+ href,
31
+ title,
32
+ testId,
33
+ extra,
34
+ }: {
35
+ icon: ReactNode
36
+ label: string
37
+ value: string
38
+ href: string
39
+ title: string
40
+ testId?: string
41
+ extra?: ReactNode
42
+ }) {
43
+ return (
44
+ <div className={LINK_TILE} data-testid={testId} title={title}>
45
+ <div className={HEAD}>
46
+ {icon}
47
+ {/* Above the stretched link, so its tooltip still opens. */}
48
+ {extra && <span className="relative z-10">{extra}</span>}
49
+ </div>
50
+ <a
51
+ href={href}
52
+ target="_blank"
53
+ rel="noopener noreferrer"
54
+ className={`flex flex-col gap-1 outline-none focus-visible:after:rounded-[var(--radius)] focus-visible:after:ring-2 focus-visible:after:ring-ring ${STRETCHED}`}
55
+ >
56
+ <small className={LABEL}>{label}</small>
57
+ <b className={VALUE}>{value}</b>
58
+ </a>
59
+ </div>
60
+ )
61
+ }
62
+
63
+ /** Square tiles: who owns it, where to ask, and every source it was written from. */
64
+ export function McpInfoTiles({ server }: { server: CatalogMcpServer }) {
65
+ const { persons, groups } = useAppCatalogContext()
66
+ const { urls, pulseByUrl } = useSourceUrlsWithPulse(server.sources)
67
+
68
+ const owner = server.ownerSlug
69
+ const person = owner ? getPersonBySlug(persons, owner) : undefined
70
+ // The same fallbacks as PersonBadge: a blank name or group shows the slug.
71
+ const ownerName = person
72
+ ? `${person.firstName} ${person.lastName}`.trim() || owner
73
+ : owner && (getGroupBySlug(groups, owner)?.displayName || owner)
74
+
75
+ return (
76
+ <div className="grid grid-cols-[repeat(auto-fill,120px)] gap-2">
77
+ {ownerName && (
78
+ <div className={TILE} data-testid="mcp-tile-owner" title={ownerName}>
79
+ <div className={HEAD}>
80
+ <User aria-hidden="true" className={ICON} />
81
+ </div>
82
+ <small className={LABEL}>Owner</small>
83
+ <b className={VALUE}>{ownerName}</b>
84
+ </div>
85
+ )}
86
+ {server.support && (
87
+ <LinkTile
88
+ icon={<MessageCircle aria-hidden="true" className={ICON} />}
89
+ label="Support"
90
+ value={server.support.label}
91
+ href={server.support.url}
92
+ title={server.support.url}
93
+ />
94
+ )}
95
+ {urls.map((url) => {
96
+ const pulse = pulseByUrl.get(url)
97
+ return (
98
+ <LinkTile
99
+ key={url}
100
+ testId="mcp-tile-source"
101
+ icon={<BookOpen aria-hidden="true" className={ICON} />}
102
+ label="Source"
103
+ value={displayUrl(url)}
104
+ href={url}
105
+ title={url}
106
+ extra={pulse && <SourcePulse pulse={pulse} />}
107
+ />
108
+ )
109
+ })}
110
+ </div>
111
+ )
112
+ }
@@ -0,0 +1,89 @@
1
+ import type { CatalogMcpServer } from '@igstack/app-catalog-backend-core'
2
+ import { Eye, Pencil, TriangleAlert } from 'lucide-react'
3
+ import { SIGN_IN } from './signIn'
4
+ import { useSensitiveDataLabel } from './useMcpCatalogConfig'
5
+
6
+ const LINE = 'flex flex-wrap items-baseline gap-x-2'
7
+ const ICON = 'size-[15px] shrink-0 self-center'
8
+ const NOTE = 'text-[13px] text-muted-foreground'
9
+
10
+ const SIGN_IN_NOTE: Record<CatalogMcpServer['auth']['kind'], string> = {
11
+ sso: 'A browser window opens to sign you in.',
12
+ token: 'You paste your own token once.',
13
+ none: 'Nothing to set up.',
14
+ }
15
+
16
+ /** One line each: what it can change, sensitive data, how you sign in. */
17
+ export function McpSafetyLines({ server }: { server: CatalogMcpServer }) {
18
+ const sensitiveLabel = useSensitiveDataLabel()
19
+ const signIn = SIGN_IN[server.auth.kind]
20
+ const token = server.auth.token
21
+
22
+ return (
23
+ <ul className="m-0 grid list-none gap-1 p-0 text-[13.5px]">
24
+ {server.access === 'write' ? (
25
+ <li className={LINE}>
26
+ <Pencil
27
+ aria-hidden="true"
28
+ className={`${ICON} text-orange-600 dark:text-orange-400`}
29
+ />
30
+ <b>Can write</b>
31
+ <span className={NOTE}>
32
+ {server.writeNote ?? 'Some tools change data.'}
33
+ </span>
34
+ </li>
35
+ ) : (
36
+ <li className={LINE}>
37
+ <Eye
38
+ aria-hidden="true"
39
+ className={`${ICON} text-green-600 dark:text-green-400`}
40
+ />
41
+ <b>Read-only</b>
42
+ <span className={NOTE}>looks things up, changes nothing</span>
43
+ </li>
44
+ )}
45
+ {server.sensitiveData && (
46
+ <li className={LINE}>
47
+ <TriangleAlert
48
+ aria-hidden="true"
49
+ className={`${ICON} text-destructive`}
50
+ />
51
+ <b>{sensitiveLabel}</b>
52
+ <span className={NOTE}>your AI can read this data</span>
53
+ </li>
54
+ )}
55
+ <li className={LINE}>
56
+ <signIn.Icon
57
+ aria-hidden="true"
58
+ className={`${ICON} text-muted-foreground`}
59
+ />
60
+ <b>{signIn.badge}</b>
61
+ <span className={NOTE}>
62
+ {server.auth.note ?? SIGN_IN_NOTE[server.auth.kind]}
63
+ </span>
64
+ {token && (
65
+ <details className="ml-[23px] w-full text-[13px]">
66
+ <summary className="cursor-pointer font-bold text-primary">
67
+ How to get the token
68
+ </summary>
69
+ <ol className="mt-1 mb-0 list-decimal pl-[18px] text-muted-foreground">
70
+ {token.steps.map((step) => (
71
+ <li key={step}>{step}</li>
72
+ ))}
73
+ <li>
74
+ <a
75
+ href={token.page}
76
+ target="_blank"
77
+ rel="noopener noreferrer"
78
+ className="font-bold text-primary hover:underline"
79
+ >
80
+ Open the token page
81
+ </a>
82
+ </li>
83
+ </ol>
84
+ </details>
85
+ )}
86
+ </li>
87
+ </ul>
88
+ )
89
+ }