Skip to main content
Glama

Linewatch

随时间变化的互联网质量——面向智能体原生设计。 一个简化的 speedtest.net,但不止于一个数字:它持续测量、绘制趋势图、记录断线,并将证据以干净的 JSON 形式交给你(或你的 AI 智能体)。

构建于 2026 年 8 月 19 日。工作用名——命名可以留到以后的常规流程中处理。

为什么存在

单次速度测试可能看起来正常,而线路实际上每晚都在抖动或下垂。三种故障模式需要三种测量方式:

故障模式

检测方式

吞吐量下滑(付了 300 的费,只得到 60)

定时速度测试

反复抖动(开始-停止-开始的断线)

每 45 秒一次的廉价延迟探测

延迟/缓冲膨胀(速度正常,通话卡顿)

每次测量记录延迟 + 抖动

设计原则:重测试稀疏进行,轻测试密集进行。

我们没有自己的服务器:测量针对 Cloudflare 公开的、CORS 开放的测速端点(speed.cloudflare.com)运行,因此该引擎可在任何浏览器或 Node 进程中免费运行。

Related MCP server: connectivity-diagnostics

布局

packages/core   isomorphic measurement engine + stats + types (browser & Node)
packages/cli    `linewatch` CLI — every command speaks --json; JSONL store in ~/.linewatch/
packages/mcp    MCP server (stdio) — agents run tests & read history, zero login
apps/web        PWA — GO button + live gauge, Monitor mode, history charts, CSV export

快速开始

npm install
npm run build

# human: web app
npm run dev                      # → http://localhost:5173  (installable as a PWA)

# human or agent: CLI
node packages/cli/dist/index.js test            # one speed test
node packages/cli/dist/index.js monitor         # test every 15m + probe every 45s
node packages/cli/dist/index.js summary --since 7d --json

# agent: MCP (Claude Code)
claude mcp add -s user linewatch -- node $(pwd)/packages/mcp/dist/index.js

MCP 工具:run_speed_test、run_latency_probe、get_history、get_summary、get_store_info。

面向智能体的原生原则

  1. 机器无需交互式认证。 CLI 和 MCP 都写入同一个本地 JSONL 存储(~/.linewatch/results.jsonl)——仅追加、可 grep、可解析。

  2. JSON 是一等输出; 人类 UI 只是同一批数据的渲染。

  3. 为自主使用提供廉价原语: 怀疑网络问题的智能体先调用 run_latency_probe(<2 秒,约零数据),仅在需要时才升级到 run_speed_test(约 20 秒,约 100–500 MB)——工具描述中注明了这些成本,以便智能体自行决策。

数据说明

  • 一次速度测试以全线路速率传输数据约 18 秒:每次测试约 line_Mbps × 18 / 8 MB。在 100 Mbps 线路上以 15 分钟间隔运行监控模式 ≈ 每天 20+ GB——在无限光纤上没问题,但在有流量限制的套餐上请选择更慢的频率。

  • Web 结果存储在浏览器的 IndexedDB 中;CLI/MCP 结果存储在 ~/.linewatch/ 中。它们将在 B 阶段(云同步)合并。

关于后续方向(云同步、告警、托盘应用、移动端、产品化),请参阅 ROADMAP.md。

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    C
    maintenance
    The MCP Internet Speed Test is a specialized Model Context Protocol (MCP) server that enables AI models and agents to perform internet speed measurements.
    6
    20 PyPI
    15
    Python
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Enables AI agents to check the health of internet infrastructure and specific services, helping diagnose whether issues are local or external.
    3
    16 npm
    ISC