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

toutiao-mcp

v1.0.0

Published

今日头条 MCP 服务器 - Node.js/TypeScript 版本

Downloads

101

Readme

今日头条 MCP 服务器

基于 Node.js/TypeScript 的今日头条内容管理 MCP 服务器,支持自动登录、内容发布、多平台兼容。

✨ 特性

  • 🔐 用户认证 - 自动登录、Cookie 持久化
  • 📝 内容发布 - 图文文章、微头条发布
  • 多平台兼容 - 支持小红书数据格式
  • 🖼️ 图片处理 - 自动上传、压缩优化
  • 高性能 - Playwright + Fastify

📦 快速开始

安装

# 克隆项目
git clone <repository-url>
cd toutiao-mcp

# 安装依赖
npm install

# 安装浏览器
npx playwright install chromium

# 配置环境变量
cp .env.example .env

运行

# 开发模式
npm run dev

# 构建
npm run build

# 生产模式
npm start

运行示例

# 基础使用示例
npm run example:basic

# 多平台发布示例
npm run example:multi

# 批量发布示例
npm run example:batch

🎯 MCP 工具

认证

  • login_with_credentials - 登录今日头条
  • check_login_status - 检查登录状态
  • logout - 登出

发布

  • publish_article - 发布图文文章
  • publish_micro_post - 发布微头条
  • publish_xiaohongshu_data - 批量发布小红书数据

💡 使用示例

1. 登录

import { AuthService } from './src/auth/auth.service';

const authService = new AuthService();
await authService.login();

2. 发布文章

import { ArticlePublisher } from './src/publisher/article.publisher';

const publisher = new ArticlePublisher();
await publisher.publish({
  title: '文章标题',
  content: '文章内容',
  images: ['path/to/image.jpg'],
  tags: ['科技', '工具']
});

3. 多平台发布

import { MultiPlatformService } from './src/multi-platform/multi-platform.service';

const service = new MultiPlatformService();
await service.publishBatch([
  {
    '小红书标题': '标题',
    '仿写小红书文案': '内容',
    '配图': 'https://example.com/image.jpg'
  }
], './downloads');

🛠️ 技术栈

  • MCP SDK - @modelcontextprotocol/sdk
  • 浏览器自动化 - Playwright
  • Web 框架 - Fastify
  • 图像处理 - Sharp
  • 数据验证 - Zod
  • 日志 - Pino
  • 测试 - Vitest

� 部署

Docker

# 构建镜像
docker build -t toutiao-mcp .

# 运行容器
docker run -d \
  --name toutiao-mcp \
  -v $(pwd)/data:/app/data \
  toutiao-mcp

PM2

# 安装 PM2
npm install -g pm2

# 启动服务
pm2 start dist/index.js --name toutiao-mcp

# 查看状态
pm2 status

📝 开发

# 运行测试
npm test

# 代码检查
npm run lint

# 代码格式化
npm run format

# 类型检查
npm run type-check

� 项目结构

toutiao-mcp/
├── src/
│   ├── auth/              # 认证模块
│   ├── publisher/         # 发布模块
│   ├── multi-platform/    # 多平台兼容
│   ├── analytics/         # 数据分析
│   ├── utils/             # 工具函数
│   └── types/             # 类型定义
├── tests/                 # 测试文件
├── examples/              # 使用示例
└── dist/                  # 构建输出

⚙️ 配置

环境变量配置(.env):

# 服务器配置
NODE_ENV=development
PORT=8003
LOG_LEVEL=info

# Playwright 配置
PLAYWRIGHT_HEADLESS=false
PLAYWRIGHT_TIMEOUT=30000

# 存储配置
DATA_DIR=./data
COOKIES_FILE=./data/cookies.json
DOWNLOAD_DIR=./downloads

⚠️ 注意事项

  1. 首次使用需要登录 - 运行后调用 login_with_credentials 工具
  2. 图片格式 - 支持 JPG、PNG、GIF、WebP
  3. 发布频率 - 建议控制发布频率,避免被平台限制
  4. 内容限制 - 文章标题 2-30 字,微头条建议 2000 字以内

🐛 故障排查

登录失败

  • 检查 Cookie 文件是否存在
  • 尝试重新登录
  • 检查网络连接

发布失败

  • 确认已登录
  • 检查内容格式
  • 查看详细错误日志

依赖问题

# 清理并重新安装
rm -rf node_modules package-lock.json
npm install

�📄 许可证

MIT

🤝 贡献

欢迎提交 Issue 和 Pull Request!


版本: 1.0.0
Node.js: >= 18.0.0