feat: Add MCP marketplace and mcp plugin one-click installation in desktop (#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 <i@canisminor.cc>
This commit is contained in:
Arvin Xu
2025-07-08 19:51:22 +08:00
committed by GitHub
parent 580961e6e4
commit 416a4b1212
506 changed files with 30748 additions and 7218 deletions

View File

@@ -48,7 +48,7 @@
"@typescript/native-preview": "latest",
"consola": "^3.1.0",
"cookie": "^1.0.2",
"electron": "^36.2.0",
"electron": "^37.2.0",
"electron-builder": "^26.0.12",
"electron-is": "^3.0.0",
"electron-log": "^5.3.3",

View File

@@ -152,7 +152,8 @@ export default class Browser {
show() {
logger.debug(`Showing window: ${this.identifier}`);
this.determineWindowPosition();
if (!this._browserWindow.isDestroyed()) this.determineWindowPosition();
this.browserWindow.show();
}

View File

@@ -58,7 +58,7 @@ export const createRequest = async ({
for (const cookie of cookies) {
const { name, value } = cookie;
cookiesHeader.push(serializeCookie(name, value)); // ...(options as any)?
cookiesHeader.push(serializeCookie(name, value));
}
req.headers.cookie = cookiesHeader.join('; ');
@@ -305,20 +305,27 @@ export function createHandler({
);
for (const cookie of cookies) {
const expires = cookie.expires
? cookie.expires.getTime()
: cookie.maxAge
? Date.now() + cookie.maxAge * 1000
: undefined;
let expirationDate: number | undefined;
if (expires && expires < Date.now()) {
if (cookie.expires) {
// expires 是 Date 对象,转换为秒级时间戳
expirationDate = Math.floor(cookie.expires.getTime() / 1000);
} else if (cookie.maxAge) {
// maxAge 是秒数,计算过期时间戳
expirationDate = Math.floor(Date.now() / 1000) + cookie.maxAge;
}
// 如果都没有,则为 session cookie不设置 expirationDate
// 检查是否已过期
if (expirationDate && expirationDate < Math.floor(Date.now() / 1000)) {
await session.cookies.remove(request.url, cookie.name);
continue;
}
await session.cookies.set({
domain: cookie.domain,
expirationDate: expires,
expirationDate,
httpOnly: cookie.httpOnly,
name: cookie.name,
path: cookie.path,