Skip to main content

MCP weibo project

Project description

微博热搜 MCP Server

这是一个基于 FastMCP 框架的微博热搜数据获取服务器,提供了获取微博热搜榜、热搜详情和评论等功能。

功能特性

  1. 获取微博热搜榜单

    • 展示热搜排名
    • 显示热搜词
    • 显示热搜指数
  2. 获取热搜详细信息

    • 话题分类
    • 话题描述
    • 话题链接
    • 话题主持人信息
    • 统计数据(阅读量、讨论量、互动量、原创量)
  3. 获取热搜评论

    • 支持通过 URL 获取评论
    • 可配置最大评论获取数量
    • 显示评论内容和点赞数

安装要求

  • Python 3.x
  • 依赖包:
    • requests
    • lxml
    • mcp

安装步骤

  1. 克隆仓库到本地
  2. 安装依赖:
pip install requests lxml fastmcp

使用方法

启动服务器

python server.py

服务器将以 stdio 模式运行,可以通过 FastMCP 客户端进行调用。

API 说明

服务器提供以下 MCP 工具:

1. get_hot_search

获取微博热搜榜单

# MCP 调用示例
result = await mcp.call("get_hot_search", {})

2. get_hot_search_detail

获取指定话题的详细信息

# MCP 调用示例
result = await mcp.call("get_hot_search_detail", {
    "word": "话题关键词"
})

3. get_hot_search_comment_by_url

获取指定话题的评论

# MCP 调用示例
result = await mcp.call("get_hot_search_comment_by_url", {
    "cookie": "你的微博cookie",
    "url": "话题链接",
    "max_comments": 40  # 可选,默认40条,最大200条
})

注意事项

  1. 获取评论功能需要提供有效的微博 cookie
  2. 评论获取数量上限为 200 条
  3. 部分热搜话题可能无法获取详细信息
  4. 建议合理控制接口调用频率,避免被限制
  5. 服务器使用 stdio 传输模式,需要通过 FastMCP 客户端调用

技术说明

  • 使用 FastMCP 框架构建服务器
  • 采用 requests 库进行 HTTP 请求
  • 使用 lxml 解析网页内容
  • 支持异步操作和异常处理
  • 使用 stdio 作为传输层

许可证

[根据实际情况填写许可证信息]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

weibo_mcp_server-0.1.0.tar.gz (129.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

weibo_mcp_server-0.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file weibo_mcp_server-0.1.0.tar.gz.

File metadata

  • Download URL: weibo_mcp_server-0.1.0.tar.gz
  • Upload date:
  • Size: 129.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for weibo_mcp_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1db487e0dfb733a4a744a4434f686a868419ab6a98d7a5b423d847a8a120e2a5
MD5 23d85d8b884c66017bdf0d376b048901
BLAKE2b-256 a7a862368a7998c7802b3be06f7bf81259f539d511707eb334b8db0676493dbf

See more details on using hashes here.

File details

Details for the file weibo_mcp_server-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for weibo_mcp_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 01bb7a5108e549522f338f44b788e64aab6e5fd067b8c8f2183b4705e9950a93
MD5 3eb5270889b19ddd9468daf066c08391
BLAKE2b-256 fe91fcdcacb12ff22002edddfd1c135a26db94ac8ac89d418e20ea2a9e603185

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page