npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@mcpcn/mcp-speed-tester

v1.0.12

Published

MCP service for network speed testing with built-in test servers

Downloads

158

Readme

MCP 网速测试服务

一个基于 MCP(Model Context Protocol)的网速测试服务,内置多个测试服务器,无需用户提供测试URL即可测试网络延迟、下载速度和上传速度。

功能特点

  • 🚀 延迟测试: 测试网络延迟(ping)
  • ⬇️ 下载速度测试: 测试网络下载速度
  • ⬆️ 上传速度测试: 测试网络上传速度
  • 🏢 多服务器支持: 内置 Cloudflare、Fast.com、GitHub CDN 等测试服务器
  • 📊 详细报告: 提供结构化的 JSON 测试结果
  • 🔧 灵活配置: 支持指定测试类型、持续时间和服务器

安装与配置

1. 安装依赖并构建

# 安装依赖
npm install

# 构建项目
npm run build

2. 配置 MCP 客户端

在您的 MCP 客户端配置文件中添加以下配置:

Claude Desktop (~/.cursor/mcp.json)

{
  "mcpServers": {
    "mcp-speed-tester": {
      "command": "node",
      "args": [
        "/path/to/mcp-speed-tester/dist/index.js"
      ],
      "autoApprove": [
        "test_network_speed"
      ]
    }
  }
}

VS Code 等其他客户端

{
  "mcpServers": {
    "mcp-speed-tester": {
      "command": "npx",
      "args": [
        "-y",
        "@mcpcn/mcp-speed-tester"
      ]
    }
  }
}

使用方法

工具:test_network_speed

参数说明

  • testType (可选): 测试类型
    • "ping": 仅测试延迟
    • "download": 仅测试下载速度
    • "upload": 仅测试上传速度
    • "full": 全面测试(默认)
  • durationMs (可选): 测试持续时间(毫秒),默认 10000ms
  • serverName (可选): 指定测试服务器名称

使用示例

1. 全面测试(默认)
{
  "name": "test_network_speed",
  "arguments": {}
}
2. 仅测试下载速度
{
  "name": "test_network_speed",
  "arguments": {
    "testType": "download",
    "durationMs": 5000
  }
}
3. 指定服务器测试
{
  "name": "test_network_speed",
  "arguments": {
    "testType": "full",
    "serverName": "Cloudflare"
  }
}
4. 仅测试延迟
{
  "name": "test_network_speed",
  "arguments": {
    "testType": "ping"
  }
}

内置测试服务器

  1. Cloudflare: 支持延迟、下载、上传测试
  2. Fast.com (Netflix): 支持延迟、下载测试
  3. GitHub CDN: 支持延迟、下载测试

返回结果示例

{
  "success": true,
  "message": "网络速度测试完成",
  "testType": "full",
  "duration": "10000ms",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "results": {
    "ping": {
      "Cloudflare": "23ms",
      "Fast.com (Netflix)": "45ms",
      "GitHub CDN": "31ms"
    },
    "download": {
      "Cloudflare": "85.42 Mbps",
      "Fast.com (Netflix)": "测试失败: 超时",
      "GitHub CDN": "92.15 Mbps"
    },
    "upload": {
      "Cloudflare": "42.18 Mbps",
      "Fast.com (Netflix)": "不支持上传测试",
      "GitHub CDN": "不支持上传测试"
    }
  }
}

技术细节

测试原理

  • 延迟测试: 通过 HTTP GET 请求测量往返时间
  • 下载速度: 下载指定大小的文件并计算传输速度
  • 上传速度: 上传数据块并计算传输速度

默认配置

  • 下载测试时间: 10秒
  • 上传测试时间: 10秒
  • 测试文件大小: 50MB(下载)
  • 数据块大小: 64KB(上传)

故障排除

常见问题

  1. 测试失败: 检查网络连接和防火墙设置
  2. 部分服务器失败: 正常现象,程序会自动尝试其他服务器
  3. 上传测试不支持: 某些服务器不支持上传测试

日志调试

服务器会在 stderr 输出运行日志,可以查看详细的错误信息。

开发

本地开发

# 开发模式运行
npm run dev

# 构建
npm run build

# 生产运行
npm run start

添加新测试服务器

src/index.ts 中的 TEST_SERVERS 数组添加新的服务器配置:

{
  name: "新服务器名称",
  downloadUrl: "https://example.com/test-file",
  uploadUrl: "https://example.com/upload", // 可选
  pingUrl: "https://example.com"
}

许可证

MIT License

贡献

欢迎提交 Issue 和 Pull Request!