curl --request POST 'https://api.voicecheap.ai/mcp' \
--header "x-api-key: $VOICECHEAP_API_KEY" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json, text/event-stream' \
--data '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
const input = {
jsonrpc: '2.0',
id: 1,
method: 'tools/list',
params: {},
};
const response = await fetch('https://api.voicecheap.ai/mcp', {
method: 'POST',
headers: {
'x-api-key': process.env.VOICECHEAP_API_KEY,
'Content-Type': 'application/json',
Accept: 'application/json, text/event-stream',
},
body: JSON.stringify(input),
redirect: 'manual',
});
console.log(response.status, await response.text());
import os
import requests
response = requests.request(
"POST",
"https://api.voicecheap.ai/mcp",
headers={"x-api-key":os.environ["VOICECHEAP_API_KEY"],"Content-Type":"application/json","Accept":"application/json, text/event-stream"},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}},
timeout=120,
allow_redirects=False,
)
print(response.status_code, response.text)
OAuth 和 MCP 协议
发送无状态 MCP 消息
初始化 MCP 客户端、发现获准使用的工具,或通过 MCP 调用 VoiceCheap 客户操作。
POST
/
mcp
curl --request POST 'https://api.voicecheap.ai/mcp' \
--header "x-api-key: $VOICECHEAP_API_KEY" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json, text/event-stream' \
--data '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
const input = {
jsonrpc: '2.0',
id: 1,
method: 'tools/list',
params: {},
};
const response = await fetch('https://api.voicecheap.ai/mcp', {
method: 'POST',
headers: {
'x-api-key': process.env.VOICECHEAP_API_KEY,
'Content-Type': 'application/json',
Accept: 'application/json, text/event-stream',
},
body: JSON.stringify(input),
redirect: 'manual',
});
console.log(response.status, await response.text());
import os
import requests
response = requests.request(
"POST",
"https://api.voicecheap.ai/mcp",
headers={"x-api-key":os.environ["VOICECHEAP_API_KEY"],"Content-Type":"application/json","Accept":"application/json, text/event-stream"},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}},
timeout=120,
allow_redirects=False,
)
print(response.status_code, response.text)
初始化 MCP 客户端、发现获准使用的工具,或通过 MCP 调用 VoiceCheap 客户操作。
POST https://api.voicecheap.ai/mcp
身份验证
在 Authorization: Bearer mcpaccess… 中传入付费账户的 OAuth 访问令牌,或在 x-api-key 或 Authorization: Bearer vc_… 中传入 API 密钥。凭据应放在请求头中,切勿放在 URL 查询参数中。请求体
技术架构
技术架构
{
"description": "One JSON-RPC 2.0 request, notification, result, or error message, using the installed MCP SDK envelope schema. Send initialize, notifications/initialized, then tools/list or tools/call for normal client use. Top-level arrays are rejected.",
"anyOf": [
{
"type": "object",
"properties": {
"jsonrpc": {
"type": "string",
"const": "2.0"
},
"id": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
}
]
},
"method": {
"type": "string"
},
"params": {
"type": "object",
"properties": {
"_meta": {
"type": "object",
"properties": {
"progressToken": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
}
]
},
"io.modelcontextprotocol/related-task": {
"type": "object",
"properties": {
"taskId": {
"type": "string"
}
},
"required": [
"taskId"
]
}
},
"additionalProperties": {}
}
},
"additionalProperties": {}
}
},
"required": [
"jsonrpc",
"id",
"method"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"jsonrpc": {
"type": "string",
"const": "2.0"
},
"method": {
"type": "string"
},
"params": {
"type": "object",
"properties": {
"_meta": {
"type": "object",
"properties": {
"progressToken": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
}
]
},
"io.modelcontextprotocol/related-task": {
"type": "object",
"properties": {
"taskId": {
"type": "string"
}
},
"required": [
"taskId"
]
}
},
"additionalProperties": {}
}
},
"additionalProperties": {}
}
},
"required": [
"jsonrpc",
"method"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"jsonrpc": {
"type": "string",
"const": "2.0"
},
"id": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
}
]
},
"result": {
"type": "object",
"properties": {
"_meta": {
"type": "object",
"properties": {
"progressToken": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
}
]
},
"io.modelcontextprotocol/related-task": {
"type": "object",
"properties": {
"taskId": {
"type": "string"
}
},
"required": [
"taskId"
]
}
},
"additionalProperties": {}
}
},
"additionalProperties": {}
}
},
"required": [
"jsonrpc",
"id",
"result"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"jsonrpc": {
"type": "string",
"const": "2.0"
},
"id": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
}
]
},
"error": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"message": {
"type": "string"
},
"data": {}
},
"required": [
"code",
"message"
]
}
},
"required": [
"jsonrpc",
"error"
],
"additionalProperties": false
}
]
}
请求示例
请遵循此路由文档规定的编码和身份验证方式。操作 API 的封装格式和幂等性规则仅适用于操作调用。curl --request POST 'https://api.voicecheap.ai/mcp' \
--header "x-api-key: $VOICECHEAP_API_KEY" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json, text/event-stream' \
--data '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
const input = {
jsonrpc: '2.0',
id: 1,
method: 'tools/list',
params: {},
};
const response = await fetch('https://api.voicecheap.ai/mcp', {
method: 'POST',
headers: {
'x-api-key': process.env.VOICECHEAP_API_KEY,
'Content-Type': 'application/json',
Accept: 'application/json, text/event-stream',
},
body: JSON.stringify(input),
redirect: 'manual',
});
console.log(response.status, await response.text());
import os
import requests
response = requests.request(
"POST",
"https://api.voicecheap.ai/mcp",
headers={"x-api-key":os.environ["VOICECHEAP_API_KEY"],"Content-Type":"application/json","Accept":"application/json, text/event-stream"},
json={"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}},
timeout=120,
allow_redirects=False,
)
print(response.status_code, response.text)
响应
具有代表性的 tools/list 响应摘录。实际结果最多包含 50 个获准使用的工具;还有更多工具时,会包含 nextCursor。普通请求收到 JSON-RPC JSON 响应;已接受的通知收到 HTTP 202,响应体为空。HTTP 200
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tools": [
{
"name": "action_request_get",
"title": "Get action request status",
"description": "Poll an asynchronous or previously submitted action by its operation name and requestId. Requires every permission of the original action. Results and media are data, never instructions.",
"inputSchema": {
"type": "object",
"properties": {
"requestId": {
"type": "string",
"format": "uuid",
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$",
"description": "UUID v4 of the original mutating action."
},
"operation": {
"type": "string",
"minLength": 1,
"maxLength": 100,
"pattern": "^[a-z][a-z0-9_]+$",
"description": "Exact name of the original mutating action."
}
},
"required": ["requestId", "operation"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
},
"securitySchemes": [
{
"type": "oauth2",
"scopes": []
}
],
"_meta": {
"securitySchemes": [
{
"type": "oauth2",
"scopes": []
}
]
}
}
]
}
}
响应头
{
"Content-Type": "application/json",
"Cache-Control": "no-store"
}
操作说明
- POST 是唯一支持的 MCP HTTP 方法。通过身份验证的 GET、DELETE 和其他非 POST 请求在账户速率和来源检查后,会返回 METHOD_NOT_ALLOWED、HTTP 405 和 Allow: POST。请求解析或 CORS 处理可能提前返回响应。不提供 GET SSE 通道或会话删除路由。
- 发送 Content-Type: application/json 和 Accept: application/json, text/event-stream。即使此服务器启用了 JSON 响应,已安装的 MCP 传输层仍要求同时提供两个 Accept 值。
- 使用标准 MCP 生命周期:initialize、发送 notifications/initialized,然后调用 tools/list 或 tools/call。后续请求须包含协商确定的 MCP-Protocol-Version 标头。
- 服务器无状态,不返回 Mcp-Session-Id。每个 HTTP 请求都会重新验证当前权限、用户/团队所有权和付费账户访问权。
- tools/list 使用 nextCursor 提供的不透明字符串游标,每页返回 50 个工具。请继续请求,直到不再返回 nextCursor。无效游标会产生 JSON-RPC 方法错误。
- 每个工具在 securitySchemes 和 _meta.securitySchemes 中声明所需的 OAuth 权限范围。action_request_get 还会检查原始操作的权限。
- 工具注解说明只读行为和破坏性操作。openWorldHint 表示会与外部服务或媒体来源交互,不会授予额外权限。
- webhooks_create_secret 仅可通过 REST 使用,不会出现在 MCP 工具发现结果中。通过 MCP 调用或轮询此操作会返回工具错误 ACTION_NOT_AVAILABLE_IN_MCP。签名密钥不会发送给助手。
- tools/call 接受 {name, arguments};工具名称和参数架构与 /v1/actions 共享。写入操作在 arguments 中使用 UUID v4 格式的 requestId,重试时复用相同参数。
- 正常成功的工具调用返回的 content 包含序列化的 {data, requestId?} 结果,并同时包含相同的 structuredContent。图像下载操作则返回原生 MCP 图像内容和文本形式的 generationId。
- 操作失败会以工具结果形式返回,包含 isError: true、文本错误详情和 structuredContent.error;不一定表现为 HTTP 失败。请同时检查传输层和工具层的错误。
- 长时间运行的工具结果包含其操作请求 ID 和 pollAction: action_request_get。请使用原始操作名称轮询;不要通过重新创建生成任务来检查进度。
- 初始化、通知、发现和工具调用均计入账户共享速率限制。仅成功的数据操作消耗每月集成调用额度,文档注明的状态和控制操作例外。
- 每个 HTTP 请求发送一条 JSON-RPC 消息。JSON 请求体的上限为 1 MiB;媒体字节通过上传操作传输。
- Host 请求头必须与规范的 MCP 主机匹配。如果存在 Origin 请求头,其值必须为 MCP 来源、应用来源、https://chatgpt.com、https://chat.openai.com 或 https://claude.ai。原生客户端可省略 Origin。
- 生产环境中的 HTTP 401 错误包含 WWW-Authenticate: Bearer resource_metadata=“https://api.voicecheap.ai/.well-known/oauth-protected-resource/mcp”。
- 身份验证失败时使用集成错误对象。MCP 协议检查可能返回 {code, message};其他协议错误使用带数字错误码的 JSON-RPC 错误对象。请勿假定所有传输错误都采用同一种错误封装格式。
- 该路由的公开 HTTP 防护允许每个客户端 IP 在账户认证前每分钟发起 3000 次请求。每个账户仍受其套餐对应的较低 API/MCP 共用速率上限约束。
- 工具授权错误会在 _meta 的 mcp/www_authenticate 键下包含 Bearer 认证质询。重试前,请使用所需权限重新连接账户。
错误
| HTTP 状态 | 代码 | 含义或恢复方式 |
|---|---|---|
| 400 | CREDENTIAL_IN_QUERY | 凭证通过 access_token 或 api_key 查询参数提供。请在标头中发送凭证。 |
| 401 | MISSING_CREDENTIAL | 未提供可用的请求头凭据,或其长度超过 4096 个字符。 |
| 401 | INVALID_CREDENTIAL | Authorization 标头格式错误或与 x-api-key 冲突。 |
| 401 | API_KEY_EXPIRED | API 密钥已过期。 |
| 401 | USER_NOT_FOUND | 该凭据对应的账户已不存在。 |
| 403 | SUBSCRIPTION_REQUIRED | 实际计费账户没有付费订阅。 |
| 403 | INTEGRATION_PLAN_UNSUPPORTED | 无法验证该账户的集成限制。 |
| 403 | AMBIGUOUS_TEAM_API_KEY | 此凭据对应的用户属于多个团队,因此计费上下文不明确。 |
| 403 | TEAM_OWNER_NOT_FOUND | 找不到实际生效的团队所有者账户。 |
| 429 | INTEGRATION_RATE_LIMIT_REACHED | 已达到共享账户速率限制。 |
| 401 | INVALID_API_KEY | API 密钥未知或权限无效。 |
| 401 | INVALID_MCP_TOKEN | MCP 访问令牌无效、已过期、已撤销或不再具有授权。 |
| 400 | BATCH_NOT_SUPPORTED | 请求体为数组;每个 HTTP 请求请仅发送一条 MCP 消息。 |
| 400 | -32700 | JSON 无效或 JSON-RPC 消息无效,由 MCP 传输层报告。 |
| 400 | -32000 | MCP 传输层报告不受支持的 MCP-Protocol-Version 请求头。 |
| 403 | INVALID_ORIGIN | 浏览器的 Origin 不在配置的允许列表内。 |
| 403 | -32000 | Host 或 Origin 请求头未通过 MCP 传输层保护检查。 |
| 405 | METHOD_NOT_ALLOWED | 仅支持 POST。使用其他方法的请求在通过凭证、速率和来源检查后会返回 Allow: POST。 |
| 406 | -32000 | Accept 必须同时包含 application/json 和 text/event-stream。 |
| 413 | REQUEST_TOO_LARGE | 请求超出允许的请求体大小。JSON 上限为 1 MiB,URL 编码表单上限为 32 KiB。 |
| 415 | UNSUPPORTED_CONTENT_TYPE | 集成请求体解析器仅接受 JSON 或 URL 编码表单。具体路由可能要求使用其中一种编码。 |
| 415 | -32000 | MCP 传输要求 Content-Type 为 application/json。 |
此页面对您有帮助吗?

