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

Function loadMcpServerUserConfig

src/utils/plugins/mcpbHandler.ts:141–172  ·  view source on GitHub ↗
(
  pluginId: string,
  serverName: string,
)

Source from the content-addressed store, hash-verified

139 * @param serverName - MCP server name from DXT manifest
140 */
141export function loadMcpServerUserConfig(
142 pluginId: string,
143 serverName: string,
144): UserConfigValues | null {
145 try {
146 const settings = getSettings_DEPRECATED()
147 const nonSensitive =
148 settings.pluginConfigs?.[pluginId]?.mcpServers?.[serverName]
149
150 const sensitive =
151 getSecureStorage().read()?.pluginSecrets?.[
152 serverSecretsKey(pluginId, serverName)
153 ]
154
155 if (!nonSensitive && !sensitive) {
156 return null
157 }
158
159 logForDebugging(
160 `Loaded user config for ${pluginId}/${serverName} (settings + secureStorage)`,
161 )
162 return { ...nonSensitive, ...sensitive }
163 } catch (error) {
164 const errorObj = toError(error)
165 logError(errorObj)
166 logForDebugging(
167 `Failed to load user config for ${pluginId}/${serverName}: ${error}`,
168 { level: 'error' },
169 )
170 return null
171 }
172}
173
174/**
175 * Save user configuration for an MCP server, splitting by `schema[key].sensitive`.

Callers 4

getUnconfiguredChannelsFunction · 0.85
loadChannelUserConfigFunction · 0.85
loadMcpbFileFunction · 0.85
PluginOptionsFlowFunction · 0.85

Calls 6

getSecureStorageFunction · 0.85
serverSecretsKeyFunction · 0.85
logForDebuggingFunction · 0.85
toErrorFunction · 0.85
readMethod · 0.65
logErrorFunction · 0.50

Tested by

no test coverage detected