MCPcopy
hub / github.com/21st-dev/1code / getMergedLocalProjectMcpServers

Function getMergedLocalProjectMcpServers

src/main/lib/claude-config.ts:468–488  ·  view source on GitHub ↗
(
  projectPath: string,
  claudeConfig?: ClaudeConfig,
  claudeDirConfig?: ClaudeConfig
)

Source from the content-addressed store, hash-verified

466 * Note: Does NOT include .mcp.json (caller handles that separately for caching)
467 */
468export async function getMergedLocalProjectMcpServers(
469 projectPath: string,
470 claudeConfig?: ClaudeConfig,
471 claudeDirConfig?: ClaudeConfig
472): Promise<Record<string, McpServerConfig>> {
473 const config = claudeConfig ?? (await readClaudeConfig())
474 const dirConfig = claudeDirConfig ?? (await readClaudeDirConfig())
475
476 const resolvedPath = resolveProjectPathFromWorktree(projectPath) || projectPath
477
478 const claudeDirProjectServers =
479 dirConfig.projects?.[resolvedPath]?.mcpServers || {}
480 const mainProjectServers =
481 config.projects?.[resolvedPath]?.mcpServers || {}
482
483 // Higher priority overwrites
484 return {
485 ...claudeDirProjectServers,
486 ...mainProjectServers,
487 }
488}

Callers 2

getAllMcpConfigHandlerFunction · 0.90
claude.tsFile · 0.90

Calls 3

readClaudeConfigFunction · 0.85
readClaudeDirConfigFunction · 0.85

Tested by

no test coverage detected