You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/09/23 07:31:02 UTC

(maka) 01/01: refactor(mcp): simplify recommendations with Astryx components

This is an automated email from the ASF dual-hosted git repository.

Astro-Han pushed a commit to branch fix/mcp-auth-integrity
in repository https://gitbox.apache.org/repos/asf/maka.git

commit 2c6264de2d9f0b5490396291948834bf687b83f7
Author: AstroHan <le...@outlook.com>
AuthorDate: Wed Sep 23 15:30:49 2026 +0800

    refactor(mcp): simplify recommendations with Astryx components
    
    Generated-by: Codex
---
 .../renderer/features/module-hub/ui/mcp-page.tsx   | 60 ++++++++++++----------
 apps/desktop/src/renderer/locales/mcp-copy.ts      | 46 ++++++++---------
 .../src/renderer/styles/module-pages/mcp.css       | 19 ++-----
 apps/desktop/stories/module-hubs.stories.tsx       | 10 ++--
 docs/astryx-surface-file-inventory.md              |  2 +-
 5 files changed, 62 insertions(+), 75 deletions(-)

diff --git a/apps/desktop/src/renderer/features/module-hub/ui/mcp-page.tsx b/apps/desktop/src/renderer/features/module-hub/ui/mcp-page.tsx
index 8a3eb22de5..e2166e3ced 100644
--- a/apps/desktop/src/renderer/features/module-hub/ui/mcp-page.tsx
+++ b/apps/desktop/src/renderer/features/module-hub/ui/mcp-page.tsx
@@ -29,9 +29,11 @@ import { isMcpStdioConfig } from '@maka/core/mcp';
 import {
   Banner,
   Button,
+  ClickableCard,
   Collapsible,
   Divider,
   EmptyState,
+  Grid,
   Heading,
   HStack,
   IconButton,
@@ -53,7 +55,6 @@ import {
   DialogHeader,
 } from '@astryxdesign/core/Dialog';
 import { Layout, LayoutContent } from '@astryxdesign/core/Layout';
-import { Link } from '@astryxdesign/core/Link';
 import { MetadataList, MetadataListItem } from '@astryxdesign/core/MetadataList';
 import {
   ModulePage,
@@ -103,7 +104,6 @@ const MCP_SUGGESTIONS = [
   { id: 'notion', url: 'https://mcp.notion.com/mcp' },
   { id: 'linear', url: 'https://mcp.linear.app/mcp' },
   { id: 'feishu', url: 'https://mcp.feishu.cn/mcp' },
-  { id: 'maxcompute', url: 'https://mcp.maxcompute.aliyun.com/mcp' },
   { id: 'mcp-docs', url: 'https://modelcontextprotocol.io/mcp' },
 ] as const;
 
@@ -267,7 +267,7 @@ export function McpPage(props: { hubHeader?: ModuleHubHeader }) {
   ) : null;
 
   const connectionsPanel = busy === 'load' || entries.length > 0 ? (
-    <div className="maka-module-page-panel" ref={rowsContainerRef} {...rovingRows}>
+    <div className="maka-module-page-panel maka-mcp-connections-panel" ref={rowsContainerRef} {...rovingRows}>
       {/* Selecting a row moves no focus, so nothing else would tell a screen
           reader that the details opened. This says so, politely. */}
       <p className="maka-visually-hidden" role="status" aria-live="polite">
@@ -303,7 +303,7 @@ export function McpPage(props: { hubHeader?: ModuleHubHeader }) {
            delete controls that used to ride the row now live in the
            inspector — no interactive elements inside an interactive list
            item. */
-        <List density="balanced" hasDividers className="maka-module-page-rows" aria-label={copy.page.connections}>
+        <List density="balanced" hasDividers aria-label={copy.page.connections} className="maka-module-page-rows">
           {connectionEntries.map(([serverId, server]) => {
             const status = statusById.get(serverId);
             const state = presentStatus(status, server.enabled !== false, copy);
@@ -405,31 +405,35 @@ export function McpPage(props: { hubHeader?: ModuleHubHeader }) {
           </div>
         )}
       >
-        {connectionsPanel}
-        <section className="maka-mcp-recommendations" aria-label={copy.page.recommended}>
-          <VStack gap={1}>
-            <Heading level={2}>{copy.page.recommended}</Heading>
-            <Text type="supporting" color="secondary">{copy.page.recommendedDetail}</Text>
+        <VStack gap={8} className="maka-mcp-sections">
+          {connectionsPanel && (
+            <VStack gap={3}>
+              <Heading level={3}>{copy.page.connections}</Heading>
+              {connectionsPanel}
+            </VStack>
+          )}
+          <VStack gap={3}>
+            <Heading level={3}>{copy.page.recommended}</Heading>
+            <Divider />
+            <Grid columns={{ minWidth: 320 }} gap={2}>
+              {MCP_SUGGESTIONS.map(({ id, url }) => (
+                <ClickableCard
+                  key={id}
+                  label={copy.page.suggestions[id].name}
+                  variant="transparent"
+                  padding={2}
+                  isDisabled={busy !== null}
+                  onClick={() => openSuggestedServer(id, url)}
+                >
+                  <VStack gap={0}>
+                    <Text type="body" weight="semibold">{copy.page.suggestions[id].name}</Text>
+                    <Text type="supporting" color="secondary">{copy.page.suggestions[id].description}</Text>
+                  </VStack>
+                </ClickableCard>
+              ))}
+            </Grid>
           </VStack>
-          <List density="balanced" className="maka-mcp-recommendations-list" aria-label={copy.page.recommended}>
-            {MCP_SUGGESTIONS.map(({ id, url }) => (
-              <ListItem
-                key={id}
-                label={copy.page.suggestions[id].name}
-                description={copy.page.suggestions[id].description}
-                endContent={<Plus size={ICON_SIZE.chrome} aria-hidden="true" />}
-                isDisabled={busy !== null}
-                onClick={() => openSuggestedServer(id, url)}
-              />
-            ))}
-          </List>
-          <Text type="supporting" color="secondary">
-            {copy.page.credentialGuides}{' '}
-            <Link href="https://developer.amap.com/api/mcp-server/gettingstarted" isExternalLink>{copy.page.amapGuide}</Link>
-            {' · '}
-            <Link href="https://developer.cloud.tencent.com/mcp/server/11803" isExternalLink>{copy.page.tencentDocsGuide}</Link>
-          </Text>
-        </section>
+        </VStack>
       </ModulePage>
 
       {editor && (
diff --git a/apps/desktop/src/renderer/locales/mcp-copy.ts b/apps/desktop/src/renderer/locales/mcp-copy.ts
index 1834ddfb1a..54a53cbe18 100644
--- a/apps/desktop/src/renderer/locales/mcp-copy.ts
+++ b/apps/desktop/src/renderer/locales/mcp-copy.ts
@@ -39,8 +39,8 @@ export type McpCopy = {
     toolbarAria: string; connections: string; localStdio: string; searchPlaceholder: string; searchAria: string;
     clearSearch: string; loading: string;
     noConnectionsMatch: string; noConnectionsMatchDetail(query: string): string;
-    recommended: string; recommendedDetail: string; credentialGuides: string; amapGuide: string; tencentDocsGuide: string;
-    suggestions: Record<'notion' | 'linear' | 'feishu' | 'maxcompute' | 'mcp-docs', { name: string; description: string }>;
+    recommended: string;
+    suggestions: Record<'notion' | 'linear' | 'feishu' | 'mcp-docs', { name: string; description: string }>;
   };
   detail: {
     label: string; enabled: string; transport: string;
@@ -90,18 +90,16 @@ const MCP_COPY = {
       actionsAria: 'MCP 操作', refreshing: '刷新中…', refresh: '刷新', add: '添加 MCP',
       metaConnections: (count) => `${count} 个连接`, metaErrors: (count) => `${count} 个连接异常`,
       searchMatches: (count) => `${count} 个匹配`,
-      toolbarAria: 'MCP 连接操作', connections: '连接', localStdio: '本地命令',
+      toolbarAria: 'MCP 连接操作', connections: '已添加', localStdio: '本地命令',
       searchPlaceholder: '搜索连接…', searchAria: '搜索 MCP 连接',
       clearSearch: '清空搜索', loading: '正在读取 MCP 连接…',
       noConnectionsMatch: '没有匹配的 MCP 连接', noConnectionsMatchDetail: (query) => `换一个关键词,或清空「${query}」查看全部连接。`,
-      recommended: '推荐的 MCP', recommendedDetail: '选择服务后确认连接信息并保存。',
-      credentialGuides: '需先准备凭据:', amapGuide: '高德地图(API Key)', tencentDocsGuide: '腾讯文档(Token)',
+      recommended: '推荐',
       suggestions: {
-        notion: { name: 'Notion', description: '工作区页面 · 需要登录' },
-        linear: { name: 'Linear', description: '问题与项目 · 需要登录' },
-        feishu: { name: '飞书', description: '飞书文档等 · 需要登录' },
-        maxcompute: { name: '阿里云 MaxCompute', description: '数据分析 · 首次需管理员授权' },
-        'mcp-docs': { name: 'MCP 官方文档', description: '搜索协议文档 · 无需登录' },
+        notion: { name: 'Notion', description: '访问工作区页面' },
+        linear: { name: 'Linear', description: '访问问题与项目' },
+        feishu: { name: '飞书', description: '访问飞书文档' },
+        'mcp-docs': { name: 'MCP 官方文档', description: '搜索协议文档' },
       },
     },
     detail: {
@@ -156,18 +154,16 @@ const MCP_COPY = {
       actionsAria: 'MCP 操作', refreshing: '重新整理中…', refresh: '重新整理', add: '新增 MCP',
       metaConnections: (count) => `${count} 個連線`, metaErrors: (count) => `${count} 個連線異常`,
       searchMatches: (count) => `${count} 個符合`,
-      toolbarAria: 'MCP 連線操作', connections: '連線', localStdio: '本地命令',
+      toolbarAria: 'MCP 連線操作', connections: '已新增', localStdio: '本地命令',
       searchPlaceholder: '搜尋連線…', searchAria: '搜尋 MCP 連線',
       clearSearch: '清空搜尋', loading: '正在讀取 MCP 連線…',
       noConnectionsMatch: '沒有符合的 MCP 連線', noConnectionsMatchDetail: (query) => `換一個關鍵詞,或清空「${query}」檢視全部連線。`,
-      recommended: '推薦的 MCP', recommendedDetail: '選擇服務後確認連線資訊並儲存。',
-      credentialGuides: '需先準備憑證:', amapGuide: '高德地圖(API Key)', tencentDocsGuide: '騰訊文件(Token)',
+      recommended: '推薦',
       suggestions: {
-        notion: { name: 'Notion', description: '工作區頁面 · 需要登入' },
-        linear: { name: 'Linear', description: '議題與專案 · 需要登入' },
-        feishu: { name: '飛書', description: '飛書文件等 · 需要登入' },
-        maxcompute: { name: '阿里雲 MaxCompute', description: '資料分析 · 首次需管理員授權' },
-        'mcp-docs': { name: 'MCP 官方文件', description: '搜尋協議文件 · 無需登入' },
+        notion: { name: 'Notion', description: '存取工作區頁面' },
+        linear: { name: 'Linear', description: '存取議題與專案' },
+        feishu: { name: '飛書', description: '存取飛書文件' },
+        'mcp-docs': { name: 'MCP 官方文件', description: '搜尋協議文件' },
       },
     },
     detail: {
@@ -222,18 +218,16 @@ const MCP_COPY = {
       actionsAria: 'MCP actions', refreshing: 'Refreshing…', refresh: 'Refresh', add: 'Add MCP',
       metaConnections: (count) => `${count} connections`, metaErrors: (count) => `${count} ${count === 1 ? 'connection error' : 'connection errors'}`,
       searchMatches: (count) => `${count} ${count === 1 ? 'match' : 'matches'}`,
-      toolbarAria: 'MCP connection controls', connections: 'Connections', localStdio: 'Local command',
+      toolbarAria: 'MCP connection controls', connections: 'Added', localStdio: 'Local command',
       searchPlaceholder: 'Search connections…', searchAria: 'Search MCP connections',
       clearSearch: 'Clear search', loading: 'Loading MCP connections…',
       noConnectionsMatch: 'No matching MCP connections', noConnectionsMatchDetail: (query) => `Try another keyword, or clear “${query}” to view every connection.`,
-      recommended: 'Recommended MCP servers', recommendedDetail: 'Choose a service, review its connection details, and save.',
-      credentialGuides: 'Credentials required:', amapGuide: 'Amap Maps (API key)', tencentDocsGuide: 'Tencent Docs (token)',
+      recommended: 'Recommended',
       suggestions: {
-        notion: { name: 'Notion', description: 'Workspace pages · Sign in required' },
-        linear: { name: 'Linear', description: 'Issues and projects · Sign in required' },
-        feishu: { name: 'Feishu', description: 'Documents and more · Sign in required' },
-        maxcompute: { name: 'Alibaba Cloud MaxCompute', description: 'Data analytics · Admin setup required first' },
-        'mcp-docs': { name: 'Official MCP docs', description: 'Search protocol docs · No sign-in' },
+        notion: { name: 'Notion', description: 'Access workspace pages' },
+        linear: { name: 'Linear', description: 'Access issues and projects' },
+        feishu: { name: 'Feishu', description: 'Access Feishu documents' },
+        'mcp-docs': { name: 'Official MCP docs', description: 'Search protocol docs' },
       },
     },
     detail: {
diff --git a/apps/desktop/src/renderer/styles/module-pages/mcp.css b/apps/desktop/src/renderer/styles/module-pages/mcp.css
index fec713050f..ddd86c4e57 100644
--- a/apps/desktop/src/renderer/styles/module-pages/mcp.css
+++ b/apps/desktop/src/renderer/styles/module-pages/mcp.css
@@ -56,23 +56,12 @@
   white-space: pre-wrap;
 }
 
-.maka-mcp-recommendations {
-  display: grid;
-  gap: var(--space-3);
-  padding-block: var(--space-3) var(--space-6);
-}
-
-.maka-mcp-recommendations-list {
-  min-width: 0;
-  display: grid;
-  grid-template-columns: repeat(2, minmax(0, 1fr));
-  gap: var(--space-2);
+.maka-mcp-sections {
+  padding-block: var(--space-4) var(--space-6);
 }
 
-@media (max-width: 680px) {
-  .maka-mcp-recommendations-list {
-    grid-template-columns: minmax(0, 1fr);
-  }
+.maka-mcp-connections-panel {
+  padding: 0;
 }
 
 .maka-mcp-manual-form,
diff --git a/apps/desktop/stories/module-hubs.stories.tsx b/apps/desktop/stories/module-hubs.stories.tsx
index 114334a209..ae8c160557 100644
--- a/apps/desktop/stories/module-hubs.stories.tsx
+++ b/apps/desktop/stories/module-hubs.stories.tsx
@@ -1039,7 +1039,7 @@ export const ExtensionsMcpSetupRequired: Story = {
   render: () => <ExtensionsMcpSurface />,
   play: async ({ canvasElement }) => {
     await waitForStoryText(canvasElement, '0 个连接');
-    await waitForStoryText(canvasElement, '推荐的 MCP');
+    await waitForStoryText(canvasElement, '推荐');
     await waitForStoryButton(canvasElement, (button) => button.textContent?.trim() === '添加 MCP' && !button.disabled);
     if (canvasElement.querySelector('.maka-module-page-panel')) {
       throw new Error('Empty MCP connections must not push recommendations below an empty panel');
@@ -1053,14 +1053,14 @@ export const ExtensionsMcpSetupRequired: Story = {
   },
 };
 
-// Real path: sidebar → 扩展 → MCP → 推荐的 MCP → Notion, before saving.
+// Real path: sidebar → 扩展 → MCP → 推荐 → Notion, before saving.
 export const ExtensionsMcpRecommended: Story = {
   decorators: [withConfiguredMcpBridge],
   render: () => <ExtensionsMcpSurface />,
   play: async ({ canvasElement }) => {
     await waitForStoryText(canvasElement, 'filesystem');
-    await waitForStoryText(canvasElement, '推荐的 MCP');
-    (await waitForStoryButton(canvasElement, (button) => button.textContent?.includes('Notion') === true)).click();
+    await waitForStoryText(canvasElement, '推荐');
+    (await waitForStoryButton(canvasElement, (button) => button.getAttribute('aria-label') === 'Notion')).click();
     const body = canvasElement.ownerDocument.body;
     const fields = await waitForStorySelector<HTMLElement>(body, '.maka-mcp-primary-fields');
     const inputs = [...fields.querySelectorAll<HTMLInputElement>('input')];
@@ -1093,7 +1093,7 @@ export const ExtensionsMcpJsonImport: Story = {
   render: () => <ExtensionsMcpSurface />,
   play: async ({ canvasElement }) => {
     await waitForStoryText(canvasElement, 'filesystem');
-    await waitForStoryText(canvasElement, '推荐的 MCP');
+    await waitForStoryText(canvasElement, '推荐');
     (await waitForStoryButton(canvasElement, (button) => button.textContent?.trim() === '添加 MCP' && !button.disabled)).click();
     const body = canvasElement.ownerDocument.body;
     (await waitForStoryButton(body, (button) => button.textContent?.trim() === '粘贴 JSON')).click();
diff --git a/docs/astryx-surface-file-inventory.md b/docs/astryx-surface-file-inventory.md
index 3199a7d860..a8dca4b0b9 100644
--- a/docs/astryx-surface-file-inventory.md
+++ b/docs/astryx-surface-file-inventory.md
@@ -70,7 +70,7 @@ Wiki bar: Design Conventions · API Use-the-System · Theming · Container Paddi
 | `apps/desktop/src/renderer/features/goals/ui/goal-host.tsx` | other | none | aligned — no raw controls; no Astryx JSX usage | aligned |
 | `apps/desktop/src/renderer/features/goals/ui/goal-provider.tsx` | other | none | aligned — no raw controls; no Astryx JSX usage | aligned |
 | `apps/desktop/src/renderer/features/module-hub/services-context.tsx` | other | none | aligned — no raw controls; no Astryx JSX usage | aligned |
-| `apps/desktop/src/renderer/features/module-hub/ui/mcp-page.tsx` | module-hub | Banner, Button, Collapsible, Dialog, DialogHeader, Divider, EmptyState, HStack, Heading, IconButton, Layout, LayoutContent, List, ListItem, MetadataList, MetadataListItem, SegmentedControl, SegmentedControlItem, Selector, Skeleton, StackItem, StatusDot, Switch, Text, TextArea, TextInput, Toolbar, VStack | aligned — uses Astryx (Banner, Button, Collapsible, Dialog, DialogHeader, Divider, EmptyState, HStack) | [...]
+| `apps/desktop/src/renderer/features/module-hub/ui/mcp-page.tsx` | module-hub | Banner, Button, ClickableCard, Collapsible, Dialog, DialogHeader, Divider, EmptyState, Grid, HStack, Heading, IconButton, Layout, LayoutContent, List, ListItem, MetadataList, MetadataListItem, SegmentedControl, SegmentedControlItem, Selector, Skeleton, StackItem, StatusDot, Switch, Text, TextArea, TextInput, Toolbar, VStack | aligned — uses Astryx (Banner, Button, ClickableCard, Collapsible, Dialog, DialogHe [...]
 | `apps/desktop/src/renderer/features/module-hub/ui/module-hub-host.tsx` | other | none | aligned — no raw controls; no Astryx JSX usage | aligned |
 | `apps/desktop/src/renderer/features/module-hub/ui/module-hub-provider.tsx` | other | none | aligned — no raw controls; no Astryx JSX usage | aligned |
 | `apps/desktop/src/renderer/features/overlays/services-context.tsx` | other | none | aligned — no raw controls; no Astryx JSX usage | aligned |


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org