Vault 与 credential 的复用结构。
Vault 对象
创建、查询、列表和归档接口都会返回该结构。
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | Vault ID,前缀为 vault_ |
type | string | 固定值 "vault" |
display_name | string | Vault 展示名称,最长 255 字符 |
metadata | object | Metadata 对象 |
credentials | Vault credential 数组 | 仅创建 Vault 的响应中返回,值固定为空数组;凭证通过独立的 credential 接口管理 |
archived_at | string | null | 归档时间;active 时为 null |
created_at | string | 创建时间 |
updated_at | string | 最后更新时间 |
Vault credential
创建 credential、列表 credential 和归档 credential 接口会返回该结构。
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | Credential ID,前缀为 vcred_ |
type | string | 固定值 "vault_credential" |
vault_id | string | 所属 Vault ID |
auth | Credential auth object | 脱敏后的鉴权信息;不会返回密文 |
display_name | null | 当前固定为 null |
metadata | object | 与 credential 一起存储的自定义元数据对象;省略时为 {} |
archived_at | string | null | 归档时间;active 时为 null |
created_at | string | 创建时间 |
updated_at | string | 最后更新时间 |
token、access_token、refresh_token 和 client_secret)只在创建请求中接收,永远不会在响应中返回。
创建 credential 请求
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
auth | object | 是 | 凭证鉴权信息 |
display_name | string | 否 | 兼容字段;当前响应固定为 null,不持久化 |
metadata | object | 否 | 与 credential 一起存储的自定义元数据对象;省略时为 {} |
Credential auth object
static_bearer
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
type | string | 是 | static_bearer |
mcp_server_url | string | 是 | MCP server URL,最长 2048 字符 |
token | string | 是 | 安全存储在 Vault 中的 Bearer token;不会返回 |
token。
mcp_oauth
已有 OAuth token 时,可在创建凭证中使用该对象。如果需要通过浏览器授权获取 token,请使用发起 MCP OAuth;callback 成功后 CAS 会创建该 Credential。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
type | string | 是 | mcp_oauth |
mcp_server_url | string | 是 | MCP server URL,最长 2048 字符 |
access_token | string | 是 | OAuth access token;不会返回 |
expires_at | string | 否 | Access token 过期时间,RFC 3339 格式 |
refresh | MCP OAuth refresh 对象 | 否 | Refresh 配置。响应中会去除 refresh_token 和 client_secret |
access_token。存在 refresh 时,还会省略 refresh_token 和 token_endpoint_auth.client_secret。
environment_variable
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
type | string | 是 | environment_variable |
secret_name | string | 是 | 环境变量名,必须匹配 [A-Za-z_][A-Za-z0-9_]* |
secret_value | string | 是 | Secret 值;不会返回 |
MCP OAuth refresh 对象
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
client_id | string | 是 | OAuth client ID |
refresh_token | string | 是 | OAuth refresh token;不会返回 |
token_endpoint | string | 是 | OAuth token endpoint URL |
token_endpoint_auth | object | 是 | Token endpoint 使用的认证信息,见下表 |
resource | string | 否 | Refresh 时发送的 OAuth protected-resource identifier |
scope | string | 否 | Refresh 时发送的、以空格分隔的 OAuth scopes |
Token endpoint auth 对象
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
type | string | 是 | none、client_secret_basic 或 client_secret_post |
client_secret | string | client_secret_basic 或 client_secret_post 必填 | OAuth client secret;不会返回 |
mcp_oauth Credential。服务商轮换 refresh token 时,CAS 会原子地保存新 token。
Start OAuth 请求
用于 POST /api/v1/cloud/oauth/start。完整流程详见发起 MCP OAuth。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
vault_id | string | 是 | 授权结果 Credential 所属的 Vault |
mcp_server_url | string | 是 | 用于 discovery 和 Credential 匹配的 MCP URL |
client_id | string | 否 | 预先注册的 OAuth client ID |
client_secret | string | 否 | 所传 client ID 的 secret |
Start OAuth 响应
| 字段 | 类型 | 说明 |
|---|---|---|
authorization_url | string | 需要在浏览器打开的服务商授权地址 |
state | string | 不透明的短期 OAuth state |
callback_origin | string | 浏览器 callback message 的预期来源 origin |

