If $M$ is allowed to be infinitely generated, then there are counterexamples even for finite dimensional local algebras.
Let $R=\mathbb{C}[x,y]/(x,y)^2$, a three-dimensional local $\mathbb{C}$-algebra.
Let $M=\mathbb{C}[t]\oplus\mathbb{C}[t]$ as a vector space, with $R$-module structure given by $\left(p(t),q(t)\right)x=\left(0,p(t)\right)$ and $\left(p(t),q(t)\right)y=\left(0,tp(t)\right)$.
Then an easy calculation shows that the $R$-module endomorphisms of $M$ are the maps of the form
$$\left(p(t),q(t)\right)\mapsto \left(f(t)p(t),f(t)q(t)+\varphi\left(p(t)\right)\right),$$
where $f(t)\in\mathbb{C}[t]$ and $\varphi:\mathbb{C}[t]\to\mathbb{C}[t]$ is an arbitrary linear map.
There are no non-trivial idempotent endomorphisms, so $M$ is indecomposable, but restricting $f(t)$ to any maximal ideal of $\mathbb{C}[t]$ gives a maximal right (and left) ideal of $\text{End}_R(M)$, so $\text{End}_R(M)$ is not local.
Of course, this example is not finitely generated. Swan showed that a finitely generated indecomposable module for a complete local ring has local endomorphism ring, but without completeness there are counterexamples (for local Noetherian rings) to Krull-Schmidt (which must also give examples without local endomorphism ring) in
Evans, E.Graham jun., Krull-Schmidt and cancellation over local rings, Pac. J. Math. 46, 115-121 (1973). ZBL0272.13006,
the first of which is also credited to Swan.