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

convert-to-taro-mcp

v0.0.4

Published

用于将微信小程序代码转换为Taro框架的MCP服务

Readme

Convert-to-Taro MCP

一个基于 Model Context Protocol (MCP) 的服务,用于将微信小程序代码转换为 Taro 框架代码。

功能特性

这个 MCP 服务提供了 5 个工具来帮助完成小程序到 Taro 的转换工作流:

1. convertor-workflow

  • 描述:开始小程序转Taro的工作流
  • 功能:从 prompts/convertor-workflow.md 读取完整的工作流程指导

2. ast-convertor

  • 描述:对小程序代码进行预处理
  • 功能:执行 pnpx tarojs-cli-convertor 命令,将小程序代码用 Babel 转换后放入 taroConvert 文件夹
  • 参数
    • sourcePath (可选): 源代码路径,默认为当前目录
    • outputPath (可选): 输出路径,默认为 taroConvert

3. scan-files

  • 描述:扫描 taroConvert 文件夹下的文件结构
  • 功能:扫描 *.jsx*.js*.scss 文件(跳过 *.config.jsapp.*.* 文件),JS文件合并到JSX分类中,生成 scanned-files.json
  • 参数
    • sourcePath (可选): 项目根目录路径,默认为当前工作目录

4. jsx-syntax-convertor

  • 描述:JSX 文件的语法转换方案
  • 功能:解析 scanned-files.json 中的jsx文件列表,动态填入转换规则模板,返回完整的转换指导
  • 参数
    • sourcePath (可选): 项目根目录路径,默认为当前工作目录

5. scss-syntax-convertor

  • 描述:SCSS 文件的语法转换方案
  • 功能:解析 scanned-files.json 中的scss文件列表,动态填入转换规则模板,返回完整的转换指导
  • 参数
    • sourcePath (可选): 项目根目录路径,默认为当前工作目录

安装和使用

前置要求

  • Node.js >= 18
  • pnpm 包管理器

安装依赖

pnpm install

构建项目

pnpm run build

作为 MCP 服务运行

{
  "mcpServers": {
    "convert-to-taro": {
      "command": "npx",
      "args": ["convert-to-taro-mcp"]
    }
  }
}

用 AI IDE (Cursor/Trae)打开小程序项目,Agent 模式下,输入框输入:请用 convert-to-taro-mcp 将小程序转换成Taro项目。 优先选择 Claude,Qwen 等优秀模型,不要选择 Auto 模式。

或者通过 npx 运行

# 构建后运行
npx convert-to-taro-mcp

工作流程

  1. 开始工作流: 使用 convertor-workflow 获取完整的转换指导
  2. 预处理代码: 使用 ast-convertor 对小程序代码进行初步转换
  3. 扫描文件: 使用 scan-files 扫描转换后的文件结构并生成 scanned-files.json
  4. 语法转换: 分别使用 jsx-syntax-convertorscss-syntax-convertor 获取动态的转换规则(包含具体文件列表)
  5. 逐步转换: 根据转换规则逐一处理 scanned-files.json 中的文件
  6. 完成转换: 所有文件处理完成后输出转换报告

项目结构

convert-to-taro-mcp/
├── src/
│   ├── tools/           # 各个工具的实现
│   ├── types.ts         # 类型定义
│   └── index.ts         # MCP 服务器主文件
├── prompts/             # 工作流和转换规则文档
├── package.json
├── tsconfig.json
└── README.md

技术栈

  • 运行时: Node.js + TypeScript
  • 协议: Model Context Protocol (MCP)
  • 通信: stdio 协议
  • 包管理: pnpm