(entries: readonly ChannelEntry[], allowlist: ReturnType<typeof getEffectiveChannelAllowlist>)
| 204 | why: string; |
| 205 | }; |
| 206 | function findUnmatched(entries: readonly ChannelEntry[], allowlist: ReturnType<typeof getEffectiveChannelAllowlist>): Unmatched[] { |
| 207 | // Server-kind: build one Set from all scopes up front. getMcpConfigsByScope |
| 208 | // is not cached (project scope walks the dir tree); getMcpConfigByName would |
| 209 | // redo that walk per entry. |
| 210 | const scopes = ['enterprise', 'user', 'project', 'local'] as const; |
| 211 | const configured = new Set<string>(); |
| 212 | for (const scope of scopes) { |
| 213 | for (const name of Object.keys(getMcpConfigsByScope(scope).servers)) { |
| 214 | configured.add(name); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | // Plugin-kind installed check: installed_plugins.json keys are |
| 219 | // `name@marketplace`. loadInstalledPluginsV2 is cached. |
| 220 | const installedPluginIds = new Set(Object.keys(loadInstalledPluginsV2().plugins)); |
| 221 | |
| 222 | // Plugin-kind allowlist check: same {marketplace, plugin} test as the |
| 223 | // gate at channelNotification.ts. entry.dev bypasses (dev flag opts out |
| 224 | // of the allowlist). Org list replaces ledger when set (team/enterprise). |
| 225 | // GrowthBook _CACHED_MAY_BE_STALE — cold cache yields [] so every plugin |
| 226 | // entry warns; same tradeoff the gate already accepts. |
| 227 | const { |
| 228 | entries: allowed, |
| 229 | source |
| 230 | } = allowlist; |
| 231 | |
| 232 | // Independent ifs — a plugin entry that's both uninstalled AND |
| 233 | // unlisted shows two lines. Server kind checks config + dev flag. |
| 234 | const out: Unmatched[] = []; |
| 235 | for (const entry of entries) { |
| 236 | if (entry.kind === 'server') { |
| 237 | if (!configured.has(entry.name)) { |
| 238 | out.push({ |
| 239 | entry, |
| 240 | why: 'no MCP server configured with that name' |
| 241 | }); |
| 242 | } |
| 243 | if (!entry.dev) { |
| 244 | out.push({ |
| 245 | entry, |
| 246 | why: 'server: entries need --dangerously-load-development-channels' |
| 247 | }); |
| 248 | } |
| 249 | continue; |
| 250 | } |
| 251 | if (!installedPluginIds.has(`${entry.name}@${entry.marketplace}`)) { |
| 252 | out.push({ |
| 253 | entry, |
| 254 | why: 'plugin not installed' |
| 255 | }); |
| 256 | } |
| 257 | if (!entry.dev && !allowed.some(e => e.plugin === entry.name && e.marketplace === entry.marketplace)) { |
| 258 | out.push({ |
| 259 | entry, |
| 260 | why: source === 'org' ? "not on your org's approved channels list" : 'not on the approved channels allowlist' |
| 261 | }); |
| 262 | } |
| 263 | } |
no test coverage detected