Repository navigation
Conversation
读取 Pi 的 mcpServers 配置,连接远程 streamable HTTP MCP 服务器,并把 服务器工具以 mcp__<服务器>__<工具> 交给模型调用。 - 新增 src/mcp.js:配置解析与校验、env 变量插值、工具命名与提示词片段 - 新增 src/mcp-client.js:JSON-RPC / SSE 客户端,支持会话头与分页 - 插件接入:连接状态、工具注册、系统提示词、setMcpConfig/refreshMcp/importMcpConfig - 书签携带 MCP 配置并在目标站点合并;扩展通过 shared-config 跨网站共享 - 「Pi 设置」新增 MCP 页:粘贴 mcp.json、导入文件、查看状态、重新连接 - stdio(command)配置在浏览器中无法启动,明确标记为不支持 - 新增单元测试、扩展 engine 传递测试与浏览器回归 test:mcp Co-authored-by: multica-agent <github@multica.ai>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
让书签和 Chrome 扩展适配 Pi 的 MCP 配置:读取 Pi 的
mcpServers配置,连接远程 streamable HTTP MCP 服务器,并把服务器工具以mcp__<服务器>__<工具>交给模型直接调用。「Pi 设置」新增 MCP 页,可粘贴
mcp.json或导入文件;保存后按配置连接,同页显示每个服务器的连接状态、工具数量和错误,并可「重新连接」。改动
src/mcp.js(新增):配置解析与校验(名称、url、headers、timeout、enabled、description、exposure、toolExposure)、${NAME}变量插值(值写在配置顶层env)、Pi 风格工具命名与重名后缀、系统提示词中的mcp_servers段落。src/mcp-client.js(新增):浏览器端 streamable HTTP JSON-RPC 客户端,支持 SSE 响应、Mcp-Session-Id、MCP-Protocol-Version、分页tools/list、tools/call,以及文本/图片/结构化结果转换。src/plugin.js:接入 MCP(setMcpConfig/mcpConfig/refreshMcp/importMcpConfig),连接与断开、工具注册/注销、dispose时关闭连接、提示词段落渲染。src/bookmarklet.js):配置随保存的书签携带,在目标站点按需合并(已有同名服务器的站点保留自己的配置)。src/extension-*.js):配置写入chrome.storage.local的 shared-config,各站点 engine 共用,跨网站一致。src/install-template.html+src/locales/en.json):设置页新增 MCP 标签,粘贴/导入配置、状态列表、重新连接。README.md、README.en.md、docs/usage.md、docs/usage.en.md,以及docs/issues/2026-11-04-mcp.json记录。已知限制
command/args的 stdio 服务器需要本地进程,书签和扩展都在浏览器里无法启动,列表里明确显示「不支持」而不会静默忽略。Authorization等请求头;旧版type: "sse"和 Pi 一样被拒绝。验证
npm test97/97 通过,其中新增 MCP 配置 8 项、MCP 客户端 5 项(真实本地 HTTP 服务器、SSE 响应、401、不可达服务器)。npm run build、node scripts/release.mjs verify通过;聊天书签 1,945,497 字符,仍在 2 MB 限制内。mcp__docs__search并拿到服务器结果 → 生成的聊天书签携带importMcpConfig→ 在另一个站点打开书签后自动连接并注册该工具 → 改成 stdio 配置后显示不支持且旧工具被移除。npm run test:mcp(scripts/test-mcp-ui.mjs)并加入 CI matrix(suite=mcp)。PR 打开后 CI 会跑 build + 单测 + 全部浏览器回归。