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

baidutiebamcp

v1.0.0

Published

百度贴吧MCP服务器,提供贴吧推荐帖子列表等功能

Readme

百度贴吧 MCP 服务器

这是一个基于 Model Context Protocol (MCP) 的百度贴吧服务器,提供贴吧推荐帖子列表、获取帖子详情、获取帖子评论等功能。

功能特性

工具 (Tools)

  • get_recommend_posts - 获取推荐帖子列表
  • get_post_detail - 获取帖子详情
  • get_post_comments - 获取帖子的评论列表

资源 (Resources)

  • tieba://recommend/posts - 推荐帖子列表
  • tieba://{forum}/posts - 指定贴吧的帖子列表
  • tieba://post/{post_id} - 帖子详情

安装和使用

方式一:NPX 安装(推荐)

直接使用 npx 运行,无需本地安装:

# 直接运行
npx baidutiebamcp

MCP 配置文件中使用:

{
  "mcpServers": {
    "baidu-tieba": {
      "command": "npx",
      "args": ["baidutiebamcp"],
      "disabled": false,
      "alwaysAllow": [],
      "env": {
        "TIEBA_COOKIE": "你的百度贴吧Cookie,格式如:BDUSS=xxx; STOKEN=xxx; PSTM=xxx"
      }
    }
  }
}

方式二:全局安装

# 全局安装
npm install -g baidutiebamcp

# 运行
baidutiebamcp

MCP 配置文件中使用:

{
  "mcpServers": {
    "baidu-tieba": {
      "command": "baidutiebamcp",
      "disabled": false,
      "alwaysAllow": [],
      "env": {
        "TIEBA_COOKIE": "你的百度贴吧Cookie,格式如:BDUSS=xxx; STOKEN=xxx; PSTM=xxx"
      }
    }
  }
}

方式三:本地开发

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

# 安装依赖
npm install

# 构建项目
npm run build

# 运行服务器
npm start

MCP 配置文件中使用:

{
  "mcpServers": {
    "baidu-tieba": {
      "command": "node",
      "args": ["path/to/baidutiebaMcp/build/index.js"],
      "disabled": false,
      "alwaysAllow": [],
      "env": {
        "TIEBA_COOKIE": "你的百度贴吧Cookie,格式如:BDUSS=xxx; STOKEN=xxx; PSTM=xxx"
      }
    }
  }
}

Cookie 配置

为了获取更多内容和避免反爬限制,建议在 MCP 配置中设置百度贴吧的 Cookie。

获取 Cookie 的方法

  1. 打开浏览器,访问 百度贴吧
  2. 登录你的百度账号
  3. 按 F12 打开开发者工具
  4. 切换到 "Network" 标签页
  5. 刷新页面,找到任意一个请求
  6. 在请求头中找到 Cookie 字段,复制其值

Cookie 格式示例

BDUSS=xxxxxxxxxx; STOKEN=xxxxxxxxxx; PSTM=xxxxxxxxxx; ...

重要提示

  • Cookie 包含敏感信息,请妥善保管
  • 不要在公共场所或代码仓库中暴露 Cookie
  • Cookie 有有效期,过期后需要重新获取
  • 建议定期更新 Cookie 以确保服务正常运行

API 接口说明

获取推荐帖子

// 工具调用
{
  "name": "get_recommend_posts",
  "arguments": {
    "forum": "生活",      // 可选:指定贴吧
    "page": 1,           // 可选:页码,默认1
    "page_size": 20,     // 可选:每页数量,默认20
    "offset": 0,         // 可选:偏移量,默认0
    "last_tid": "9912293948"  // 可选:上一页最后一个帖子ID,用于分页
  }
}

获取帖子详情

// 工具调用
{
  "name": "get_post_detail",
  "arguments": {
    "post_id": "1001"     // 必需:帖子ID
  }
}

获取帖子评论

// 工具调用
{
  "name": "get_post_comments",
  "arguments": {
    "thread_id": "9912985050",  // 必需:帖子ID
    "forum_id": "22714897",     // 必需:贴吧ID
    "page": 1,                  // 可选:页码,默认为1
    "see_lz": 0                 // 可选:是否只看楼主(0=否,1=是,默认为0)
  }
}

项目结构

baidutiebaMcp/
├── src/
│   └── index.ts          # 主服务器代码
├── build/                # 编译输出目录
├── package.json          # 项目配置
├── tsconfig.json         # TypeScript配置
└── README.md            # 说明文档