使用说明
Keylime MCP
MCP服务器和以隐私为中心的web客户端 Keylime 远程认证。
需求
- 跑步 Keylime验证器 和 注册员
- Keylime试剂 监控
- 对Keylime API端点的网络访问
- MCP客户端 (克劳德代码、克劳德桌面、克莱恩等)
用法
选项1:MCP客户端
构建服务器:
make build-server
克劳德代码:
claude mcp add keylime --scope user /full/path/to/keylime-mcp/bin/server
克劳德桌面版 以及其他基于配置文件的MCP客户端(~/.config/Claude/claude_desktop_config.json):
{
"mcpServers": {
"keylime": {
"command": "/full/path/to/keylime-mcp/bin/server",
"env": {
"KEYLIME_CERT_DIR": "/full/path/to/keylime/certs/dir"
}
}
}
}
这 env block是可选的--服务器默认为 /var/lib/keylime/cv_ca证书需要读取权限(运行 make setup-certs).
选项2:Web用户界面
make run
访问地址:http://localhost:3000
配置
复制 .env.example 到 .env 并调整:
| 变量 | 默认值 | 描述 |
|---|---|---|
KEYLIME_VERIFIER_URL |
https://localhost:8881 |
验证程序API终结点 |
KEYLIME_REGISTRAR_URL |
https://localhost:8891 |
注册商API终点 |
KEYLIME_API_VERSION |
v2.5 |
Keylime REST API版本 |
KEYLIME_CERT_DIR |
/var/lib/keylime/cv_ca |
mTLS证书目录 |
KEYLIME_TLS_ENABLED |
true |
启用mTLS进行Keylime通信 |
KEYLIME_TLS_SERVER_NAME |
localhost |
Keylime证书SAN中的预期服务器名称 |
ANTHROPIC_API_KEY |
-- | Claude提供者需要 |
OLLAMA_URL |
http://localhost:11434 |
Ollama API端点(用于本地LLM) |
OLLAMA_MODEL |
-- | Ollama型号名称(例如。, qwen2.5) |
MASKING_ENABLED |
true |
在发送到LLM之前屏蔽敏感数据 |
PORT |
3000 |
Web UI端口 |
命令
对项目的控制由Makefile管理。由于此项目作为本地控制器工作,Makefile完美地处理了这些任务,并允许用户使用以下命令管理整个系统:
| 命令 | 描述 |
|---|---|
make install |
应在首次设置时运行。跑 setup-certs, check-deps,创建 .env 从 .env.example,并构建一切 |
make build-server |
仅编译MCP服务器二进制文件 |
make build |
编译整个项目(客户端和服务器端) |
make run |
编译并运行整个项目 |
make start |
在不编译的情况下运行项目(使用预构建的二进制文件) |
make setup-certs |
授予对Keylime证书的读取权限,并通过systemd服务在重新启动后保持不变 |
make setup-certs-session |
相同,但仅适用于当前会话(重启后无法继续) |
make check-deps |
检查运行项目的所有依赖关系 |
make clean |
删除已编译的二进制文件和由创建的systemd服务 setup-certs |
make test |
运行单元测试 |
make test-race |
使用运行单元测试 -race 标志(检测数据竞争) |
make test-e2e |
向测试场提交端到端测试。需要Red Hat VPN访问权限 |
测试
单元测试
make test # run unit tests
make test-race # run with race detector
E2E测试(测试场)
E2E测试在 试验农场 与具有模拟TPM的真实Keylime部署相比。通过以下方式在PR上自动触发 派克特.
make test-e2e # requires Testing Farm API token + Red Hat VPN
TMT计划 e2e/plans/: keylime-mcp-server, keylime-mcp-client, keylime-mcp-main.
进一步阅读
贡献
欢迎捐款。
许可证
阿帕奇-2.0
