Documentation Index
Fetch the complete documentation index at: https://docs.qoder.com/llms.txt
Use this file to discover all available pages before exploring further.
POST /v1/vaults
创建一个新的 Vault 资源。Vault 用于安全存储 MCP 服务器的访问凭证。创建时必须包含至少一个凭证。
请求头
| 头部 | 必选 | 说明 |
|---|
Authorization | 是 | Bearer <PAT> |
Content-Type | 是 | application/json |
请求体
| 字段 | 类型 | 必选 | 说明 |
|---|
display_name | string | 是 | Vault 显示名称 |
credentials | array | 是 | 凭证数组,至少包含一个凭证对象 |
credentials 数组元素:
| 字段 | 类型 | 必选 | 说明 |
|---|
mcp_server_url | string | 是 | MCP 服务器 URL |
protocol | string | 是 | 协议类型,可选值:sse、streamable_http |
type | string | 是 | 凭证类型,当前仅支持 static_bearer |
access_token | string | 是 | 访问令牌(static_bearer 类型必填) |
示例请求
curl -X POST "https://openapi.qoder.sh/api/v1/cloud/vaults" \
-H "Authorization: Bearer $QODER_PAT" \
-H "Content-Type: application/json" \
-d '{
"display_name": "my-mcp-vault",
"credentials": [
{
"mcp_server_url": "https://example.com/mcp",
"protocol": "sse",
"type": "static_bearer",
"access_token": "your-access-token"
}
]
}'
示例响应
HTTP 201 Created
{
"id": "vault_019e3bb940277f0db05ab74291acf6ef",
"type": "vault",
"display_name": "my-mcp-vault",
"status": "active",
"metadata": {},
"credentials": [
{
"id": "vcred_019e3bb940297658a632dbf920057eff",
"vault_id": "vault_019e3bb940277f0db05ab74291acf6ef",
"mcp_server_url": "https://example.com/mcp",
"protocol": "sse",
"type": "static_bearer",
"status": "active",
"created_at": "2026-05-18T15:34:16.876188Z",
"updated_at": "2026-05-18T15:34:16.876188Z"
}
],
"created_at": "2026-05-18T15:34:16.874877Z",
"updated_at": "2026-05-18T15:34:16.874877Z"
}
错误码
| HTTP | type | 触发条件 |
|---|
| 400 | invalid_request_error | 缺少 credentials 数组:At least one credential is required when creating a vault. |
| 400 | invalid_request_error | 缺少 access_token:Field 'access_token' is required for static_bearer type. |
| 401 | authentication_error | 缺少或无效的认证令牌 |
完整错误信封说明详见 错误参考。