内容
# 技术 MCP 服务器
[](https://github.com/osinfra-io/pt-techne-mcp-server/actions/workflows/go-test.yml)
[](https://github.com/osinfra-io/pt-techne-mcp-server/actions/workflows/dependabot.yml)
模型上下文协议(MCP)服务器,为 AI 助手提供平台上下文和工具。暴露确定性、类型化的工具,以便平台代理调用测试的渲染器,而不是手动编写 HCL。
## 用法
### Docker(推荐)
在 MCP 客户端配置文件(例如 `.copilot/mcp.json`、`mcp.json`)中添加以下条目:
```json
{
"mcpServers": {
"pt-techne-mcp-server": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "GITHUB_TOKEN",
"ghcr.io/osinfra-io/pt-techne-mcp-server:latest"
]
}
}
}
```
### 下载二进制文件
为 Linux(amd64、arm64)预构建的二进制文件附在每个 [GitHub 发布](https://github.com/osinfra-io/pt-techne-mcp-server/releases) 中:
```sh
# 下载适用于您架构的最新版本
gh release download --repo osinfra-io/pt-techne-mcp-server --pattern '*linux-amd64'
chmod +x pt-techne-mcp-server-linux-amd64
```
然后配置您的 MCP 客户端:
```json
{
"mcpServers": {
"pt-techne-mcp-server": {
"command": "/path/to/pt-techne-mcp-server-linux-amd64",
"env": {
"GITHUB_TOKEN": "<您的令牌>"
}
}
}
}
```
### 从源代码构建
```sh
go install github.com/osinfra-io/pt-techne-mcp-server/cmd/pt-techne-mcp-server@latest
```
```json
{
"mcpServers": {
"pt-techne-mcp-server": {
"command": "pt-techne-mcp-server",
"env": {
"GITHUB_TOKEN": "<您的令牌>"
}
}
}
}
```
### 验证
发布工件使用 [cosign keyless](https://docs.sigstore.dev/cosign/signing/overview/)(Sigstore OIDC)签名。安装 [cosign](https://docs.sigstore.dev/cosign/system_config/installation/) 以进行验证。
**容器镜像:**
```sh
cosign verify ghcr.io/osinfra-io/pt-techne-mcp-server:<标签> \
--certificate-identity-regexp='https://github.com/osinfra-io/pt-techne-mcp-server/.github/workflows/release.yml@refs/tags/.*' \
--certificate-oidc-issuer='https://token.actions.githubusercontent.com'
```
**二进制文件:**
```sh
gh release download --repo osinfra-io/pt-techne-mcp-server --pattern '*linux-amd64*'
cosign verify-blob pt-techne-mcp-server-linux-amd64 \
--bundle pt-techne-mcp-server-linux-amd64.bundle \
--certificate-identity-regexp='https://github.com/osinfra-io/pt-techne-mcp-server/.github/workflows/release.yml@refs/tags/.*' \
--certificate-oidc-issuer='https://token.actions.githubusercontent.com'
```
### 配置
设置 `GITHUB_TOKEN` 以访问 `osinfra-io/pt-logos`、`osinfra-io/pt-corpus`、`osinfra-io/pt-pneuma` 和 `osinfra-io/pt-ekklesia-docs`。如果没有它,GitHub 支持的工具将返回 `not_configured`;离线工具(`validate_team_spec`、`render_team_tfvars`、`render_team_docs_index`、`render_sidebar_patch`)仍然有效。
对于本地开发,`gh auth token` 是最简单的选项。有关令牌范围、来源和操作错误代码的详细信息,请参见 [docs/configuration.md](docs/configuration.md)。
## 工具
| 工具 | 描述 |
|---|---|
| `validate_team_spec` | 验证团队规范是否符合 JSON 模式 |
| `render_team_tfvars` | 将规范渲染为规范的 pt-logos `.tfvars` 字节 |
| `open_team_pr` | 验证、渲染并在 pt-logos 上打开/更新拉取请求 |
| `list_teams` | 列出 pt-logos@main 中的所有团队 |
| `get_team` | 获取单个团队的规范和文档页面 |
| `lookup_user` | 查找用户出现的所有团队/角色 |
| `find_repo` | 查找哪些团队拥有仓库 |
| `next_available_cidrs` | 计算下一个 N 个未分配的 GKE 子网 CIDR 槽 |
| `render_corpus_helpers` | 将工作区插入 pt-corpus `helpers.tofu` |
| `render_pneuma_helpers` | 将工作区插入 pt-pneuma `helpers.tofu` |
| `render_team_docs_index` | 渲染团队的文档索引页 |
| `render_sidebar_patch` | 用团队条目修补 pt-ekklesia-docs `sidebars.js` |
| `open_team_docs_pr` | 渲染文档 + 侧边栏并在 pt-ekklesia-docs 上打开/更新拉取请求 |
所有接受规范的工具都处理 JSON 对象和 JSON 编码字符串(适用于 LLM 双重编码怪癖)。写入工具是幂等的 - 相同的输入返回 `action: "noop"`。
## 本地开发
需要 Go 1.26.3。
```sh
go build ./cmd/pt-techne-mcp-server # 构建二进制文件
go test -race ./... # 运行测试
golangci-lint run # lint(使用 .golangci.yml)
```
模式维护(在编辑 `internal/spec/schema_embed.json` 后运行):
```sh
go run ./internal/schemadoc schema/team.schema.json docs/schema.md # 生成文档
```
## 文档
| 文档 | 描述 |
|---|---|
| [`docs/contributing.md`](docs/contributing.md) | 仓库布局、架构、如何添加工具 |
| [`docs/configuration.md`](docs/configuration.md) | 令牌设置、操作错误代码、工具语义 |
| [`docs/schema.md`](docs/schema.md) | 每个团队规范字段的生成参考 |
| [`schema/team.schema.json`](schema/team.schema.json) | 团队规范模式(符号链接到 `internal/spec/schema_embed.json`) |
## 许可证
GPL-2.0。参见 [LICENSE](LICENSE)。