7. Find the largest positive integer $n$, such that there exist $n$ distinct positive integers $x_{1}, x_{2}, \cdots, x_{n}$, satisfying
$$
x_{1}^{2}+x_{2}^{2}+\cdots+x_{n}^{2}=2017 .
$$
7. Since the sum of the squares of the smallest 18 distinct positive integers is
$$
\sum_{i=1}^{18} i^{2}=2109>2017,
$$

then the sum of the squares of any 18 distinct positive integers is greater than 2017. 
Thus, $n \leqslant 17$.
Assume 17 distinct positive integers $x_{1}, x_{2}, \cdots, x_{17}$, satisfy
$$
\sum_{i=1}^{17} x_{i}^{2}=2017 \text {. }
$$

Since 2017 is a prime of the form $3N+1$, and if $x_{j}$ is not a multiple of 3, then $x_{j}^{2} \equiv 1(\bmod 3)$. Therefore, the number of integers in $x_{1}, x_{2}, \cdots, x_{17}$ that are not divisible by 3 should be $3a+1$, and the remaining $3b+1$ should be multiples of 3, where
$$
\begin{array}{l}
(3 a+1)+(3 b+1)=17(a, b \in \mathbf{N}) \\
\Rightarrow a+b=5 .
\end{array}
$$

Note that, $\sum_{i=1}^{17} i^{2}=1785$, and $2017-1785=$ 232. In the set $M=\{1,2, \cdots, 17\}$, there are 5 multiples of 3, and the remaining 12 numbers are coprime with 3. Therefore, if equation (1) has a solution, it is necessary to remove $k$ numbers from set $M$ and replace them with $k$ numbers greater than 17, such that the sum of their squares increases by 232.

When $k=1$, when removing one multiple of 3 from set $M$ (so that the number of multiples of 3 left in set $M$ is $3b+1$, $b=1$), this requires satisfying
$$
(3 x)^{2}+232=y^{2}(x \in\{1,2,3,4,5\}, y>17) \text {, }
$$

which is impossible.
When $k=2$, there are three scenarios.
(1) Remove two non-multiples of 3 from set $M$, and add two multiples of 3 greater than 17. First, consider removing the two largest non-multiples of 3 from $M$ and adding the two smallest multiples of 3 greater than 17, since
$$
\left(18^{2}+21^{2}\right)-\left(16^{2}+17^{2}\right)=220 \neq 232,
$$

and when at least one of the numbers removed from $M$ is replaced by a smaller number, or at least one of the numbers added from outside $M$ is replaced by a larger number, the above difference will be greater than 232, so this scenario has no solution.
(2) Remove one multiple of 3 and one non-multiple of 3 from set $M$, and add two non-multiples of 3 from outside $M$. Similarly, consider the largest numbers with the above properties in $M$ and the smallest numbers from outside $M$, since
$$
\left(19^{2}+20^{2}\right)-\left(15^{2}+17^{2}\right)=247>232,
$$

this scenario has no solution.
(3) Remove two multiples of 3 from set $M$, and add one multiple of 3 and one non-multiple of 3 from outside $M$. Similarly, consider the largest numbers with the above properties in $M$ and the smallest numbers from outside $M$, since
$$
\left(18^{2}+19^{2}\right)-\left(12^{2}+15^{2}\right)=316>232 \text {, }
$$
this scenario also has no solution.

When $k \geqslant 3$, let the $k$ numbers removed from set $M$ be $a_{1}$, $a_{2}, \cdots, a_{k}$, and the $k$ numbers added from outside $M$ be $b_{1}, b_{2}, \cdots, b_{k}$. Clearly, we have
$$
\begin{array}{l}
\sum_{i=1}^{k}\left(b_{i}^{2}-a_{i}^{2}\right) \\
\geqslant\left(18^{2}+19^{2}+20^{2}\right)-\left(15^{2}+16^{2}+17^{2}\right) \\
=315>232,
\end{array}
$$

which has no solution.
The above indicates that $n \leqslant 16$.
When $n=16$, consider $\sum_{i=1}^{16} i^{2}=1496$.
Since $2017-1496=521$, and
$$
\left(17^{2}+18^{2}+23^{2}\right)-\left(13^{2}+14^{2}+16^{2}\right)=521 \text {, }
$$

thus, replacing $13, 14, 16$ with $17, 18, 23$ can make
$$
1,2, \cdots, 12,15,17,18,23
$$

these 16 distinct positive integers have a sum of squares equal to 2017. Therefore, the largest positive integer $n$ is 16.