dsh-cc/dsh-cc--packages-mcp-mcp-config ↗★ 1
@dsh-cc/mcp-config
MCP workspace-configuration loader: parses .mcp.json into mcp-client registrations 适合用配置文件批量管理 MCP 服务器的用户,需配合 MCP 客户端使用。
설치
검증된 bundle이 없거나 호환성 검사에 실패했습니다. 먼저 저장소 설명을 읽어 주세요. 전체 README 읽기 ↗
Usage
import { buildRegistrations, type McpConfigPolicy } from '@dsh-cc/mcp-config'
import { readFileSync } from 'node:fs'
const body = JSON.parse(readFileSync('.mcp.json', 'utf8'))
const policy: McpConfigPolicy = {
deny: (name) => name === 'blocked-saas',
allow: (name) => name !== 'experimental',
}
// registrations: mcp-client Config objects (with serverName), in stable config order
const registrations = buildRegistrations(body, { env: process.env, policy })
for (const config of registrations) {
await ctx.plugin(mcpClient, config)
}
A typical .mcp.json:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": { "GITHUB_TOKEN": "${GITHUB_TOKEN}" }
},
"web": {
"type": "http",
"url": "https://mcp.example.com/mcp",
"headers": { "Authorization": "Bearer ${MCP_TOKEN}" }
},
"feed": {
"type": "sse",
"url": "https://sse.example.com/events"
}
}
}