MCPcopy Index your code
hub / github.com/codeaashu/claude-code / generateMcpConfig

Function generateMcpConfig

src/utils/plugins/mcpbHandler.ts:413–438  ·  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

411 * Generate MCP server configuration from DXT manifest
412 */
413async function generateMcpConfig(
414 manifest: McpbManifest,
415 extractedPath: string,
416 userConfig: UserConfigValues = {},
417): Promise<McpServerConfig> {
418 // Lazy import: @anthropic-ai/mcpb barrel pulls in zod v3 schemas (~700KB of
419 // bound closures). See dxt/helpers.ts for details.
420 const { getMcpConfigForManifest } = await import('@anthropic-ai/mcpb')
421 const mcpConfig = await getMcpConfigForManifest({
422 manifest,
423 extensionPath: extractedPath,
424 systemDirs: getSystemDirectories(),
425 userConfig,
426 pathSeparator: '/',
427 })
428
429 if (!mcpConfig) {
430 const error = new Error(
431 `Failed to generate MCP server configuration from manifest "${manifest.name}"`,
432 )
433 logError(error)
434 throw error
435 }
436
437 return mcpConfig as McpServerConfig
438}
439
440/**
441 * 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