( servers: Record<string, McpServerConfig>, pluginName: string, pluginSource: string, )
| 339 | * This adds a prefix to server names to avoid conflicts between plugins |
| 340 | */ |
| 341 | export function addPluginScopeToServers( |
| 342 | servers: Record<string, McpServerConfig>, |
| 343 | pluginName: string, |
| 344 | pluginSource: string, |
| 345 | ): Record<string, ScopedMcpServerConfig> { |
| 346 | const scopedServers: Record<string, ScopedMcpServerConfig> = {} |
| 347 | |
| 348 | for (const [name, config] of Object.entries(servers)) { |
| 349 | // Add plugin prefix to server name to avoid conflicts |
| 350 | const scopedName = `plugin:${pluginName}:${name}` |
| 351 | const scoped: ScopedMcpServerConfig = { |
| 352 | ...config, |
| 353 | scope: 'dynamic', // Use dynamic scope for plugin servers |
| 354 | pluginSource, |
| 355 | } |
| 356 | scopedServers[scopedName] = scoped |
| 357 | } |
| 358 | |
| 359 | return scopedServers |
| 360 | } |
| 361 | |
| 362 | /** |
| 363 | * Extract all MCP servers from loaded plugins |
no test coverage detected