MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / generateMcpConfig

Function generateMcpConfig

src/utils/plugins/mcpbHandler.ts:423–448  ·  view source on GitHub ↗

* Generate MCP server configuration from DXT manifest

(
  manifest: McpbManifest,
  extractedPath: string,
  userConfig: UserConfigValues = {},
)

Source from the content-addressed store, hash-verified

421 * Generate MCP server configuration from DXT manifest
422 */
423async function generateMcpConfig(
424 manifest: McpbManifest,
425 extractedPath: string,
426 userConfig: UserConfigValues = {},
427): Promise<McpServerConfig> {
428 // Lazy import: @anthropic-ai/mcpb barrel pulls in zod v3 schemas (~700KB of
429 // bound closures). See dxt/helpers.ts for details.
430 const { getMcpConfigForManifest } = await import('@anthropic-ai/mcpb')
431 const mcpConfig = await getMcpConfigForManifest({
432 manifest,
433 extensionPath: extractedPath,
434 systemDirs: getSystemDirectories(),
435 userConfig,
436 pathSeparator: '/',
437 })
438
439 if (!mcpConfig) {
440 const error = new Error(
441 `Failed to generate MCP server configuration from manifest "${manifest.name}"`,
442 )
443 logError(error)
444 throw error
445 }
446
447 return mcpConfig as McpServerConfig
448}
449
450/**
451 * Load cache metadata for an MCPB source

Callers 1

loadMcpbFileFunction · 0.85

Calls 2

getSystemDirectoriesFunction · 0.85
logErrorFunction · 0.50

Tested by

no test coverage detected