mcpfleet注册表
用于mcpfleet的REST API后端-存储MCP服务器定义并管理身份验证令牌
CLI工具 · API文档(Swagger) · 报告错误
概述
mcpfleet-registry 是mcpfleet生态系统的服务器端组件。它提供了一个REST API,用于存储、检索和管理MCP服务器定义。它被设计为自托管——在你自己的机器或VPS上运行。
堆栈
| 组件 | 技术 |
|---|---|
| 语言 | Go 1.22 |
| HTTP框架 | Huma v2 (OpenAPI 3.1,自动文档) |
| 路由器 | 智v5 |
| 数据库 | SQLite(WAL模式,零外部依赖) |
| 移民 | 戈兰移民 |
| 容器 | 多阶段Docker构建(约20 MB最终映像) |
快速开始
Docker Compose(推荐)```bash
git clone https://github.com/mcpfleet/mcpfleet-registry
cd mcpfleet-registry
docker compose up -d
API将于 `http://localhost:8080`.
### 手册```bash
git clone https://github.com/mcpfleet/mcpfleet-registry
cd mcpfleet-registry
go mod tidy
go run ./cmd/registry
首次设置
注册表包含一个引导端点,用于创建您的第一个管理员令牌,而不需要身份验证。此终结点仅在数据库中不存在令牌时有效。```bash
Create the first admin token (run once on first startup)
curl -X POST http://localhost:8080/bootstrap \
-H 'Content-Type: application/json' \
-d '{"body": {"name": "admin"}}'
=> {"body": {"id": "...", "name": "admin", "token": "mcp_xxxxxxxxxxxx", "created_at": "..."}}
**重要提示:** 立即保存令牌!引导端点返回完整令牌,但出于安全原因,您应该安全地存储它。
然后将此令牌与mcpfleet CLI一起使用:```bash
export MCPFLEET_REGISTRY_URL=http://localhost:8080
mcpfleet auth login
# enter your token when prompted
认证
全部 /v1/* 端点需要Bearer令牌:```
Authorization: Bearer mcp_
**公共路径** (无需身份验证):
- `GET /healthz` --健康检查
- `GET /docs` --Swagger用户界面
- `GET /openapi.json` --OpenAPI模式
- `POST /bootstrap` --创建第一个管理员令牌(仅在数据库为空时有效)
## API 参考
### 服务器
|方法|路径|描述|
|--------|------|-------------|
| `GET` | `/v1/servers` |列出所有MCP服务器|
| `GET` | `/v1/servers/{name}` |按名称获取服务器|
| `POST` | `/v1/servers` |创建新服务器|
| `PUT` | `/v1/servers/{name}` |更新现有服务器|
| `DELETE` | `/v1/servers/{name}` |删除服务器|
### 身份验证令牌
|方法|路径|描述|
|--------|------|-------------|
| `GET` | `/v1/tokens` |列出所有令牌|
| `POST` | `/v1/tokens` |创建新令牌|
| `DELETE` | `/v1/tokens/{id}` |撤销令牌|
## API文件
运行时,交互式API文档可在以下位置获得:
- **Swagger用户界面**: `http://localhost:8080/docs`
- **OpenAPI JSON**: `http://localhost:8080/openapi.json`
## 配置
|环境变量|默认值|描述|
|----------------------|---------|-------------|
| `PORT` | `8080` |HTTP侦听端口|
| `DB_PATH` | `./registry.db` |SQLite数据库文件的路径|
| `LOG_LEVEL` | `info` |日志级别(调试/信息/警告/错误)|
## 发展```bash
git clone https://github.com/mcpfleet/mcpfleet-registry
cd mcpfleet-registry
go mod tidy
go test ./...
go run ./cmd/registry
码头工人```bash
Build image
docker build -t mcpfleet-registry .
Run with persistent database
docker run -d \
-p 8080:8080 \
-v $(pwd)/data:/data \
-e DB_PATH=/data/registry.db \
mcpfleet-registry
```
贡献
欢迎拉取请求!请先打开一个问题来讨论重大更改。
许可证
麻省理工学院
