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

@tnnevol/auto-save-mcp

v1.3.1-beta.1

Published

MCP server for auto-save API integration

Downloads

57

Readme

Auto-Save MCP 服务器

MCP 标准的网盘自动转存服务 API 服务器 | v1.3.1-beta.0

一个符合 MCP (Model Context Protocol) 标准的服务器,用于集成 auto-save 服务,自动化处理网盘分享链接的转存任务。

✨ 功能特性

  • MCP 标准兼容 - 完全符合 Model Context Protocol 规范
  • 安全凭据管理 - 通过环境变量管理凭据,避免硬编码
  • 10 个 MCP 工具 - 支持任务管理、配置、搜索等完整功能
  • 10 个 HTTP 端点 - 健康检查、版本信息、性能指标、缓存管理等
  • 专业日志系统 - 集成 pino 日志库,支持结构化、分级别的日志记录
  • 完善错误处理 - 友好的错误提示和故障排查指南

🚀 快速开始

1. 安装

# 使用 pnpm 安装依赖
pnpm install @tnnevol/auto-save-mcp

# 或使用 pnpm 直接运行
pnpm dlx @tnnevol/auto-save-mcp

2. 环境配置

# 复制环境变量模板
cp .env.example .env.local

# 编辑 .env.local
AUTO_SAVE_BASE_URL=http://your-auto-save-service:5005
AUTO_SAVE_TOKEN=your-actual-token-here
MCP_PORT=8868

⚠️ 注意: AUTO_SAVE_BASE_URLAUTO_SAVE_TOKEN 是必填的

3. 启动服务器

# 启动服务器(通过 dotenv-cli 加载环境变量)
pnpm start

# 或使用开发模式(自动热重载 + 环境变量)
pnpm dev

服务器将启动在 http://localhost:8868

4. 集成到 OpenClaw

{
  "mcpServers": {
    "auto-save": {
      "command": "node",
      "args": ["/path/to/auto-save-mcp/dist/server.js"],
      "env": {
        "AUTO_SAVE_BASE_URL": "http://localhost:5005",
        "AUTO_SAVE_TOKEN": "your-token"
      }
    }
  }
}

🛠️ 核心工具

| 工具 | 功能 | 必填参数 | | ------------------------------ | ------------- | ---------------------------- | | auto-save-add-task | 添加转存任务 | taskname, shareurl, savepath | | auto-save-get-config | 获取配置 | - | | auto-save-update-config | 更新配置 | config | | auto-save-run-tasks | 运行任务 | - | | auto-save-get-tasks-list | 获取任务列表 | - | | auto-save-delete-task | 删除任务 | taskId | | auto-save-update-task | 更新任务 | taskId, taskConfig | | auto-save-toggle-task-status | 启用/禁用任务 | taskId, enable | | auto-save-get-task-history | 获取历史 | taskId | | auto-save-search-tasks | 搜索建议 | query |

注意: baseUrl/token 从环境变量读取,无需每次传递

详细工具说明: docs/usage.md

📡 HTTP 端点

| 端点 | 方法 | 说明 | | -------------------- | ---- | ----------------------- | | /mcp | POST | MCP 协议端点 | | /mcp | GET | 返回 405(仅支持 POST) | | /health | GET | 健康检查 | | /ready | GET | 就绪检查 | | /metrics | GET | 性能指标 | | /version | GET | 版本信息 | | /task_suggestions | GET | 搜索建议 | | /cache/stats | GET | 缓存状态(v1.2.0 新增) | | /cache/clear | POST | 清除缓存(v1.2.0 新增) | | /performance-stats | GET | 性能监控详情 |

详细 API 文档: docs/API.md

🔒 安全说明

