Glean MDM
一个CLI工具,供IT/MDM管理员在受管设备上的所有受支持的AI编码工具上自动配置MCP(模型上下文协议)服务器。
它做什么
glean-mdm 作为系统级进程运行(通过launchd、systemd或任务调度器),并确保机器上的每个用户都配置了AI编码工具,以连接到组织的Glean MCP服务器。它
- 读取中央配置 (
mcp-config.json对于服务器定义,mdm-config.json工具行为) - 枚举本地用户 在计算机上(macOS、Linux或Windows)
- 配置每个受支持的主机应用程序 通过将Glean MCP服务器条目合并到每个工具的配置文件(JSON、TOML或YAML)中,保留任何现有设置
- 自我更新 每次运行前检查后端是否有新版本
支持的主机
配置由以下因素驱动 @gleanwork/mcp-config-glean,它维护受支持客户端的注册表及其配置文件路径。这包括Claude Code、Cursor、VS Code、Windsurf、Goose、Codex等工具。
用法
# Show help
glean-mdm --help
# Run for all users (typically as root/admin)
glean-mdm run
# Dry run for a single user
glean-mdm run --dry-run --user alice
# Show version
glean-mdm --version
# Install/uninstall the system schedule (launchd/systemd/Task Scheduler)
glean-mdm install-schedule
glean-mdm uninstall-schedule正在生成配置文件
使用 config 用于生成两个配置文件的子命令:
glean-mdm config \
--server-name glean_default \
--server-url https://your-company-be.glean.com/mcp/default \
--auto-update \
--version-url https://your-company-be.glean.com/api/v1/mdm/version \
--binary-url-prefix https://app.glean.com/static/mdm/binaries这写道 mcp-config.json 和 mdm-config.json 转到特定于平台的默认目录。使用 --output-dir 改为写入自定义位置。
| 标志 | 必填 | 说明 |
|---|---|---|
--server-name | yes | MCP服务器的标识符 |
--server-url | 是 | MCP服务器端点URL |
--auto-update / --no-auto-update | yes | 启用或禁用自动二进制更新 |
--version-url | 如果 --auto-update | 获取最新版本信息的URL |
--binary-url-prefix | yes | 下载二进制文件的基本URL |
--pinned-version | no | 固定到特定版本(例如。 1.2.3 或 v1.2.3) |
--output-dir | no | 用于写入配置文件的目录(默认为平台路径) |
配置
配置文件位于特定于平台的默认路径中:
| 平台 | MCP配置 | MDM配置 |
|---|---|---|
| macOS | /Library/Application Support/Glean MDM/mcp-config.json | /Library/Application Support/Glean MDM/mdm-config.json |
| Linux | /etc/glean_mdm/mcp-config.json | /etc/glean_mdm/mdm-config.json |
| 窗户 | C:\ProgramData\Glean MDM\mcp-config.json | C:\ProgramData\Glean MDM\mdm-config.json |
或者使用指定自定义路径 --mcp-config 和 --mdm-config.
mcp-config.json --定义MCP服务器(单个对象或数组):
[
{
"serverName": "glean_default",
"url": "https://your-company-be.glean.com/mcp/default"
}
]mdm-config.json --控制MDM工具行为:
{
"autoUpdate": true,
"versionUrl": "https://your-company-be.glean.com/api/v1/mdm/version",
"binaryUrlPrefix": "https://app.glean.com/static/mdm/binaries",
"pinnedVersion": "1.2.3"
}| 属性 | 类型 | 必填 | 描述 |
|---|---|---|---|
autoUpdate | boolean | 是 | 启用自动二进制更新 |
versionUrl | string(URL) | 如果 autoUpdate 为true | 获取最新版本信息的URL |
binaryUrlPrefix | string(URL) | yes | 下载二进制文件的基本URL |
pinnedVersion | string(semver) | no | 固定到特定版本(例如。 1.2.3 或 v1.2.3) |
发展
# Install dependencies
bun install
# Run tests
bunx vitest run
# Run locally
bun run src/index.ts -- --version
bun run src/index.ts -- run --dry-run --mcp-config ci/smoke-dry-run-mcp-config.json --mdm-config ci/smoke-dry-run-mdm-config.json --user $(whoami)
# Build binaries for all platforms
./build.sh日志
结构化日志将写入下面的平台日志文件,一旦文件超过10MB,将通过截断进行轮换。
| 平台 | 日志路径 |
|---|---|
| macOS | /var/log/glean-mdm.log |
| Linux | /var/log/glean-mdm.log |
| 窗户 | C:\ProgramData\Glean MDM\glean-mdm.log |
释放
推送版本标签以触发发布工作流:
git tag v1.0.0
git push origin v1.0.0这将构建跨平台二进制文件(macOS arm64/x64、Linux arm64/x64和Windows x64),并将其作为GitHub发布资产发布。
