Skip to content

Commit 4d1ac6c

Browse files
arvinxxcanisminor1990
authored andcommitted
✨ feat: Add MCP marketplace and mcp plugin one-click installation in desktop (lobehub#8334)
* move plugin Component * ✨ feat(wip): Add MCP Discover Market * ✅ test: Fix test * ✅ test: Fix test * 🐛 fix: Fix build * 🐛 fix: Fix build * 💄 style: update plugin store * 💄 style: Update plugin store * ✨ feat: Update cache control headers and optimize Next.js config for performance * 💄 style: Update discover markdown * 💄 style: Update scroes step * 优化 list 细节 * 优化 list 细节 * 优化 list 细节 * 完成基础 mcp 安装实现 * 完成安装上报 * 新增安装过程 * fix * 优化插件设置页面配置 * 💄 style: update official icon * 完善安装错误状态 * 支持取消安装 * fix types * fix types * 完成系统依赖检查流程 * 完成系统依赖安装流程上报 * try to fix suspense * try to fix suspense * try to fix suspense * try to fix tests * upgrade electron * fix suspense * fix tool name issue * fix test * add i18n * fix tool call * ✅ test: fix tests * move * fix tests * refactor plugin install store * improve old plugin install * fix * fix header link * fix plugin detail * fix oldPlugin detail * fix tests * update i18n * fix i18n * 💄 style: improve style * add debug log * fix link * improve * fix link * 🚚 refactor: refactor the market runtime to nodejs * 移除 props.searchParams 调用 * ✅ test: fix tests * 尝试静态化 discover page * ♻️ refactor: refactor config to nodejs runtime * fix min width * 修正自定义插件的编辑展示区域 * fix i18n * 调整部分组件目录结构 * 完善 MCP 市场安装流程 * 完善安装上报事件 * test: fix test * ✨ feat: 实现 m2m oauth 请求 * ✨ feat: 完善 m2m 注册链路 * ✨ feat: 完善 m2m 注册链路 * 🐛 fix: 优化 debug 日志输出问题 * ✨ feat: 支持 call 上报 * 💄 style: 使用更大的版本 * 🐛 fix: tools calling report * 🐛 fix: try to fix call report * 🐛 fix: try to use expires cookies * 🐛 fix: fix cookies expires issue * test: fix customPluginInfo report * 🐛 fix: fix connection issue * 🐛 fix: fix platform report * 🐛 fix: fix version issue --------- Co-authored-by: canisminor1990 <[email protected]>
1 parent f79f2fa commit 4d1ac6c

File tree

506 files changed

+30692
-7162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

506 files changed

+30692
-7162
lines changed

apps/desktop/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"@typescript/native-preview": "latest",
4949
"consola": "^3.1.0",
5050
"cookie": "^1.0.2",
51-
"electron": "^36.2.0",
51+
"electron": "^37.2.0",
5252
"electron-builder": "^26.0.12",
5353
"electron-is": "^3.0.0",
5454
"electron-log": "^5.3.3",

apps/desktop/src/main/core/Browser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ export default class Browser {
152152

153153
show() {
154154
logger.debug(`Showing window: ${this.identifier}`);
155-
this.determineWindowPosition();
155+
if (!this._browserWindow.isDestroyed()) this.determineWindowPosition();
156+
156157
this.browserWindow.show();
157158
}
158159

apps/desktop/src/main/utils/next-electron-rsc.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const createRequest = async ({
5858

5959
for (const cookie of cookies) {
6060
const { name, value } = cookie;
61-
cookiesHeader.push(serializeCookie(name, value)); // ...(options as any)?
61+
cookiesHeader.push(serializeCookie(name, value));
6262
}
6363

6464
req.headers.cookie = cookiesHeader.join('; ');
@@ -305,20 +305,27 @@ export function createHandler({
305305
);
306306

307307
for (const cookie of cookies) {
308-
const expires = cookie.expires
309-
? cookie.expires.getTime()
310-
: cookie.maxAge
311-
? Date.now() + cookie.maxAge * 1000
312-
: undefined;
308+
let expirationDate: number | undefined;
309+
310+
if (cookie.expires) {
311+
// expires 是 Date 对象,转换为秒级时间戳
312+
expirationDate = Math.floor(cookie.expires.getTime() / 1000);
313+
} else if (cookie.maxAge) {
314+
// maxAge 是秒数,计算过期时间戳
315+
expirationDate = Math.floor(Date.now() / 1000) + cookie.maxAge;
316+
}
317+
318+
// 如果都没有,则为 session cookie,不设置 expirationDate
313319

314-
if (expires && expires < Date.now()) {
320+
// 检查是否已过期
321+
if (expirationDate && expirationDate < Math.floor(Date.now() / 1000)) {
315322
await session.cookies.remove(request.url, cookie.name);
316323
continue;
317324
}
318325

319326
await session.cookies.set({
320327
domain: cookie.domain,
321-
expirationDate: expires,
328+
expirationDate,
322329
httpOnly: cookie.httpOnly,
323330
name: cookie.name,
324331
path: cookie.path,

locales/ar/discover.json

Lines changed: 452 additions & 12 deletions
Large diffs are not rendered by default.

locales/ar/metadata.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
"title": "مساعدات الذكاء الاصطناعي"
1414
},
1515
"description": "إنشاء المحتوى، الكتابة، الأسئلة والأجوبة، توليد الصور، توليد الفيديو، توليد الصوت، الوكلاء الذكيون، سير العمل الآلي، تطبيقات الذكاء الاصطناعي المخصصة، تخصيص منصة تطبيقات الذكاء الاصطناعي الخاصة بك",
16+
"mcp": {
17+
"description": "ابحث وقارن واتصل بآلاف خوادم MCP، مما يساعد أنظمة الذكاء الاصطناعي على الوصول بسهولة إلى أنظمة الملفات وقواعد البيانات وواجهات برمجة التطبيقات وغيرها من الموارد الحيوية، لتوسيع قدرات الذكاء الاصطناعي الخاصة بك بشكل شامل",
18+
"title": "سوق خوادم MCP"
19+
},
1620
"models": {
1721
"description": "استكشاف نماذج الذكاء الاصطناعي الرائجة OpenAI / GPT / Claude 3 / Gemini / Ollama / Azure / DeepSeek",
1822
"title": "نماذج الذكاء الاصطناعي"

locales/ar/plugin.json

Lines changed: 89 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
"tool_call": "طلب استدعاء الأداة"
1313
},
1414
"detailModal": {
15+
"customPlugin": {
16+
"description": "يرجى الانتقال إلى صفحة التحرير لمشاهدة التفاصيل",
17+
"editBtn": "حرر الآن",
18+
"title": "هذه إضافة مخصصة"
19+
},
20+
"emptyState": {
21+
"description": "يرجى تثبيت هذه الإضافة أولاً لعرض قدرات الإضافة وخيارات التكوين",
22+
"title": "عرض تفاصيل الإضافة بعد التثبيت"
23+
},
1524
"info": {
1625
"description": "وصف واجهة برمجة التطبيقات",
1726
"name": "اسم واجهة برمجة التطبيقات"
@@ -230,6 +239,50 @@
230239
},
231240
"title": "الملفات المحلية"
232241
},
242+
"mcpInstall": {
243+
"CHECKING_INSTALLATION": "جارٍ فحص بيئة التثبيت...",
244+
"COMPLETED": "اكتمل التثبيت",
245+
"CONFIGURATION_REQUIRED": "يرجى إكمال التكوينات المطلوبة للمتابعة في التثبيت",
246+
"ERROR": "خطأ في التثبيت",
247+
"FETCHING_MANIFEST": "جارٍ جلب ملف وصف الإضافة...",
248+
"GETTING_SERVER_MANIFEST": "جارٍ تهيئة خادم MCP...",
249+
"INSTALLING_PLUGIN": "جارٍ تثبيت الإضافة...",
250+
"configurationDescription": "تتطلب هذه الإضافة من MCP إعداد معلمات لتعمل بشكل صحيح، يرجى ملء المعلومات الضرورية.",
251+
"configurationRequired": "تكوين معلمات الإضافة",
252+
"continueInstall": "متابعة التثبيت",
253+
"dependenciesDescription": "تتطلب هذه الإضافة تثبيت الاعتمادات النظامية التالية لتعمل بشكل صحيح، يرجى تثبيت الاعتمادات المفقودة حسب التعليمات ثم النقر على إعادة الفحص للمتابعة.",
254+
"dependenciesRequired": "يرجى تثبيت الاعتمادات النظامية للإضافة",
255+
"dependencyStatus": {
256+
"installed": "مثبّت",
257+
"notInstalled": "غير مثبّت",
258+
"requiredVersion": "الإصدار المطلوب: {{version}}"
259+
},
260+
"errorDetails": {
261+
"args": "المعطيات",
262+
"command": "الأمر",
263+
"connectionParams": "معلمات الاتصال",
264+
"env": "متغيرات البيئة",
265+
"errorOutput": "سجل الأخطاء",
266+
"exitCode": "رمز الخروج",
267+
"hideDetails": "إخفاء التفاصيل",
268+
"originalError": "الخطأ الأصلي",
269+
"showDetails": "عرض التفاصيل"
270+
},
271+
"errorTypes": {
272+
"CONNECTION_FAILED": "فشل الاتصال",
273+
"INITIALIZATION_TIMEOUT": "انتهت مهلة التهيئة",
274+
"PROCESS_SPAWN_ERROR": "فشل بدء العملية",
275+
"UNKNOWN_ERROR": "خطأ غير معروف",
276+
"VALIDATION_ERROR": "فشل التحقق من المعطيات"
277+
},
278+
"installError": "فشل تثبيت إضافة MCP، سبب الفشل: {{detail}}",
279+
"installMethods": {
280+
"manual": "التثبيت اليدوي:",
281+
"recommended": "طريقة التثبيت الموصى بها:"
282+
},
283+
"recheckDependencies": "إعادة فحص",
284+
"skipDependencies": "تخطي الفحص"
285+
},
233286
"pluginList": "قائمة الإضافات",
234287
"search": {
235288
"apiName": {
@@ -266,16 +319,48 @@
266319
},
267320
"setting": "إعدادات الإضافة",
268321
"settings": {
322+
"capabilities": {
323+
"prompts": "نصوص التوجيه",
324+
"resources": "الموارد",
325+
"title": "قدرات الإضافة",
326+
"tools": "الأدوات"
327+
},
328+
"configuration": {
329+
"title": "تكوين الإضافة"
330+
},
331+
"connection": {
332+
"args": "معطيات التشغيل",
333+
"command": "أمر التشغيل",
334+
"title": "معلومات الاتصال",
335+
"type": "نوع الاتصال",
336+
"url": "عنوان الخدمة"
337+
},
338+
"edit": "تحرير",
339+
"envConfigDescription": "سيتم تمرير هذه الإعدادات كمتغيرات بيئية إلى العملية عند بدء تشغيل خادم MCP",
340+
"httpTypeNotice": "لا توجد متغيرات بيئية تحتاج إلى التكوين لإضافات MCP من نوع HTTP",
269341
"indexUrl": {
270342
"title": "فهرس السوق",
271343
"tooltip": "غير مدعوم حاليا للتحرير عبر الإنترنت، يرجى ضبطه عند نشر المتغيرات البيئية"
272344
},
345+
"messages": {
346+
"connectionUpdateFailed": "فشل تحديث معلومات الاتصال",
347+
"connectionUpdateSuccess": "تم تحديث معلومات الاتصال بنجاح",
348+
"envUpdateFailed": "فشل حفظ متغيرات البيئة",
349+
"envUpdateSuccess": "تم حفظ متغيرات البيئة بنجاح"
350+
},
273351
"modalDesc": "بعد ضبط عنوان سوق الإضافات، يمكن استخدام سوق الإضافات المخصص",
352+
"rules": {
353+
"argsRequired": "يرجى إدخال معلمات التشغيل",
354+
"commandRequired": "يرجى إدخال أمر التشغيل",
355+
"urlRequired": "يرجى إدخال عنوان الخدمة"
356+
},
357+
"saveSettings": "حفظ الإعدادات",
274358
"title": "ضبط سوق الإضافات"
275359
},
276360
"showInPortal": "يرجى الاطلاع على التفاصيل في مساحة العمل",
277361
"store": {
278362
"actions": {
363+
"cancel": "إلغاء التثبيت",
279364
"confirmUninstall": "سيتم إلغاء تثبيت الإضافة، وسيتم مسح تكوين الإضافة، يرجى تأكيد العملية",
280365
"detail": "التفاصيل",
281366
"install": "تثبيت",
@@ -286,13 +371,15 @@
286371
"communityPlugin": "مجتمع ثالث",
287372
"customPlugin": "مخصص",
288373
"empty": "لا توجد إضافات مثبتة حاليا",
374+
"emptySelectHint": "اختر إضافة لمعاينة التفاصيل",
289375
"installAllPlugins": "تثبيت الكل",
290376
"networkError": "فشل الحصول على متجر الإضافات، يرجى التحقق من الاتصال بالشبكة وإعادة المحاولة",
291377
"placeholder": "ابحث عن اسم الإضافة أو الكلمات الرئيسية...",
292378
"releasedAt": "صدر في {{createdAt}}",
293379
"tabs": {
294-
"all": "الكل",
295-
"installed": "مثبتة"
380+
"installed": "مثبتة",
381+
"mcp": "إضافة MCP",
382+
"old": "إضافة LobeChat"
296383
},
297384
"title": "متجر الإضافات"
298385
},

locales/ar/setting.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
"waitingForMore": "يتم <1>التخطيط لتوفير</1> المزيد من النماذج، ترقبوا المزيد"
130130
},
131131
"plugin": {
132+
"addMCPPlugin": "إضافة مكون MCP",
132133
"addTooltip": "إضافة البرنامج المساعد",
133134
"clearDeprecated": "مسح البرامج المساعدة الغير صالحة",
134135
"empty": "لا توجد برامج مساعدة مثبتة حاليًا، نرحب بك لزيارة <1>متجر البرامج المساعدة</1> للاستكشاف",

0 commit comments

Comments
 (0)