I don't think there will be a unique solution for $W$ in general. Assume $p<n$.
The first-order condition for WLS says that
$$M^\top Wr = 0,$$
where $r = y-\hat{y}$ is a known fixed vector.
This is a linear system in $w_1,\dots,w_n$ with $p$ equations and $n$ unknowns.
Moreover, any $\tilde W$ which satisfies this condition and for which $M^\top \tilde W M$ is invertible will lead to the same $\vec{\alpha}$:
$$(M^T\tilde WM)^{-1}M^T\tilde W\vec{y}=(M^T\tilde WM)^{-1}M^T\tilde WM\vec{\alpha} = \vec{\alpha}.$$
(This second condition will be true if all the weights are positive and $M$ has full column rank.)
We can find weights that work by solving the following system:
$$
\begin{align*}
M^\top Wr &= 0,\\
\sum w_i &= 1,\\
w_i &\geq 0.
\end{align*}
$$
Here is a Pythonic simulation using numpy and cvxpy packages:
import numpy as np
import cvxpy as cp
n = 10
p = 3
X = np.random.randn(n, p)
w_truth = np.random.uniform(0.0, 1.0, size=n)
y = np.random.randn(n)
beta_WLS = np.linalg.inv(X.T @ np.diag(w_truth) @ X) @ (X.T @ np.diag(w_truth) @ y)
y_hat = X @ beta_WLS
r = y - y_hat
w = cp.Variable(n, nonneg=True)
constraints = [
X.T @ cp.diag(w) @ r == 0,
cp.sum(w) == 1.0
]
objective = cp.Minimize(0)
problem = cp.Problem(objective, constraints)
problem.solve()
The weights found are different from the ground truth w_truth:
> w.value
array([0.14236722, 0.11848218, 0.08266685, 0.07218026, 0.10800815,
0.12393363, 0.08405078, 0.10545762, 0.08428544, 0.07856788])
> w_truth/np.sum(w_truth)
array([0.16970982, 0.09158631, 0.11019793, 0.12181479, 0.07958308,
0.10987568, 0.10230436, 0.15777878, 0.00795696, 0.04919229])
but they both lead to the same $\vec{\alpha}$:
> np.linalg.inv(X.T @ np.diag(w.value) @ X) @ (X.T @ np.diag(w.value) @ y)
array([-0.33274219, 1.22240004, -0.29890388])
> beta_WLS
array([-0.33274219, 1.22240004, -0.29890388])