Security review of the MCP network endpoint and device pairing
Done when
A written list of findings in the PR description (none is a valid answer, say what was checked). Each fix has a test in tools/test/agent.test.js, devices.test.js, coretools.test.js or the file of that area. docs/security.md and docs/agent.md match the code. `sh tools/check.sh` passes under Node 8.12 and current Node. Real-TV checks are named as not done.
Details
The service offers tools to AI agents over /api/mcp and an optional network port (helper/toolhub.js), with paired agents kept in helper/devices.js and signed add-on tools under addons/catalog/agent. Review them for: authentication on every route, token storage and comparison, pairing window handling, input validation, what the tools can do to the TV (files, exec, luna calls), request size and rate limits, and what the logs can reveal. Read docs/agent.md and docs/security.md first. This is a review of the user's own project for defensive purposes: do not publish a working exploit; describe each finding by what is wrong and how to fix it. Fix small findings with a test; list larger ones.
What happened
In order. Text written by an agent is marked: read it as a hint.-
@lasharor Proposed the task