Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

feat: add intergration Detail Content and skill list

rdmclin2641de4c3ef80
diff --git a/locales/en-US/plugin.json b/locales/en-US/plugin.json
index f2306e205a9..025dea56b5c 100644
--- a/locales/en-US/plugin.json
+++ b/locales/en-US/plugin.json
@@ -351,6 +351,8 @@
"integrationDetail.author": "Author",
"integrationDetail.details": "Details",
"integrationDetail.developedBy": "Developed by",
+ "integrationDetail.tabs.overview": "Overview",
+ "integrationDetail.tabs.tools": "Tools",
"integrationDetail.tools": "Tools",
"integrationDetail.trustWarning": "Only use connectors from developers you trust. LobeHub does not control which tools developers make available and cannot verify that they will work as intended or that they won't change.",
"list.item.deprecated.title": "Deleted",
diff --git a/locales/zh-CN/plugin.json b/locales/zh-CN/plugin.json
index 687a3812763..be958fa96e3 100644
--- a/locales/zh-CN/plugin.json
+++ b/locales/zh-CN/plugin.json
@@ -351,6 +351,8 @@
"integrationDetail.author": "作者",
"integrationDetail.details": "详情",
"integrationDetail.developedBy": "开发者",
+ "integrationDetail.tabs.overview": "概览",
+ "integrationDetail.tabs.tools": "技能列表",
"integrationDetail.tools": "工具",
"integrationDetail.trustWarning": "请仅使用您信任的开发者提供的连接器。LobeHub 无法控制开发者提供哪些工具,也无法验证这些工具是否按预期工作或是否会发生变化。",
"list.item.deprecated.title": "已删除",
diff --git a/src/features/IntegrationDetailModal/DetailProvider.tsx b/src/features/IntegrationDetailModal/DetailProvider.tsx
new file mode 100644
index 00000000000..e8c709dc47c
--- /dev/null
+++ b/src/features/IntegrationDetailModal/DetailProvider.tsx
@@ -0,0 +1,115 @@
+'use client';
+
+import {
+ type KlavisServerType,
+ type LobehubSkillProviderType,
+ getKlavisServerByServerIdentifier,
+ getLobehubSkillProviderById,
+} from '@lobechat/const';
+import type { Klavis } from 'klavis';
+import React, { type ReactNode, createContext, useContext, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useToolStore } from '@/store/tool';
+import { klavisStoreSelectors, lobehubSkillStoreSelectors } from '@/store/tool/selectors';
+import { KlavisServerStatus } from '@/store/tool/slices/klavisStore';
+import { LobehubSkillStatus } from '@/store/tool/slices/lobehubSkillStore/types';
+
+export type IntegrationType = 'klavis' | 'lobehub';
+
+export interface DetailContextValue {
+ author: string;
+ authorUrl?: string;
+ config: KlavisServerType | LobehubSkillProviderType;
+ description: string;
+ icon: string | React.ComponentType<any>;
+ identifier: string;
+ introduction: string;
+ isConnected: boolean;
+ label: string;
+ localizedDescription: string;
+ localizedIntroduction: string;
+ serverName?: Klavis.McpServerName;
+ type: IntegrationType;
+}
+
+const DetailContext = createContext<DetailContextValue | null>(null);
+
+export const useDetailContext = () => {
+ const context = useContext(DetailContext);
+ if (!context) {
+ throw new Error('useDetailContext must be used within DetailProvider');
+ }
+ return context;
+};
+
+interface DetailProviderProps {
+ children: ReactNode;
+ identifier: string;
+ serverName?: Klavis.McpServerName;
+ type: IntegrationType;
+}
+
+export const DetailProvider = ({ children, type, identifier, serverName }: DetailProviderProps) => {
+ const { t } = useTranslation(['setting']);
+
+ const config = useMemo((): KlavisServerType | LobehubSkillProviderType | undefined => {
+ if (type === 'klavis') {
+ return getKlavisServerByServerIdentifier(identifier);
+ }
+ return getLobehubSkillProviderById(identifier);
+ }, [type, identifier]);
+
+ const klavisServers = useToolStore(klavisStoreSelectors.getServers);
+ const lobehubSkillServers = useToolStore(lobehubSkillStoreSelectors.getServers);
+
+ const serverState = useMemo(() => {
+ if (type === 'klavis') {
+ return klavisServers.find((s) => s.identifier === identifier);
+ }
+ return lobehubSkillServers.find((s) => s.identifier === identifier);
+ }, [type, identifier, klavisServers, lobehubSkillServers]);
+
+ const isConnected = useMemo(() => {
+ if (!serverState) return false;
+ if (type === 'klavis') {
+ return serverState.status === KlavisServerStatus.CONNECTED;
+ }
+ return serverState.status === LobehubSkillStatus.CONNECTED;
+ }, [type, serverState]);
+
+ if (!config) return null;
+
+ const { author, authorUrl, description, icon, introduction, label } = config;
+
+ const i18nIdentifier =
+ type === 'klavis'
+ ? (config as KlavisServerType).identifier
+ : (config as LobehubSkillProviderType).id;
+ const i18nPrefix = type === 'klavis' ? 'tools.klavis.servers' : 'tools.lobehubSkill.providers';
+
+ const localizedDescription = t(`${i18nPrefix}.${i18nIdentifier}.description`, {
+ defaultValue: description,
+ });
+ const localizedIntroduction = t(`${i18nPrefix}.${i18nIdentifier}.introduction`, {
+ defaultValue: introduction,
+ });
+
+ const value: DetailContextValue = {
+ author,
+ authorUrl,
+ config,
+ description,
+ icon,
+ identifier,
+ introduction,
+ isConnected,
+ label,
+ localizedDescription,
+ localizedIntroduction,
+ serverName,
+ type,
+ };
+
+ return <DetailContext.Provider value={value}>{children}</DetailContext.Provider>;
+};
diff --git a/src/features/IntegrationDetailModal/Header.tsx b/src/features/IntegrationDetailModal/Header.tsx
new file mode 100644
index 00000000000..3e2de888832
--- /dev/null
+++ b/src/features/IntegrationDetailModal/Header.tsx
@@ -0,0 +1,101 @@
+'use client';
+
+import { Flexbox, Icon, Text, useModalContext } from '@lobehub/ui';
+import { Button } from 'antd';
+import { cssVar } from 'antd-style';
+import { Loader2, SquareArrowOutUpRight } from 'lucide-react';
+import { memo, useEffect, useRef } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useSkillConnect } from '@/features/SkillStore/LobeHubList/useSkillConnect';
+
+import { useDetailContext } from './DetailProvider';
+import { ICON_SIZE, styles } from './styles';
+
+const Header = memo(() => {
+ const { t } = useTranslation(['setting']);
+ const { close } = useModalContext();
+ const { type, identifier, serverName, icon, label, localizedDescription, isConnected } =
+ useDetailContext();
+
+ const {
+ handleConnect,
+ isConnecting,
+ isConnected: hookIsConnected,
+ } = useSkillConnect({
+ identifier,
+ serverName,
+ type,
+ });
+
+ const hasTriggeredConnectRef = useRef(false);
+
+ useEffect(() => {
+ if (hasTriggeredConnectRef.current && hookIsConnected) {
+ close();
+ }
+ }, [hookIsConnected, close]);
+
+ const handleConnectWithTracking = async () => {
+ hasTriggeredConnectRef.current = true;
+ await handleConnect();
+ };
+
+ const renderIcon = () => {
+ if (typeof icon === 'string') {
+ return (
+ <img
+ alt={label}
+ src={icon}
+ style={{ maxHeight: ICON_SIZE, maxWidth: ICON_SIZE, objectFit: 'contain' }}
+ />
+ );
+ }
+ return <Icon fill={cssVar.colorText} icon={icon as any} size={ICON_SIZE} />;
+ };
+
+ const renderConnectButton = () => {
+ if (isConnected) return null;
+
+ if (isConnecting) {
+ return (
+ <Button disabled icon={<Icon icon={Loader2} spin />} type="default">
+ {t('tools.klavis.connect', { defaultValue: 'Connect' })}
+ </Button>
+ );
+ }
+
+ return (
+ <Button
+ icon={<Icon icon={SquareArrowOutUpRight} />}
+ onClick={handleConnectWithTracking}
+ type="primary"
+ >
+ {t('tools.klavis.connect', { defaultValue: 'Connect' })}
+ </Button>
+ );
+ };
+
+ return (
+ <Flexbox
+ align="center"
+ className={styles.header}
+ horizontal
+ justify="space-between"
+ style={{ flexWrap: 'nowrap' }}
+ >
+ <Flexbox align="center" gap={16} horizontal>
+ <div className={styles.icon}>{renderIcon()}</div>
+ <Flexbox gap={4}>
+ <span className={styles.title}>{label}</span>
+ <Text style={{ fontSize: 14 }} type="secondary">
+ {localizedDescription}
+ </Text>
+ </Flexbox>
+ </Flexbox>
+ {renderConnectButton()}
+ </Flexbox>
+ );
+});
+
+export default Header;
diff --git a/src/features/IntegrationDetailModal/IntegrationDetailContent.tsx b/src/features/IntegrationDetailModal/IntegrationDetailContent.tsx
index 4d27e073564..8b0698b9565 100644
--- a/src/features/IntegrationDetailModal/IntegrationDetailContent.tsx
+++ b/src/features/IntegrationDetailModal/IntegrationDetailContent.tsx
@@ -1,101 +1,18 @@
'use client';
-import {
- type KlavisServerType,
- type LobehubSkillProviderType,
- getKlavisServerByServerIdentifier,
- getLobehubSkillProviderById,
-} from '@lobechat/const';
-import { Flexbox, Icon, Tag, Text, Typography, useModalContext } from '@lobehub/ui';
-import { Button, Divider } from 'antd';
-import { createStaticStyles, cssVar } from 'antd-style';
+import { Flexbox } from '@lobehub/ui';
import type { Klavis } from 'klavis';
-import { ExternalLink, Loader2, SquareArrowOutUpRight } from 'lucide-react';
-import { useEffect, useMemo, useRef } from 'react';
-import { useTranslation } from 'react-i18next';
+import { useState } from 'react';
-import { useSkillConnect } from '@/features/SkillStore/LobeHubList/useSkillConnect';
import { useToolStore } from '@/store/tool';
-import { klavisStoreSelectors, lobehubSkillStoreSelectors } from '@/store/tool/selectors';
-import { KlavisServerStatus } from '@/store/tool/slices/klavisStore';
-import { LobehubSkillStatus } from '@/store/tool/slices/lobehubSkillStore/types';
-const ICON_SIZE = 56;
+import { DetailProvider, type IntegrationType } from './DetailProvider';
+import Header from './Header';
+import Nav, { type TabKey } from './Nav';
+import Overview from './Overview';
+import ToolList from './ToolList';
-const styles = createStaticStyles(({ css, cssVar }) => ({
- authorLink: css`
- cursor: pointer;
-
- display: inline-flex;
- gap: 4px;
- align-items: center;
-
- color: ${cssVar.colorPrimary};
-
- &:hover {
- text-decoration: underline;
- }
- `,
- detailItem: css`
- display: flex;
- flex-direction: column;
- gap: 4px;
- `,
- detailLabel: css`
- font-size: 12px;
- color: ${cssVar.colorTextTertiary};
- `,
- header: css`
- display: flex;
- gap: 16px;
- align-items: center;
-
- padding: 16px;
- border-radius: 12px;
-
- background: ${cssVar.colorFillTertiary};
- `,
- icon: css`
- display: flex;
- flex-shrink: 0;
- align-items: center;
- justify-content: center;
-
- width: ${ICON_SIZE}px;
- height: ${ICON_SIZE}px;
- `,
- introduction: css`
- font-size: 14px;
- line-height: 1.8;
- color: ${cssVar.colorText};
- `,
- sectionTitle: css`
- font-size: 14px;
- font-weight: 600;
- color: ${cssVar.colorText};
- `,
- title: css`
- font-size: 18px;
- font-weight: 600;
- color: ${cssVar.colorText};
- `,
- toolTag: css`
- font-family: ${cssVar.fontFamilyCode};
- font-size: 12px;
- `,
- toolsContainer: css`
- display: flex;
- flex-wrap: wrap;
- gap: 8px;
- `,
- trustWarning: css`
- font-size: 12px;
- line-height: 1.6;
- color: ${cssVar.colorTextTertiary};
- `,
-}));
-
-export type IntegrationType = 'klavis' | 'lobehub';
+export type { IntegrationType } from './DetailProvider';
export interface IntegrationDetailContentProps {
identifier: string;
@@ -108,202 +25,24 @@ export const IntegrationDetailContent = ({
identifier,
serverName,
}: IntegrationDetailContentProps) => {
- const { t } = useTranslation(['plugin', 'setting']);
- const { close } = useModalContext();
-
- const {
- handleConnect,
- isConnecting,
- isConnected: hookIsConnected,
- } = useSkillConnect({
- identifier,
- serverName,
- type,
- });
-
- const hasTriggeredConnectRef = useRef(false);
-
- useEffect(() => {
- if (hasTriggeredConnectRef.current && hookIsConnected) {
- close();
- }
- }, [hookIsConnected, close]);
-
- const handleConnectWithTracking = async () => {
- hasTriggeredConnectRef.current = true;
- await handleConnect();
- };
-
- const config = useMemo((): KlavisServerType | LobehubSkillProviderType | undefined => {
- if (type === 'klavis') {
- return getKlavisServerByServerIdentifier(identifier);
- }
- return getLobehubSkillProviderById(identifier);
- }, [type, identifier]);
-
- const klavisServers = useToolStore(klavisStoreSelectors.getServers);
- const lobehubSkillServers = useToolStore(lobehubSkillStoreSelectors.getServers);
-
- const serverState = useMemo(() => {
- if (type === 'klavis') {
- return klavisServers.find((s) => s.identifier === identifier);
- }
- return lobehubSkillServers.find((s) => s.identifier === identifier);
- }, [type, identifier, klavisServers, lobehubSkillServers]);
-
- const isConnected = useMemo(() => {
- if (!serverState) return false;
- if (type === 'klavis') {
- return serverState.status === KlavisServerStatus.CONNECTED;
- }
- return serverState.status === LobehubSkillStatus.CONNECTED;
- }, [type, serverState]);
-
- const tools = useMemo(() => {
- return serverState?.tools?.map((tool) => tool.name) || [];
- }, [serverState]);
+ const [activeTab, setActiveTab] = useState<TabKey>('overview');
- if (!config) return null;
-
- const { author, authorUrl, description, icon, introduction, label } = config;
-
- const i18nIdentifier =
- type === 'klavis'
- ? (config as KlavisServerType).identifier
- : (config as LobehubSkillProviderType).id;
- const i18nPrefix = type === 'klavis' ? 'tools.klavis.servers' : 'tools.lobehubSkill.providers';
-
- const localizedDescription = t(`${i18nPrefix}.${i18nIdentifier}.description`, {
- defaultValue: description,
- ns: 'setting',
- });
- const localizedIntroduction = t(`${i18nPrefix}.${i18nIdentifier}.introduction`, {
- defaultValue: introduction,
- ns: 'setting',
- });
-
- const renderIcon = () => {
- if (typeof icon === 'string') {
- return (
- <img
- alt={label}
- src={icon}
- style={{ maxHeight: ICON_SIZE, maxWidth: ICON_SIZE, objectFit: 'contain' }}
- />
- );
- }
- return <Icon fill={cssVar.colorText} icon={icon} size={ICON_SIZE} />;
- };
-
- const handleAuthorClick = () => {
- if (authorUrl) {
- window.open(authorUrl, '_blank', 'noopener,noreferrer');
- }
- };
-
- const renderConnectButton = () => {
- if (isConnected) return null;
-
- if (isConnecting) {
- return (
- <Button disabled icon={<Icon icon={Loader2} spin />} type="default">
- {t('tools.klavis.connect', { defaultValue: 'Connect', ns: 'setting' })}
- </Button>
- );
- }
-
- return (
- <Button
- icon={<Icon icon={SquareArrowOutUpRight} />}
- onClick={handleConnectWithTracking}
- type="primary"
- >
- {t('tools.klavis.connect', { defaultValue: 'Connect', ns: 'setting' })}
- </Button>
- );
- };
+ // Fetch tools count for Nav badge (always fetch to show count in tab)
+ const { data: klavisTools = [] } = useToolStore((s) =>
+ s.useFetchServerTools(type === 'klavis' ? serverName : undefined),
+ );
+ const { data: lobehubTools = [] } = useToolStore((s) =>
+ s.useFetchProviderTools(type === 'lobehub' ? identifier : undefined),
+ );
+ const toolsCount = type === 'klavis' ? klavisTools.length : lobehubTools.length;
return (
- <Flexbox gap={20}>
- {/* Header */}
- <Flexbox
- align="center"
- className={styles.header}
- horizontal
- justify="space-between"
- style={{ flexWrap: 'nowrap' }}
- >
- <Flexbox align="center" gap={16} horizontal>
- <div className={styles.icon}>{renderIcon()}</div>
- <Flexbox gap={4}>
- <span className={styles.title}>{label}</span>
- <Text style={{ fontSize: 14 }} type="secondary">
- {localizedDescription}
- </Text>
- </Flexbox>
- </Flexbox>
- {renderConnectButton()}
- </Flexbox>
-
- {/* Introduction */}
- <Typography className={styles.introduction}>{localizedIntroduction}</Typography>
-
- {/* Developed by */}
- <Flexbox gap={8}>
- <Flexbox align="center" gap={4} horizontal>
- <span className={styles.sectionTitle}>{t('integrationDetail.developedBy')}</span>
- <span
- className={styles.authorLink}
- onClick={handleAuthorClick}
- style={{ cursor: authorUrl ? 'pointer' : 'default' }}
- >
- {author}
- {authorUrl && <Icon icon={ExternalLink} size={12} />}
- </span>
- </Flexbox>
- <Text className={styles.trustWarning} type="secondary">
- {t('integrationDetail.trustWarning')}
- </Text>
- </Flexbox>
-
- {/* Tools */}
- {tools.length > 0 && (
- <>
- <Divider style={{ margin: 0 }} />
- <Flexbox gap={12}>
- <Flexbox align="center" gap={8} horizontal>
- <span className={styles.sectionTitle}>{t('integrationDetail.tools')}</span>
- <Tag>{tools.length}</Tag>
- </Flexbox>
- <div className={styles.toolsContainer}>
- {tools.map((tool) => (
- <Tag className={styles.toolTag} key={tool}>
- {tool}
- </Tag>
- ))}
- </div>
- </Flexbox>
- </>
- )}
-
- {/* Details */}
- <Divider style={{ margin: 0 }} />
- <Flexbox gap={12}>
- <span className={styles.sectionTitle}>{t('integrationDetail.details')}</span>
- <Flexbox gap={16} horizontal>
- <div className={styles.detailItem}>
- <span className={styles.detailLabel}>{t('integrationDetail.author')}</span>
- <span
- className={styles.authorLink}
- onClick={handleAuthorClick}
- style={{ cursor: authorUrl ? 'pointer' : 'default' }}
- >
- {author}
- {authorUrl && <Icon icon={ExternalLink} size={12} />}
- </span>
- </div>
- </Flexbox>
+ <DetailProvider identifier={identifier} serverName={serverName} type={type}>
+ <Flexbox gap={16}>
+ <Header />
+ <Nav activeTab={activeTab} setActiveTab={setActiveTab} toolsCount={toolsCount} />
+ {activeTab === 'overview' ? <Overview /> : <ToolList />}
</Flexbox>
- </Flexbox>
+ </DetailProvider>
);
};
diff --git a/src/features/IntegrationDetailModal/Nav.tsx b/src/features/IntegrationDetailModal/Nav.tsx
new file mode 100644
index 00000000000..2803ce6e47d
--- /dev/null
+++ b/src/features/IntegrationDetailModal/Nav.tsx
@@ -0,0 +1,48 @@
+'use client';
+
+import { Flexbox, Icon, Tabs, Tag } from '@lobehub/ui';
+import { BookOpenIcon, ListIcon } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { styles } from './styles';
+
+export type TabKey = 'overview' | 'tools';
+
+interface NavProps {
+ activeTab: TabKey;
+ setActiveTab: (tab: TabKey) => void;
+ toolsCount: number;
+}
+
+const Nav = memo<NavProps>(({ activeTab, setActiveTab, toolsCount }) => {
+ const { t } = useTranslation(['plugin']);
+
+ return (
+ <Flexbox className={styles.nav}>
+ <Tabs
+ activeKey={activeTab}
+ items={[
+ {
+ icon: <Icon icon={BookOpenIcon} size={16} />,
+ key: 'overview',
+ label: t('integrationDetail.tabs.overview'),
+ },
+ {
+ icon: <Icon icon={ListIcon} size={16} />,
+ key: 'tools',
+ label: (
+ <Flexbox align="center" gap={6} horizontal style={{ display: 'inline-flex' }}>
+ {t('integrationDetail.tabs.tools')}
+ {toolsCount > 0 && <Tag>{toolsCount}</Tag>}
+ </Flexbox>
+ ),
+ },
+ ]}
+ onChange={(key) => setActiveTab(key as TabKey)}
+ />
+ </Flexbox>
+ );
+});
+
+export default Nav;
diff --git a/src/features/IntegrationDetailModal/Overview.tsx b/src/features/IntegrationDetailModal/Overview.tsx
new file mode 100644
index 00000000000..ed1453c7a94
--- /dev/null
+++ b/src/features/IntegrationDetailModal/Overview.tsx
@@ -0,0 +1,65 @@
+'use client';
+
+import { Flexbox, Icon, Text, Typography } from '@lobehub/ui';
+import { ExternalLink } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useDetailContext } from './DetailProvider';
+import { styles } from './styles';
+
+const Overview = memo(() => {
+ const { t } = useTranslation(['plugin']);
+ const { author, authorUrl, localizedIntroduction } = useDetailContext();
+
+ const handleAuthorClick = () => {
+ if (authorUrl) {
+ window.open(authorUrl, '_blank', 'noopener,noreferrer');
+ }
+ };
+
+ return (
+ <Flexbox gap={20}>
+ {/* Introduction */}
+ <Typography className={styles.introduction}>{localizedIntroduction}</Typography>
+
+ {/* Developed by */}
+ <Flexbox gap={8}>
+ <Flexbox align="center" gap={4} horizontal>
+ <span className={styles.sectionTitle}>{t('integrationDetail.developedBy')}</span>
+ <span
+ className={styles.authorLink}
+ onClick={handleAuthorClick}
+ style={{ cursor: authorUrl ? 'pointer' : 'default' }}
+ >
+ {author}
+ {authorUrl && <Icon icon={ExternalLink} size={12} />}
+ </span>
+ </Flexbox>
+ <Text className={styles.trustWarning} type="secondary">
+ {t('integrationDetail.trustWarning')}
+ </Text>
+ </Flexbox>
+
+ {/* Details */}
+ <Flexbox gap={12}>
+ <span className={styles.sectionTitle}>{t('integrationDetail.details')}</span>
+ <Flexbox gap={16} horizontal>
+ <div className={styles.detailItem}>
+ <span className={styles.detailLabel}>{t('integrationDetail.author')}</span>
+ <span
+ className={styles.authorLink}
+ onClick={handleAuthorClick}
+ style={{ cursor: authorUrl ? 'pointer' : 'default' }}
+ >
+ {author}
+ {authorUrl && <Icon icon={ExternalLink} size={12} />}
+ </span>
+ </div>
+ </Flexbox>
+ </Flexbox>
+ </Flexbox>
+ );
+});
+
+export default Overview;
diff --git a/src/features/IntegrationDetailModal/ToolList.tsx b/src/features/IntegrationDetailModal/ToolList.tsx
new file mode 100644
index 00000000000..ae2da2867ff
--- /dev/null
+++ b/src/features/IntegrationDetailModal/ToolList.tsx
@@ -0,0 +1,98 @@
+'use client';
+
+import { Block, Collapse, Empty, Flexbox, Highlighter, Icon, Markdown, Text } from '@lobehub/ui';
+import { Loader2, Wrench } from 'lucide-react';
+import { memo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useToolStore } from '@/store/tool';
+
+import { useDetailContext } from './DetailProvider';
+import { styles } from './styles';
+
+interface ToolItem {
+ description?: string;
+ inputSchema?: any;
+ name: string;
+}
+
+const ToolList = memo(() => {
+ const { t } = useTranslation(['plugin', 'discover']);
+ const { type, identifier, serverName } = useDetailContext();
+ const [activeKey, setActiveKey] = useState<string[]>([]);
+
+ // Fetch tools using SWR hooks from store
+ const { data: klavisTools = [], isLoading: klavisToolsLoading } = useToolStore((s) =>
+ s.useFetchServerTools(type === 'klavis' ? serverName : undefined),
+ );
+ const { data: lobehubTools = [], isLoading: lobehubToolsLoading } = useToolStore((s) =>
+ s.useFetchProviderTools(type === 'lobehub' ? identifier : undefined),
+ );
+
+ const tools: ToolItem[] = type === 'klavis' ? klavisTools : lobehubTools;
+ const isLoading = type === 'klavis' ? klavisToolsLoading : lobehubToolsLoading;
+
+ if (isLoading) {
+ return (
+ <Flexbox align="center" justify="center" style={{ minHeight: 200 }}>
+ <Icon icon={Loader2} size={24} spin />
+ </Flexbox>
+ );
+ }
+
+ if (tools.length === 0) {
+ return (
+ <Block variant="outlined">
+ <Empty
+ description={t('mcpEmpty.tools')}
+ descriptionProps={{ fontSize: 14 }}
+ icon={Wrench}
+ style={{ maxWidth: 400 }}
+ />
+ </Block>
+ );
+ }
+
+ return (
+ <Collapse
+ activeKey={activeKey}
+ expandIconPlacement="end"
+ gap={8}
+ items={tools.map((item) => ({
+ children: (
+ <Flexbox gap={16}>
+ {item.description && (
+ <Flexbox gap={8}>
+ <span className={styles.sectionTitle}>
+ {t('mcp.details.schema.tools.instructions', { ns: 'discover' })}
+ </span>
+ <Markdown>{item.description}</Markdown>
+ </Flexbox>
+ )}
+ {item.inputSchema && (
+ <Flexbox gap={8}>
+ <span className={styles.sectionTitle}>
+ {t('mcp.details.schema.tools.inputSchema', { ns: 'discover' })}
+ </span>
+ <Highlighter language="json" style={{ fontSize: 12 }} variant="borderless">
+ {JSON.stringify(item.inputSchema, null, 2)}
+ </Highlighter>
+ </Flexbox>
+ )}
+ </Flexbox>
+ ),
+ desc: item.description && (
+ <Text ellipsis style={{ maxWidth: 500 }} type="secondary">
+ {item.description}
+ </Text>
+ ),
+ key: item.name,
+ label: <span className={styles.code}>{item.name}</span>,
+ }))}
+ onChange={setActiveKey}
+ variant="outlined"
+ />
+ );
+});
+
+export default ToolList;
diff --git a/src/features/IntegrationDetailModal/styles.ts b/src/features/IntegrationDetailModal/styles.ts
new file mode 100644
index 00000000000..7d51f241bd8
--- /dev/null
+++ b/src/features/IntegrationDetailModal/styles.ts
@@ -0,0 +1,73 @@
+import { createStaticStyles } from 'antd-style';
+
+export const ICON_SIZE = 56;
+
+export const styles = createStaticStyles(({ css, cssVar }) => ({
+ authorLink: css`
+ cursor: pointer;
+
+ display: inline-flex;
+ gap: 4px;
+ align-items: center;
+
+ color: ${cssVar.colorPrimary};
+
+ &:hover {
+ text-decoration: underline;
+ }
+ `,
+ code: css`
+ font-family: ${cssVar.fontFamilyCode};
+ `,
+ detailItem: css`
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ `,
+ detailLabel: css`
+ font-size: 12px;
+ color: ${cssVar.colorTextTertiary};
+ `,
+ header: css`
+ display: flex;
+ gap: 16px;
+ align-items: center;
+
+ padding: 16px;
+ border-radius: 12px;
+
+ background: ${cssVar.colorFillTertiary};
+ `,
+ icon: css`
+ display: flex;
+ flex-shrink: 0;
+ align-items: center;
+ justify-content: center;
+
+ width: ${ICON_SIZE}px;
+ height: ${ICON_SIZE}px;
+ `,
+ introduction: css`
+ font-size: 14px;
+ line-height: 1.8;
+ color: ${cssVar.colorText};
+ `,
+ nav: css`
+ border-block-end: 1px solid ${cssVar.colorBorder};
+ `,
+ sectionTitle: css`
+ font-size: 14px;
+ font-weight: 600;
+ color: ${cssVar.colorText};
+ `,
+ title: css`
+ font-size: 18px;
+ font-weight: 600;
+ color: ${cssVar.colorText};
+ `,
+ trustWarning: css`
+ font-size: 12px;
+ line-height: 1.6;
+ color: ${cssVar.colorTextTertiary};
+ `,
+}));
diff --git a/src/locales/default/plugin.ts b/src/locales/default/plugin.ts
index 16e40506c91..48f7c392e97 100644
--- a/src/locales/default/plugin.ts
+++ b/src/locales/default/plugin.ts
@@ -356,6 +356,8 @@ export default {
'integrationDetail.author': 'Author',
'integrationDetail.details': 'Details',
'integrationDetail.developedBy': 'Developed by',
+ 'integrationDetail.tabs.overview': 'Overview',
+ 'integrationDetail.tabs.tools': 'Tools',
'integrationDetail.tools': 'Tools',
'integrationDetail.trustWarning':
"Only use connectors from developers you trust. LobeHub does not control which tools developers make available and cannot verify that they will work as intended or that they won't change.",
diff --git a/src/server/routers/tools/klavis.ts b/src/server/routers/tools/klavis.ts
index fc93b010991..80a1bf3ef4b 100644
--- a/src/server/routers/tools/klavis.ts
+++ b/src/server/routers/tools/klavis.ts
@@ -1,7 +1,7 @@
import { z } from 'zod';
import { getKlavisClient } from '@/libs/klavis';
-import { authedProcedure, router } from '@/libs/trpc/lambda';
+import { authedProcedure, publicProcedure, router } from '@/libs/trpc/lambda';
import { MCPService } from '@/server/services/mcp';
/**
@@ -59,6 +59,24 @@ export const klavisRouter = router({
return processedResult;
}),
+ /**
+ * Get tools by server name (public endpoint, no auth required)
+ */
+ getTools: publicProcedure
+ .input(
+ z.object({
+ serverName: z.string(),
+ }),
+ )
+ .query(async ({ input }) => {
+ const klavisClient = getKlavisClient();
+ const response = await klavisClient.mcpServer.getTools(input.serverName as any);
+
+ return {
+ tools: response.tools,
+ };
+ }),
+
/**
* List tools available on a Klavis Strata server
*/
diff --git a/src/store/tool/slices/klavisStore/action.ts b/src/store/tool/slices/klavisStore/action.ts
index 1dc31914c7a..dbed519e067 100644
--- a/src/store/tool/slices/klavisStore/action.ts
+++ b/src/store/tool/slices/klavisStore/action.ts
@@ -53,6 +53,12 @@ export interface KlavisStoreAction {
*/
removeKlavisServer: (identifier: string) => Promise<void>;
+ /**
+ * Use SWR to fetch tools for a Klavis server by serverName
+ * @param serverName - Klavis server name (e.g., 'Google Calendar')
+ */
+ useFetchServerTools: (serverName: string | undefined) => SWRResponse<KlavisTool[]>;
+
/**
* Use SWR to fetch user's Klavis server list
* @param enabled - Whether to enable fetching
@@ -339,6 +345,23 @@ export const createKlavisStoreSlice: StateCreator<
}
},
+ useFetchServerTools: (serverName) =>
+ useSWR<KlavisTool[]>(
+ serverName ? `klavis-server-tools-${serverName}` : null,
+ async () => {
+ const response = await toolsClient.klavis.getTools.query({ serverName: serverName! });
+ return (response.tools || []).map((tool: any) => ({
+ description: tool.description,
+ inputSchema: tool.inputSchema,
+ name: tool.name,
+ }));
+ },
+ {
+ fallbackData: [],
+ revalidateOnFocus: false,
+ },
+ ),
+
useFetchUserKlavisServers: (enabled) =>
useSWR<KlavisServer[]>(
enabled ? 'fetchUserKlavisServers' : null,
diff --git a/src/store/tool/slices/lobehubSkillStore/action.ts b/src/store/tool/slices/lobehubSkillStore/action.ts
index 6df30f8f632..5437820bb43 100644
--- a/src/store/tool/slices/lobehubSkillStore/action.ts
+++ b/src/store/tool/slices/lobehubSkillStore/action.ts
@@ -77,6 +77,12 @@ export interface LobehubSkillStoreAction {
* @param enabled - Whether to enable fetching
*/
useFetchLobehubSkillConnections: (enabled: boolean) => SWRResponse<LobehubSkillServer[]>;
+
+ /**
+ * Use SWR to fetch tools for a LobeHub Skill provider
+ * @param provider - Provider ID (e.g., 'linear')
+ */
+ useFetchProviderTools: (provider: string | undefined) => SWRResponse<LobehubSkillTool[]>;
}
export const createLobehubSkillStoreSlice: StateCreator<
@@ -357,4 +363,21 @@ export const createLobehubSkillStoreSlice: StateCreator<
revalidateOnFocus: false,
},
),
+
+ useFetchProviderTools: (provider) =>
+ useSWR<LobehubSkillTool[]>(
+ provider ? `lobehub-skill-tools-${provider}` : null,
+ async () => {
+ const response = await toolsClient.market.connectListTools.query({ provider: provider! });
+ return (response.tools || []).map((tool: any) => ({
+ description: tool.description,
+ inputSchema: tool.inputSchema,
+ name: tool.name,
+ }));
+ },
+ {
+ fallbackData: [],
+ revalidateOnFocus: false,
+ },
+ ),
});