dsh-cc/dsh-cc--packages-mcp-mcp-config ↗★ 1

@dsh-cc/mcp-config

解析工作区 .mcp.json,生成 MCP 客户端注册配置,支持允许与拒绝策略。 适合用配置文件批量管理 MCP 服务器的用户,需配合 MCP 客户端使用。

包名
@dsh-cc/mcp-config
兼容性
待验证
Harness 依赖范围
>=0.1.5-rc.1
Cordis 依赖范围
>=0.1.5-rc.1
版本
0.7.1
许可证
Apache-2.0
最近更新
2026年9月16日

安装

此插件尚未提供可验证的 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"
    }
  }
}