凭据管理

  • 环境变量 - 凭据从 AUTO_SAVE_BASE_URLAUTO_SAVE_TOKEN 加载
  • 运行时注入 - 凭据作为参数传递,不硬编码
  • 零存储 - 源代码中不存储任何凭据
  • 日志脱敏 - Token 在日志中仅显示前后缀(如 npm_...P0tL6

📝 日志系统

日志级别

| 级别 | 使用场景 | 示例 | | ------- | ---------------- | ---------------------------- | | error | 错误、异常 | 数据库连接失败、API 请求失败 | | warn | 警告、可恢复错误 | 重试、降级 | | info | 重要信息 | 服务启动、配置加载 | | debug | 调试信息 | 请求参数、中间件处理 |

日志配置

通过环境变量配置日志系统:

# 日志级别:error, warn, info, debug
LOG_LEVEL=info

# 日志输出:控制台或文件
NODE_ENV=development    # 开发环境输出到控制台(带颜色)
NODE_ENV=production     # 生产环境输出到文件

# 日志目录(默认为 logs)
LOG_DIR=logs

# 是否记录请求体(生产环境应关闭)
LOG_REQUEST_BODY=false

结构化日志

日志采用 JSON 格式,便于解析和分析:

{"level":30,"time":1774865160000,"msg":"Server starting","port":8868,"env":"production"}
{"level":30,"time":1774865161123,"msg":"POST /api/tasks - 200 - 45ms","requestId":"req_abc123"}
{"level":50,"time":1774865162456,"msg":"Database connection failed","error":"ETIMEDOUT"}

请求日志中间件

自动记录每个请求的方法、路径、时间、响应状态码和耗时:

[INFO] 2026-03-30 11:26:00 - POST /api/tasks - 200 - 45ms - req_abc123
[ERROR] 2026-03-30 11:26:01 - GET /api/tasks/1 - 500 - 12ms - req_def456 - Error: Not found

提交前检查

# 检查是否有敏感信息
git diff --cached | grep -E "192\.168\.|token.*=.*[a-zA-Z0-9]{16,}"
git status

意外提交敏感信息

  1. 立即通知项目维护者
  2. 使用 git filter-branch 或 BFG 从历史中清除
  3. 轮换/更新已泄露的凭据

🧪 测试

# 运行所有测试(210 个测试用例)
pnpm test

# 监听模式(自动重载)
pnpm test:watch

# 生成覆盖率报告
pnpm test:coverage

Vitest 使用方式

项目使用 Vitest 作为测试框架:

  • 单元测试tests/unit/ 目录下的 *.test.ts 文件
  • 集成测试tests/integration/ 目录下的 *.test.ts 文件
  • 配置文件vitest.config.ts 定义测试选项

测试通过! ✅ 210/210 测试用例全部通过

📖 文档索引

| 文档 | 说明 | | ------------------------------------ | ------------------------------------------ | | docs/usage.md | 详细使用指南、工具参数、故障排查 | | docs/API.md | API 端点说明、请求/响应格式 | | docs/RELEASE.md | 发布指南、自动化流程 | | docs/process.md | 开发流程、TODO.md 和 CHANGELOG.md 更新规范 | | CHANGELOG.md | 版本变更历史 | | TODO.md | 待办事项 |

📖 文档

📦 版本历史

| 版本 | 日期 | 核心更新 | | ----- | ---------- | -------------------------------- | | 1.3.1 | 2026-04-01 | 环境变量注入优化、测试架构重构 | | 1.2.0 | 2026-03-29 | 搜索功能、环境变量优化、npm 发布 | | 1.1.0 | 2026-03-29 | 参数获取方式优化(环境变量) | | 1.0.1 | 2026-03-28 | 文档修复、敏感信息处理 | | 1.0.0 | 2026-03-27 | 初始版本发布 |

完整变更历史: CHANGELOG.md

🛠️ 开发

# 克隆仓库
git clone [email protected]:tnnevol/auto-save-mcp.git
cd auto-save-mcp

# 使用 pnpm 安装依赖
pnpm install

# 设置环境变量
cp .env.example .env.local

# 开发模式
pnpm dev

# 构建
pnpm build

🤝 贡献

  1. Fork 项目
  2. 创建特性分支 (git checkout -b feature/AmazingFeature)
  3. 提交更改 (git commit -m 'Add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 开启 Pull Request

📄 许可证

MIT License


npm 包: @tnnevol/auto-save-mcp | GitHub: tnnevol/auto-save-mcp