跳转到内容
EN

校验凭据 MCP OAuth

POST/anthropic/v1/vaults/{vault_id}/credentials/{credential_id}/mcp_oauth_validate◐ 部分支持

请求参数

  • vault_idstring必填

    path: 保险库 ID(路径或查询参数)。

  • credential_idstring必填

    path: 路径参数:凭据 ID。

  • vault_idstring必填

    query: 保险库 ID(路径或查询参数)。

返回

400

只适用于 OAuth 凭据,对其他类型返回 400。结果总是 HTTP 200,status 为 valid、invalid 或 unknown;mcp_probe 只在未通过时给出失败的一步,refresh 只在尝试了续期时给出。

错误按 Claude Managed Agents 格式返回,参见 错误码

请求示例

curl
curl -X POST https://api.deepraxis.com/anthropic/v1/vaults/vlt_123/credentials/vsec_123/mcp_oauth_validate \
  -H "x-api-key: $PRAXIS_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "anthropic-beta: managed-agents-2026-04-01"
Python
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.deepraxis.com/anthropic",
    api_key="$PRAXIS_API_KEY",
)

result = client.beta.vaults.credentials.mcp_oauth_validate("vsec_123", vault_id='vlt_123')
print(result)
TypeScript
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  baseURL: "https://api.deepraxis.com/anthropic",
  apiKey: "$PRAXIS_API_KEY",
});

const result = await client.beta.vaults.credentials.mcpOAuthValidate("vsec_123", {
  "vault_id": "vlt_123"
});
console.log(result);

响应示例 400

{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "Only mcp_oauth credentials can be validated"
  },
  "request_id": "e5363349-bd0e-4e24-b13c-631515bf3769"
}

响应

HTTP 200

Successful response

application/json

名称 类型 说明
credential_id string Unique identifier of the credential that was validated.
has_refresh_token boolean Whether the credential has a refresh token configured.
mcp_probe null | object The failing step of an MCP validation probe.
mcp_probe.http_response null | object An HTTP response captured during a credential validation probe.
mcp_probe.method string The MCP method that failed (for example initialize or tools/list).
refresh null | object Outcome of a refresh-token exchange attempted during credential validation.
refresh.http_response null | object An HTTP response captured during a credential validation probe.
refresh.status string Outcome of a refresh-token exchange attempted during credential validation. - succeeded - The token endpoint returned a new access token. - failed - The token endpoint returned an error response. See http_response for detail. - connect_error - The token endpoint could not be reached (DNS, TLS, or connection error). - no_refresh_token - No refresh token is stored for the credential, so no exchange was attempted.
status string Overall verdict of a credential validation probe.
type string
validated_at string A timestamp in RFC 3339 format
vault_id string Identifier of the vault containing the credential.

示例前提

此示例针对前面创建的 static 凭据,因此实测返回 400 invalid_request_error。要获得校验结果,请先通过一键授权完成用户授权,再将 credential_id 换成产生的 OAuth Secret ID。校验 OAuth 凭据返回 HTTP 200,状态为 valid、invalid 或 unknown。