MCP server (Streamable HTTP transport)
package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://api.ai.wpengine.com/v1/mcp"
payload := strings.NewReader("{ \"jsonrpc\": \"2.0\", \"id\": \"example\", \"method\": \"initialize\", \"params\": { \"protocolVersion\": \"example\", \"capabilities\": {}, \"clientInfo\": { \"name\": \"example\", \"version\": \"example\" } } }")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}const url = 'https://api.ai.wpengine.com/v1/mcp';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"jsonrpc":"2.0","id":"example","method":"initialize","params":{"protocolVersion":"example","capabilities":{},"clientInfo":{"name":"example","version":"example"}}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://api.ai.wpengine.com/v1/mcp', [ 'body' => '{ "jsonrpc": "2.0", "id": "example", "method": "initialize", "params": { "protocolVersion": "example", "capabilities": {}, "clientInfo": { "name": "example", "version": "example" } } }', 'headers' => [ 'Authorization' => 'Bearer <token>', 'Content-Type' => 'application/json', ],]);
echo $response->getBody();curl --request POST \ --url https://api.ai.wpengine.com/v1/mcp \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "jsonrpc": "2.0", "id": "example", "method": "initialize", "params": { "protocolVersion": "example", "capabilities": {}, "clientInfo": { "name": "example", "version": "example" } } }'Exposes the gateway as a remote MCP server over the Streamable HTTP transport (JSON-RPC 2.0 over HTTP, optionally upgrading to Server-Sent Events for streamed responses). Accepts either a WP Engine API key (prefixed “wpe_”) carrying the mcp scope, scoped to the key’s project, or an Okta JWT with WPEngine-Account and WPEngine-Project headers (Console Coworker). Interactive OAuth sign-in for external MCP clients (e.g. Claude Desktop) is planned. The gateway does not preserve MCP session state between requests; clients should not rely on server-side session continuity across calls. The list_site_abilities, search_abilities, and run_site_ability tools additionally require a personal API key when using API-key auth; a project-scoped key resolves no acting user and these tools return an unauthorized error. Okta JWT callers use the verified subject instead. For run_site_ability, a timed-out read returns the tool error code timeout, including when WordPress reports an upstream timeout with a REST 504 response. Any WordPress error code and message are retained in the tool error message. Retrying the identical read is safe. An uncertain write returns ambiguous_outcome and must not be retried automatically.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”WP Engine account context. For API keys the account acted on is derived from the key and this header is informational only. For Okta JWT (Console Coworker) this header is required and must match the token’s account claim.
WP Engine project context. Required for Okta JWT callers (Console Coworker). For API keys the project is derived from the key.
Optional. The agent session a knowledge-base tool call is being performed for, when the call answers a tool request from that session. Used only to group the call with the rest of the session’s activity in observability data. It is ignored unless it names a session in the same project as the caller, and it never changes the response.
Request Bodyrequired
Section titled “Request Bodyrequired”JSON-RPC request initiating the MCP session handshake.
object
object
MCP protocol version the client supports, e.g. “2025-06-18”.
Client-declared capabilities (roots, sampling, elicitation, etc.) per the MCP spec.
object
Name and version of an MCP client or server implementation.
object
JSON-RPC liveness check at the protocol level. Distinct from the ping MCP tool invoked via tools/call, which returns the server name and version as tool output.
JSON-RPC request listing the tools this server exposes.
JSON-RPC request invoking one tool.
object
object
Tool name, e.g. list_account_sites.
Tool-specific input matching that tool’s inputSchema. Fetch the authoritative shape live via tools/list rather than relying on static docs.
object
Notification confirming the client has processed the initialize response. Notifications carry no id and receive no reply (HTTP 202).
object
JSON-RPC 2.0 batch of up to 10 messages. POST bodies with more than 10 messages are rejected with HTTP 400 and a JSON-RPC Invalid Request error before any message is dispatched.
JSON-RPC request initiating the MCP session handshake.
object
object
MCP protocol version the client supports, e.g. “2025-06-18”.
Client-declared capabilities (roots, sampling, elicitation, etc.) per the MCP spec.
object
Name and version of an MCP client or server implementation.
object
JSON-RPC liveness check at the protocol level. Distinct from the ping MCP tool invoked via tools/call, which returns the server name and version as tool output.
JSON-RPC request listing the tools this server exposes.
JSON-RPC request invoking one tool.
object
object
Tool name, e.g. list_account_sites.
Tool-specific input matching that tool’s inputSchema. Fetch the authoritative shape live via tools/list rather than relying on static docs.
object
Notification confirming the client has processed the initialize response. Notifications carry no id and receive no reply (HTTP 202).
object
Responses
Section titled “Responses”One application/json JSON-RPC response for a single request, or an array of responses when the POST body was a JSON-RPC batch.
JSON-RPC 2.0 success response. result’s shape depends on the request’s method — see McpInitializeResult, McpPingResult, McpListToolsResult, and McpCallToolResult.
object
Result of an initialize request.
object
Server-declared capabilities. This server advertises tools only — no resources, prompts, sampling, or roots.
object
Name and version of an MCP client or server implementation.
object
Optional human-readable usage instructions from the server.
Empty result confirming the server is responsive.
object
Result of a tools/list request.
object
object
The tool’s input JSON Schema. Fetch live rather than relying on a static copy.
object
The tool’s output JSON Schema, when it declares one.
object
Opaque pagination cursor for the next page, when more tools remain.
Result of a tools/call request.
object
Content blocks returned by the tool (text, images, etc.) per the MCP spec. Shape is per-tool and intentionally not typed further here.
object
Optional structured result matching the tool’s outputSchema, when the tool declares one.
object
True when the tool call failed; content then holds a human-readable error description rather than the tool’s normal result.
JSON-RPC 2.0 error response.
object
JSON-RPC 2.0 error object.
object
JSON-RPC error code (e.g. -32600 Invalid Request, -32601 Method not found, -32602 Invalid params, -32603 Internal error).
Optional additional error context.
object
JSON-RPC 2.0 responses for a batch request.
JSON-RPC 2.0 success response. result’s shape depends on the request’s method — see McpInitializeResult, McpPingResult, McpListToolsResult, and McpCallToolResult.
object
Result of an initialize request.
object
Server-declared capabilities. This server advertises tools only — no resources, prompts, sampling, or roots.
object
Name and version of an MCP client or server implementation.
object
Optional human-readable usage instructions from the server.
Empty result confirming the server is responsive.
object
Result of a tools/list request.
object
object
The tool’s input JSON Schema. Fetch live rather than relying on a static copy.
object
The tool’s output JSON Schema, when it declares one.
object
Opaque pagination cursor for the next page, when more tools remain.
Result of a tools/call request.
object
Content blocks returned by the tool (text, images, etc.) per the MCP spec. Shape is per-tool and intentionally not typed further here.
object
Optional structured result matching the tool’s outputSchema, when the tool declares one.
object
True when the tool call failed; content then holds a human-readable error description rather than the tool’s normal result.
JSON-RPC 2.0 error response.
object
JSON-RPC 2.0 error object.
object
JSON-RPC error code (e.g. -32600 Invalid Request, -32601 Method not found, -32602 Invalid params, -32603 Internal error).
Optional additional error context.
object
Example
{ "jsonrpc": "2.0"}Accepted with no body for JSON-RPC notifications (such as notifications/initialized) that do not expect a response.
Invalid MCP request — for example, a missing or invalid Accept header, an empty POST body, a JSON-RPC batch exceeding 10 messages, or malformed JSON-RPC payload. Oversized batches return HTTP 400 with a JSON-RPC Invalid Request error (code: -32600, message: batch exceeds maximum of 10 calls) before any message is dispatched. Most other validation failures return plain text; MCP standard header mismatches return a JSON-RPC error object instead.
JSON-RPC 2.0 error returned when a POST body is a batch exceeding 10 messages.
object
object
JSON-RPC error code (e.g. -32600 Invalid Request, -32601 Method not found, -32602 Invalid params, -32603 Internal error).
Optional additional error context.
object
object
Example
{ "jsonrpc": "2.0", "error": { "code": -32600, "message": "batch exceeds maximum of 10 calls" }}Missing or invalid bearer token
object
object
Correlation ID for this request, matching the X-Request-ID response header — a 32-character trace ID behind the load balancer, otherwise a UUID. Quote it in support reports.
Example
{ "error": { "type": "invalid_request_error", "request_id": "80f1e2c3a4b5c6d7e8f9a0b1c2d3e4f5" }}Headers
Section titled “Headers”Example
Bearer realm="ai-services"The token is valid, but the request is forbidden. Error type “permission_error” means the token’s scope/permission is insufficient or the authenticated user is not authorized for the target account; “entitlement_required” means the account lacks the required product entitlement; and “account_required” means no billing account could be resolved. On /v1/chat/completions when content moderation is enabled, and on /v1/sessions/{session_id}/events, error type “content_policy_violation” instead means the request content was blocked by content moderation policy; that response never identifies which filter or category matched.
object
object
Correlation ID for this request, matching the X-Request-ID response header — a 32-character trace ID behind the load balancer, otherwise a UUID. Quote it in support reports.
Example
{ "error": { "type": "invalid_request_error", "request_id": "80f1e2c3a4b5c6d7e8f9a0b1c2d3e4f5" }}Request Content-Type is not application/json.
A required dependency is temporarily unavailable. Retry after a short delay with exponential back-off. An entitlement lookup failure uses error type “entitlement_unavailable”.
object
object
Correlation ID for this request, matching the X-Request-ID response header — a 32-character trace ID behind the load balancer, otherwise a UUID. Quote it in support reports.
Example
{ "error": { "type": "invalid_request_error", "request_id": "80f1e2c3a4b5c6d7e8f9a0b1c2d3e4f5" }}