(name: string)
| 1031 | * @returns The server configuration with scope, or undefined if not found |
| 1032 | */ |
| 1033 | export function getMcpConfigByName(name: string): ScopedMcpServerConfig | null { |
| 1034 | const { servers: enterpriseServers } = getMcpConfigsByScope('enterprise') |
| 1035 | |
| 1036 | // When MCP is locked to plugin-only, only enterprise servers are reachable |
| 1037 | // by name. User/project/local servers are blocked — same as getClaudeCodeMcpConfigs(). |
| 1038 | if (isRestrictedToPluginOnly('mcp')) { |
| 1039 | return enterpriseServers[name] ?? null |
| 1040 | } |
| 1041 | |
| 1042 | const { servers: userServers } = getMcpConfigsByScope('user') |
| 1043 | const { servers: projectServers } = getMcpConfigsByScope('project') |
| 1044 | const { servers: localServers } = getMcpConfigsByScope('local') |
| 1045 | |
| 1046 | if (enterpriseServers[name]) { |
| 1047 | return enterpriseServers[name] |
| 1048 | } |
| 1049 | if (localServers[name]) { |
| 1050 | return localServers[name] |
| 1051 | } |
| 1052 | if (projectServers[name]) { |
| 1053 | return projectServers[name] |
| 1054 | } |
| 1055 | if (userServers[name]) { |
| 1056 | return userServers[name] |
| 1057 | } |
| 1058 | |
| 1059 | return null |
| 1060 | } |
| 1061 | |
| 1062 | /** |
| 1063 | * Get Claude Code MCP configurations (excludes claude.ai servers from the |
no test coverage detected