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 🙏

© 2026 – Pkg Stats / Ryan Hefner

cloudflare-mcp-smart-proxy

v1.1.1

Published

Smart proxy for Cloudflare MCP - routes tools to cloud or local execution

Readme

@cloudflare-mcp/smart-proxy

智能路由代理,自动将 MCP 工具请求路由到云端或本地执行。

功能特性

  • 智能路由: 自动判断工具应该路由到云端还是本地
  • 本地文件编辑: 支持读取、写入、差异编辑本地文件
  • 云端工具集成: 无缝使用 Cloudflare MCP 的云端工具
  • 统一接口: AI 看到的是合并后的工具列表
  • 零配置: 通过 npx 自动安装和使用

工具路由规则

本地工具(直接执行)

  • read_file - 读取本地文件
  • write_file - 写入本地文件
  • edit_file - 差异编辑本地文件
  • list_dir - 列出本地目录
  • delete_file - 删除本地文件
  • execute_command - 执行本地命令

云端工具(转发到 Cloudflare Workers)

  • web_search - 网络搜索
  • github_* - GitHub API 操作
  • memory_* - 记忆工具
  • library_docs - 库文档查询
  • codebase_search - R2 代码库搜索
  • 其他所有未匹配的工具

安装

方法 1: 使用安装脚本(推荐)

curl -fsSL https://raw.githubusercontent.com/your-repo/local-proxy/main/install.sh | bash

或下载后执行:

chmod +x install.sh
./install.sh

方法 2: 手动配置

  1. 在 Cursor 配置文件中添加:

~/.cursor/mcp.json (macOS/Linux)
%APPDATA%\Cursor\mcp.json (Windows)

{
  "mcpServers": {
    "cloudflare-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@cloudflare-mcp/smart-proxy"],
      "env": {
        "CLOUDFLARE_MCP_URL": "https://your-worker.workers.dev",
        "CLOUDFLARE_MCP_API_KEY": "your_api_key_here",
        "WORKSPACE_ROOT": "/path/to/your/workspace"
      }
    }
  }
}
  1. 重启 Cursor IDE

环境变量

| 变量名 | 必需 | 说明 | |--------|------|------| | CLOUDFLARE_MCP_URL | ✅ | Cloudflare MCP 服务器 URL | | CLOUDFLARE_MCP_API_KEY | ✅ | API Key | | WORKSPACE_ROOT | ❌ | 工作目录根路径(默认: 当前目录) |

使用示例

读取本地文件

{
  "tool": "read_file",
  "params": {
    "target_file": "src/index.js",
    "offset": 0,
    "limit": 50
  }
}

差异编辑文件

{
  "tool": "edit_file",
  "params": {
    "path": "src/index.js",
    "edits": [
      {
        "type": "replace",
        "startLine": 10,
        "endLine": 12,
        "oldText": "const x = 1;\nconst y = 2;",
        "newText": "const x = 1;\nconst y = 3;\nconst z = 4;"
      }
    ],
    "originalContent": "..."
  }
}

执行本地命令

{
  "tool": "execute_command",
  "params": {
    "command": "npm test",
    "cwd": "."
  }
}

安全特性

  • ✅ 路径验证:防止路径遍历攻击
  • ✅ 工作目录限制:只能访问指定目录内的文件
  • ✅ 命令黑名单:禁止执行危险命令
  • ✅ 超时保护:命令执行 30 秒超时

故障排除

问题 1: 无法连接到云端服务器

检查:

  1. 确认 CLOUDFLARE_MCP_URL 正确
  2. 确认 CLOUDFLARE_MCP_API_KEY 有效
  3. 检查网络连接

问题 2: 本地文件操作失败

检查:

  1. 确认文件路径在工作目录内
  2. 检查文件权限
  3. 确认路径不包含 ..

问题 3: Cursor 无法识别服务器

检查:

  1. 重启 Cursor IDE
  2. 检查配置文件 JSON 格式
  3. 查看 Cursor 开发者工具中的错误日志

开发

本地测试

cd local-proxy
npm install
export CLOUDFLARE_MCP_URL="https://your-worker.workers.dev"
export CLOUDFLARE_MCP_API_KEY="your_key"
export WORKSPACE_ROOT="/path/to/workspace"
node index.js

发布到 npm

npm login
npm publish --access public

许可证

MIT

相关链接