跳转到主要内容

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_id}/credentials 为指定 Vault 添加一个新的 MCP 服务器凭证。

请求头

头部必选说明
AuthorizationBearer <PAT>
Content-Typeapplication/json

路径参数

参数类型必选说明
vault_idstringVault 的唯一标识符

请求体

字段类型必选说明
mcp_server_urlstringMCP 服务器的完整 URL
protocolstring通信协议,可选值:ssestreamable_http
typestring凭证类型,当前仅支持 static_bearer
access_tokenstring访问令牌(static_bearer 类型必填)

示例请求

curl -X POST "https://openapi.qoder.sh/api/v1/cloud/vaults/vault_019e3bb940277f0db05ab74291acf6ef/credentials" \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "mcp_server_url": "https://example.com/mcp-stream",
    "protocol": "streamable_http",
    "type": "static_bearer",
    "access_token": "your-access-token"
  }'

示例响应

HTTP 201 Created
{
  "id": "vcred_019e3bb98877759e862750b495c1fce8",
  "vault_id": "vault_019e3bb940277f0db05ab74291acf6ef",
  "mcp_server_url": "https://example.com/mcp-stream",
  "protocol": "streamable_http",
  "type": "static_bearer",
  "status": "active",
  "created_at": "2026-05-18T15:34:35.387093Z",
  "updated_at": "2026-05-18T15:34:35.387093Z"
}

响应字段

字段类型说明
idstring凭证唯一标识符(vcred_ 前缀)
vault_idstring所属 Vault 的 ID
mcp_server_urlstringMCP 服务器 URL
protocolstring协议类型:ssestreamable_http
typestring凭证类型
statusstring状态:active
created_atstring创建时间(ISO 8601)
updated_atstring最后更新时间(ISO 8601)

错误码

HTTPtype触发条件
400invalid_request_error缺少必填字段:Field 'access_token' is required for static_bearer type.
401authentication_error缺少或无效的认证令牌
404not_found_errorVault 不存在或已删除

注意事项

  • 响应中不会返回 access_token 的值(出于安全考虑)
  • 一个 Vault 可以包含多个凭证
  • 凭证创建后立即为 active 状态
完整错误信封说明详见 错误参考