内容
# @infracodebase/mcp
MCP 服务器将 [infracodebase](https://infracodebase.com) 的合规性、规则集和治理带到您的 AI 代理。适用于 Claude Code/Desktop、Cursor 或您喜欢的任何 MCP 客户端。
## 快速入门
从 [infracodebase.com/settings/tokens](https://infracodebase.com/settings/tokens) 获取令牌,然后使用令牌将其添加到您的 MCP 客户端的 `env` 中。
对于 Claude Code:
```bash
claude mcp add infracodebase --env INFRACODEBASE_TOKEN=icb_pat_xxx -- npx -y @infracodebase/mcp@latest
```
对于 Claude Desktop / Cursor 和其他客户端,请添加到您的 `mcp.json`:
```json
{
"mcpServers": {
"infracodebase": {
"command": "npx",
"args": ["-y", "@infracodebase/mcp@latest"],
"env": { "INFRACODEBASE_TOKEN": "icb_pat_xxx" }
}
}
}
```
## 自托管
将 `INFRACODEBASE_API_URL` 添加到同一个 `env` 块(或传递 `--api-url`)
```json
"env": {
"INFRACODEBASE_TOKEN": "icb_pat_xxx",
"INFRACODEBASE_API_URL": "https://infra.your-company.com/api/v1"
}
```
没有公共 npm 访问权限?从克隆版本运行 - 相同的服务器。构建它,然后使用相同的 `env` 将您的客户端指向 `node /abs/path/to/mcp/dist/index.js`:
```bash
git clone https://github.com/onwardplatforms/infracodebase-mcp.git
cd infracodebase-mcp && npm install && npm run build
```
## 配置
令牌和 API URL 从标志 → 环境变量 → 默认值中解析。没有存储的配置文件:MCP 客户端拥有配置,并通过 `env` 传递。
| 标志 | 环境变量 | 默认值 |
| ----------------- | ----------------------- | ---------------------------------- |
| `--token=<token>` | `INFRACODEBASE_TOKEN` | 必需 |
| `--api-url=<url>` | `INFRACODEBASE_API_URL` | `https://infracodebase.com/api/v1` |
## 命令行界面
您很少直接运行此命令 - 您的 MCP 客户端会启动它。当您运行时,请使用 `npx` 形式(或全局安装的 `infracodebase` / `infracodebase-mcp`):
```bash
npx -y @infracodebase/mcp@latest # 启动服务器(stdio)- 默认
npx -y @infracodebase/mcp@latest help # 完整用法
```
## 开发
```bash
npm install
npm run build
npm run test:run # 单元测试(Vitest)
npm run smoke # MCP 协议层的离线测试
```
参见 [CONTRIBUTING.md](https://github.com/onwardplatforms/infracodebase-mcp/blob/main/CONTRIBUTING.md) 以获取完整指南。MIT 许可。
## 版本发布
版本会自动发布到 npm。每个版本都会标记为 `vX.Y.Z`,并从该版本中的更改中生成注释 - 请在 [GitHub Releases 页面](https://github.com/onwardplatforms/infracodebase-mcp/releases) 上浏览完整的更改日志。