-
Notifications
You must be signed in to change notification settings - Fork 625
feat: add nowledge mem mcp #1054
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe PR replaces the default in-memory MCP server with an HTTP-based nowledge-mem entry, adds tracking for user-removed built-in servers via a removedBuiltInServers field, and updates the Vue form to treat remote transports (sse/http) uniformly with adjusted field visibility, parsing, and validation. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Form as mcpServerForm.vue
participant Config as mcpConfHelper.ts
participant Storage
Note over Form,Config: Add built-in server flow
User->>Form: Submit server (e.g., nowledge-mem)
Form->>Config: addMcpServer(serverConfig)
Config->>Config: isBuiltInServer? → true
Config->>Config: unmarkBuiltInServerRemoved(name)
Config->>Storage: persist removedBuiltInServers
Config->>Form: return updated server list
Note over Form,Config: Remove built-in server flow
User->>Form: Remove server
Form->>Config: removeMcpServer(name)
Config->>Config: isBuiltInServer? → true
Config->>Config: markBuiltInServerRemoved(name)
Config->>Storage: persist removedBuiltInServers
Config->>Form: return updated server list
sequenceDiagram
participant User
participant Form as mcpServerForm.vue
Note over Form: Type selection and submit
User->>Form: Select type (stdio / inmemory / sse / http)
Form->>Form: set isRemoteType (sse or http)
alt isRemoteType
Form->>Form: show baseUrl & customHeaders, hide command/args/env
Form->>Form: validate baseUrl/customHeaders
else local type
Form->>Form: show command/args/env, hide baseUrl/customHeaders
Form->>Form: validate command/args/env
end
User->>Form: Submit
Form->>Config: addMcpServer/update (payload shaped by type)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (10)**/*.{js,jsx,ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)
Files:
src/{main,renderer}/**/*.ts📄 CodeRabbit inference engine (.cursor/rules/electron-best-practices.mdc)
Files:
src/main/**/*.ts📄 CodeRabbit inference engine (.cursor/rules/electron-best-practices.mdc)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/error-logging.mdc)
Files:
src/main/**/*.{ts,js,tsx,jsx}📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Files:
**/*.{ts,tsx,js,vue}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{ts,tsx,vue}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
src/main/presenter/**/*.ts📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{ts,tsx,js,jsx,vue,css,scss,md,json,yml,yaml}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{ts,tsx,js,jsx,vue}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (1)📚 Learning: 2025-09-06T03:07:23.817ZApplied to files:
🧬 Code graph analysis (1)src/main/presenter/configPresenter/mcpConfHelper.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/renderer/src/components/mcp-config/mcpServerForm.vue (2)
493-513: Do not persist baseUrl for non-remote servers.Currently, baseUrl is written even for stdio/inmemory, which can misclassify servers later. Only include baseUrl for remote types.
As per coding guidelines
} else { // STDIO 或 inmemory 类型的服务器 serverConfig = { ...baseConfig, command: command.value.trim(), // args 从 argumentsList 更新,所以直接使用 split 即可,或者直接使用 argumentsList.value args: args.value.split(/\s+/).filter(Boolean), - env: parsedEnv, - baseUrl: baseUrl.value.trim() + env: parsedEnv } }
874-903: Eliminate hardcoded UI fallbacks; use i18n keys only.Remove literal fallbacks like '模型选择'/'添加文件夹'/'未选择任何文件夹' and localize aria-labels.
As per coding guidelines
- {{ t('settings.mcp.serverForm.imageModel') || '模型选择' }} + {{ t('settings.mcp.serverForm.imageModel') }} @@ - {{ t('settings.mcp.serverForm.folders') || '可访问的文件夹' }} + {{ t('settings.mcp.serverForm.folders') }} @@ - {{ t('settings.mcp.serverForm.addFolder') || '添加文件夹' }} + {{ t('settings.mcp.serverForm.addFolder') }} @@ - {{ t('settings.mcp.serverForm.noFoldersSelected') || '未选择任何文件夹' }} + {{ t('settings.mcp.serverForm.noFoldersSelected') }} @@ - :aria-label="`Remove ${arg}`" + :aria-label="t('settings.mcp.serverForm.removeArg', { arg })"Also applies to: 904-949, 1151-1187, 971-973
🧹 Nitpick comments (7)
src/renderer/src/components/mcp-config/mcpServerForm.vue (6)
193-199: Remove debug log and align logs to English.Drop console.log('type', ...) and keep logs meaningful and English-only as per guidelines.
As per coding guidelines
- console.log('type', type.value, baseUrl.value) + // no-op: avoid noisy logs in productionAlso applies to: 201-208
725-727: Localize the placeholder string.customHeadersPlaceholder is user-facing; move to i18n instead of hardcoded text.
As per coding guidelines
-const customHeadersPlaceholder = `Authorization=Bearer your_token - -HTTP-Referer=deepchatai.cn` +const customHeadersPlaceholder = t('settings.mcp.serverForm.customHeadersPlaceholder')
229-235: Use English logs and avoid mixed-language messages.Replace Chinese log messages with English; prefer structured context.
As per coding guidelines
- console.error('解析JSON配置失败:', error) + console.error('[MCP Server Form] Failed to parse JSON config:', error) @@ - console.error('选择文件夹失败:', error) + console.error('[MCP Server Form] Directory selection failed:', error) @@ - console.warn(`未找到匹配的模型: ${providerId} ${modelId}`) + console.warn(`[MCP Server Form] Model not found for provider=${providerId} modelId=${modelId}`)Also applies to: 333-339, 636-637
184-185: Avoid any; prefer unknown with narrowing.Replace any with precise types or unknown + guards.
As per coding guidelines
- const [serverName, serverConfig] = serverEntries[0] as [string, any] + interface ImportedMcpConfig { + command?: string + args?: string[] + env?: Record<string, unknown> + descriptions?: string + icons?: string + type?: MCPServerTypeOption + url?: string + baseUrl?: string + headers?: Record<string, string> + customHeaders?: Record<string, string> + autoApprove?: string[] + } + const [serverName, serverConfig] = serverEntries[0] as [string, ImportedMcpConfig] @@ - const envConfig = newConfig.env as Record<string, any> + const envConfig = newConfig.env as Record<string, unknown> useE2B.value = envConfig.USE_E2B === true || envConfig.USE_E2B === 'true' - e2bApiKey.value = envConfig.E2B_API_KEY || '' + e2bApiKey.value = (envConfig.E2B_API_KEY as string) || ''Also applies to: 662-667
669-675: Support headers alias in edit mode for consistency.parseJsonConfig reads headers or customHeaders; edit-mode init should too.
- if (newConfig.customHeaders) { - customHeaders.value = formatJsonHeaders(newConfig.customHeaders) + if (newConfig.customHeaders || (newConfig as any).headers) { + const hdrs = newConfig.customHeaders ?? ((newConfig as any).headers as Record<string, string>) + customHeaders.value = formatJsonHeaders(hdrs) } else { customHeaders.value = '' }
81-89: Naming nit: BuiltIn vs BuildIn.Consider isBuiltInFileSystem for readability; current spelling mirrors server key but reads oddly in code.
src/main/presenter/configPresenter/mcpConfHelper.ts (1)
701-777: Casting ExtendedMCPServerConfig to MCPServerConfig.Consider extending MCPServerConfig (or storing metadata separately) to avoid casting and preserve type safety.
Also applies to: 803-827
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/main/presenter/configPresenter/mcpConfHelper.ts(7 hunks)src/renderer/src/components/mcp-config/mcpServerForm.vue(9 hunks)
🧰 Additional context used
📓 Path-based instructions (22)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)
**/*.{js,jsx,ts,tsx}: 使用 OxLint 进行代码检查
Log和注释使用英文书写
Files:
src/main/presenter/configPresenter/mcpConfHelper.ts
src/{main,renderer}/**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/electron-best-practices.mdc)
src/{main,renderer}/**/*.ts: Use context isolation for improved security
Implement proper inter-process communication (IPC) patterns
Optimize application startup time with lazy loading
Implement proper error handling and logging for debugging
Files:
src/main/presenter/configPresenter/mcpConfHelper.ts
src/main/**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/electron-best-practices.mdc)
Use Electron's built-in APIs for file system and native dialogs
Files:
src/main/presenter/configPresenter/mcpConfHelper.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/error-logging.mdc)
**/*.{ts,tsx}: 始终使用 try-catch 处理可能的错误
提供有意义的错误信息
记录详细的错误日志
优雅降级处理
日志应包含时间戳、日志级别、错误代码、错误描述、堆栈跟踪(如适用)、相关上下文信息
日志级别应包括 ERROR、WARN、INFO、DEBUG
不要吞掉错误
提供用户友好的错误信息
实现错误重试机制
避免记录敏感信息
使用结构化日志
设置适当的日志级别
Files:
src/main/presenter/configPresenter/mcpConfHelper.ts
src/main/**/*.{ts,js,tsx,jsx}
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
主进程代码放在
src/main
Files:
src/main/presenter/configPresenter/mcpConfHelper.ts
**/*.{ts,tsx,js,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
Use English for all logs and comments
Files:
src/main/presenter/configPresenter/mcpConfHelper.tssrc/renderer/src/components/mcp-config/mcpServerForm.vue
**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
Enable and adhere to strict TypeScript typing (avoid implicit any, prefer precise types)
Use PascalCase for TypeScript types and classes
Files:
src/main/presenter/configPresenter/mcpConfHelper.tssrc/renderer/src/components/mcp-config/mcpServerForm.vue
src/main/presenter/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Place Electron main-process presenters under src/main/presenter/ (Window, Tab, Thread, Mcp, Config, LLMProvider)
Files:
src/main/presenter/configPresenter/mcpConfHelper.ts
**/*.{ts,tsx,js,jsx,vue,css,scss,md,json,yml,yaml}
📄 CodeRabbit inference engine (AGENTS.md)
Prettier style: single quotes, no semicolons, print width 100; run pnpm run format
Files:
src/main/presenter/configPresenter/mcpConfHelper.tssrc/renderer/src/components/mcp-config/mcpServerForm.vue
**/*.{ts,tsx,js,jsx,vue}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,js,jsx,vue}: Use OxLint for JS/TS code; keep lint clean
Use camelCase for variables and functions
Use SCREAMING_SNAKE_CASE for constants
Files:
src/main/presenter/configPresenter/mcpConfHelper.tssrc/renderer/src/components/mcp-config/mcpServerForm.vue
src/renderer/src/**/*
📄 CodeRabbit inference engine (.cursor/rules/i18n.mdc)
src/renderer/src/**/*: All user-facing strings must use i18n keys (avoid hardcoded user-visible text in code)
Use the 'vue-i18n' framework for all internationalization in the renderer
Ensure all user-visible text in the renderer uses the translation system
Files:
src/renderer/src/components/mcp-config/mcpServerForm.vue
src/renderer/**/*.{vue,ts,js,tsx,jsx}
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
渲染进程代码放在
src/renderer
Files:
src/renderer/src/components/mcp-config/mcpServerForm.vue
src/renderer/src/**/*.{vue,ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/vue-best-practices.mdc)
src/renderer/src/**/*.{vue,ts,tsx,js,jsx}: Use the Composition API for better code organization and reusability
Implement proper state management with Pinia
Utilize Vue Router for navigation and route management
Leverage Vue's built-in reactivity system for efficient data handling
Files:
src/renderer/src/components/mcp-config/mcpServerForm.vue
src/renderer/src/**/*.vue
📄 CodeRabbit inference engine (.cursor/rules/vue-best-practices.mdc)
Use scoped styles to prevent CSS conflicts between components
Files:
src/renderer/src/components/mcp-config/mcpServerForm.vue
src/renderer/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
src/renderer/**/*.{ts,tsx,vue}: Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
Use TypeScript for all code; prefer types over interfaces.
Avoid enums; use const objects instead.
Use arrow functions for methods and computed properties.
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
Files:
src/renderer/src/components/mcp-config/mcpServerForm.vue
src/renderer/**/*.{vue,ts}
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
Implement lazy loading for routes and components.
Files:
src/renderer/src/components/mcp-config/mcpServerForm.vue
src/renderer/**/*.{ts,vue}
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
src/renderer/**/*.{ts,vue}: Use useFetch and useAsyncData for data fetching.
Implement SEO best practices using Nuxt's useHead and useSeoMeta.Use Pinia for frontend state management (do not introduce alternative state libraries)
Files:
src/renderer/src/components/mcp-config/mcpServerForm.vue
src/renderer/{src,shell,floating}/**/*.vue
📄 CodeRabbit inference engine (CLAUDE.md)
src/renderer/{src,shell,floating}/**/*.vue: Use Vue 3 Composition API for all components
All user-facing strings must use i18n keys via vue-i18n (no hard-coded UI strings)
Use Tailwind CSS utilities and ensure styles are scoped in Vue components
Files:
src/renderer/src/components/mcp-config/mcpServerForm.vue
src/renderer/src/components/**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Organize UI components by feature within src/renderer/src/
Files:
src/renderer/src/components/mcp-config/mcpServerForm.vue
src/renderer/src/**
📄 CodeRabbit inference engine (AGENTS.md)
Place Vue 3 app source under src/renderer/src (components, stores, views, i18n, lib)
Files:
src/renderer/src/components/mcp-config/mcpServerForm.vue
src/renderer/src/**/*.{vue,ts}
📄 CodeRabbit inference engine (AGENTS.md)
All user-facing strings must use vue-i18n ($t/keys) rather than hardcoded literals
Files:
src/renderer/src/components/mcp-config/mcpServerForm.vue
src/renderer/**/*.vue
📄 CodeRabbit inference engine (AGENTS.md)
Name Vue component files in PascalCase (e.g., ChatInput.vue)
Files:
src/renderer/src/components/mcp-config/mcpServerForm.vue
🧠 Learnings (1)
📚 Learning: 2025-09-06T03:07:23.817Z
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-06T03:07:23.817Z
Learning: Applies to src/main/presenter/mcpPresenter/inMemoryServers/*.ts : Implement new MCP tools under src/main/presenter/mcpPresenter/inMemoryServers/
Applied to files:
src/main/presenter/configPresenter/mcpConfHelper.ts
🧬 Code graph analysis (1)
src/main/presenter/configPresenter/mcpConfHelper.ts (1)
src/shared/types/presenters/legacy.presenters.d.ts (1)
MCPServerConfig(1122-1136)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-check (x64)
🔇 Additional comments (6)
src/renderer/src/components/mcp-config/mcpServerForm.vue (3)
55-61: Type alias and whitelist look good.Union alias MCPServerTypeOption and VALID_MCP_TYPES simplify correctness across the form.
86-88: Remote-type gating is clean.isRemoteType and showBaseUrl centralize visibility rules for SSE/HTTP.
Also applies to: 139-143
243-253: Validation changes make sense.Command optional for remote types; baseUrl required only for remote; overall form validity logic reads well.
Also applies to: 263-266, 297-311
src/main/presenter/configPresenter/mcpConfHelper.ts (3)
543-546: Built-in removal tracking is correct.Unmark on add; mark on remove; aligns with getMcpServers behavior.
Also applies to: 634-637
334-341: Defaults initialization includes removal tracking.Added removedBuiltInServers: [] with other defaults; good.
847-994: Upgrade/migration handlers look safe.Migrations guard by version, handle platform services, and clean defaults.
|
@zerob13 thanks a lot, you are amazing! Our side tight integration is on the way! |
Really looking forward to your future API — I’m confident we can build some very cool integrations together. |
add nowledge mem mcp as default mcp server
Summary by CodeRabbit
New Features
Bug Fixes
Refactor