  We prove that a finitely generated pro-$p$ group $G$ acting on a pro-$p$ tree
$T$ splits as a free amalgamated pro-$p$ product or a pro-$p$ HNN-extension
over an edge stabilizer. If $G$ acts with finitely many vertex stabilizers up
to conjugation we show that it is the fundamental pro-$p$ group of a finite
graph of pro-$p$ groups $(\cal G, \Gamma)$ with edge and vertex groups being
stabilizers of certain vertices and edges of $T$ respectively. If edge
stabilizers are procyclic, we give a bound on $\Gamma$ in terms of the minimal
number of generators of $G$. We also give a criterion for a pro-$p$ group $G$
to be accessible in terms of the first cohomology $H^1(G, \mathbb{F}_p[[G]])$.
