Repository navigation
fix(validate): mcpEndpoints 必须点名插件真声明过的 MCP 服务器 - #207
Merged
MyPrototypeWhat merged 1 commit intoDec 4, 2026
Merged
MyPrototypeWhat merged 1 commit into
MyPrototypeWhat merged 1 commit into
Conversation
Collaborator
|
这个 PR 目前和当前 main 有真实合并冲突。这个分支是从 #186( |
miniapp.json 的 mcpEndpoints[].server 之前只查形状和唯一性,不查这个名字是不是 插件真声明过。宿主那边是查的:readMcpEndpoints 拿声明过的服务器名做集合,端点 点名一个没声明过的服务器直接 MCP_ENDPOINTS_INVALID。 于是贡献者本地 npm run check 全绿、CI 全绿,装到宿主上才被拒 —— 而包在那里是 装不上的。 现在校验层也查这条:读 plugin.json.mcpServers 里那些 *.mcp.json 的 mcpServers map,把声明过的服务器名交给 Mini App 规则。名字读不出来(文件缺失、读不了、 形状不对)时不下结论 —— 那时引用错误已经报过了,猜一个空名单只会把该包的每个 端点都变成误报。 新增错误码 MINIAPP_MCP_ENDPOINT_UNDECLARED。全仓 43 个插件、15 个端点扫过一遍, 没有幽灵引用,所以现有包仍是 0 error。根测试 104 条(新增 2 条)。 docs/package-contract.md 里 mcpEndpoints 那条补上这条规则,Verified against 一行 说明新规则是从 3.1.14 的读取器上读下来的(3.1.4 的完全一样)。
Apageoflove
force-pushed
the
fix/validate-mcp-endpoint-server
branch
from
December 4, 2026 05:19
7044cdd to
f9e0af2
Compare
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.
miniapp.json的mcpEndpoints[].server之前只查形状和唯一性,不查这个名字是不是插件真声明过。宿主那边是查的 ——readMcpEndpoints拿声明过的服务器名做成集合,端点点名一个没声明过的服务器直接MCP_ENDPOINTS_INVALID。所以贡献者本地
npm run check全绿、CI 全绿,装到宿主上才被拒,而那个包在那里是装不上的。Written by MiniMax-M3
改了什么:
scripts/lib/rules/manifest.mjs新增readMcpServerNames():读plugin.json.mcpServers里那些*.mcp.json的mcpServersmap,把声明过的服务器名取出来。读不出来(文件缺失、读不了、形状不对)时返回undefined,意思是「不知道」—— 那时引用错误已经报过了,猜一个空名单只会把该包的每个端点都变成误报。scripts/lib/package.mjs把这些名字交给 Mini App 规则。scripts/lib/rules/miniapp.mjs:mcpEndpoints[].server不在声明过的名字里时报MINIAPP_MCP_ENDPOINT_UNDECLARED。测试:根
test/miniapp.test.mjs新增一条(名字在声明集合里通过、不在就报、声明集合为空时报、名字读不出来时不下结论),test/package.test.mjs新增一条端到端。根测试 104 条全过。全仓扫过一遍:43 个插件、15 个端点,没有一个是幽灵引用,所以现有包仍然是 0 error(
npm run validate退出码 0)。docs/package-contract.md里mcpEndpoints那条补上这条规则,mcpServers那一行说明服务器名来自每个文件的mcpServersmap;Verified against一行说明新规则是从 3.1.14 的读取器上读下来的(3.1.4 的完全一样)。验证范围:只有 Node 22 上的测试是实测的。真实 Host 和 Electron 我没跑过 —— 这一层是仅个人判断。
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.