Automattic\WooCommerce\Internal\Abilities

AbilitiesTracking::is_mcp_request │ private │ WC 1.0

Whether this is an MCP request.

MCP Streamable HTTP clients send MCP-Protocol-Version on every request after initialization (2025-06-18 and later) and Mcp-Session-Id when the server assigned a session, whichever server implementation handles them.

Method of the class: AbilitiesTracking{}

No Hooks.

Returns

bool.

Usage

// private - for code of main (parent) class only
$result = $this->is_mcp_request(): bool;

AbilitiesTracking::is_mcp_request() code WC 11.3.0

private function is_mcp_request(): bool {
	if ( null === $this->is_mcp_request ) {
		$this->is_mcp_request = isset( $_SERVER['HTTP_MCP_PROTOCOL_VERSION'] ) || isset( $_SERVER['HTTP_MCP_SESSION_ID'] );
	}
	return $this->is_mcp_request || $this->is_json_rpc_tool_call();
}