# Errors and Status Codes

MCP calls are JSON-RPC 2.0 on `POST /mcp`. A successful `tools/call` result has `content` and `structuredContent`. It does not set `isError`.

A bad tool argument is still HTTP 200. The result has `isError: true` and the message in `content`. An unknown tool name is JSON-RPC `-32602`.

`POST /mcp/chatgpt` is the ChatGPT endpoint. It runs the same tools and checks the same scopes before execution. A missing token, an invalid token, or a token without the scope is HTTP 200. The body is a tool result with `isError: true`. `_meta["mcp/www_authenticate"]` is an array of one Bearer challenge for `/.well-known/oauth-protected-resource/mcp/chatgpt`. A token without the scope uses `error="insufficient_scope"`. A JWT is accepted only when its one MCP resource audience is `https://apologetics.wiki/mcp/chatgpt`. An OIDC token may also name the userinfo audience. `/mcp` keeps HTTP 401 and 403 with a JSON-RPC error. This shape has not been tried in a ChatGPT session.

| Code | HTTP | When |
| --- | --- | --- |
| -32700 | 400 | The body is not JSON. |
| -32600 | 400 | The request is invalid, the batch is empty, or the batch is over 10 calls. |
| -32601 | 405 | The method is missing, or the verb is not POST. `Allow` is `POST, OPTIONS`. A browser GET that asks for HTML is the Connect-style page, not this error. |
| -32602 | 200 | The protocol version is unknown, or the tool, prompt, or resource name is unknown. |
| -32603 | 200 | The tool failed. |
| -32001 | 401 | On `/mcp`, the tool needs a scope and the token is missing or invalid. |
| -32003 | 403 | On `/mcp`, the token does not include the scope. The message is `insufficient_scope`. |
| -32029 | 429 | A rate limit. The response includes `Retry-After`, `RateLimit`, and `RateLimit-Policy`. |

When accounts storage is down, the response is HTTP 503 and the JSON body is `{ "error": "accounts_unavailable" }`.

## Example

A missing token on a suggest tool at `/mcp`.

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32001,
    "message": "Sign-in required"
  }
}
```

The same call at `/mcp/chatgpt`. HTTP 200. The challenge string is the value `/mcp` would send in `WWW-Authenticate`, with this endpoint’s resource metadata.

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "Sign-in required"
      }
    ],
    "isError": true,
    "_meta": {
      "mcp/www_authenticate": [
        "Bearer resource_metadata=\"https://apologetics.wiki/.well-known/oauth-protected-resource/mcp/chatgpt\", scope=\"suggest\", error=\"invalid_token\", error_description=\"Sign-in required\""
      ]
    }
  }
}
```