dsh-cc/dsh-cc--packages-mcp-mcp-config ↗★ 1
@dsh-cc/mcp-config
解析工作区 .mcp.json,生成 MCP 客户端注册配置,支持允许与拒绝策略。 适合用配置文件批量管理 MCP 服务器的用户,需配合 MCP 客户端使用。
安裝
此插件尚未提供可驗證的 bundle,或相容性檢查未通過。請先閱讀倉庫說明。 閱讀完整 README ↗
說明文件
閱讀完整 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"
}
}
}