MCPcopy
hub / github.com/codeaashu/claude-code / getMcpConfigByName

Function getMcpConfigByName

src/services/mcp/config.ts:1033–1060  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

1031 * @returns The server configuration with scope, or undefined if not found
1032 */
1033export 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

Callers 6

MCPStdioServerMenuFunction · 0.85
runHeadlessStreamingFunction · 0.85
mcpRemoveHandlerFunction · 0.85
mcpGetHandlerFunction · 0.85

Calls 2

getMcpConfigsByScopeFunction · 0.85
isRestrictedToPluginOnlyFunction · 0.85

Tested by

no test coverage detected