Skip to main content

A MCP Server for Weibo

Project description

Weibo MCP Server

这是一个基于 Model Context Protocol 的服务器,用于抓取微博用户信息、动态和搜索功能。该服务器可以帮助获取微博用户的详细信息、动态内容以及进行用户搜索、获取热搜、搜索内容等。

Weibo Server MCP server

MseeP.ai Security Assessment Badge

安装

  • 从源代码安装:
{
  "mcpServers": {
    "weibo": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/qinyuanpei/mcp-server-weibo.git",
        "mcp-server-weibo"
      ]
    }
  }
}
  • 从包管理器安装:
{
  "mcpServers": {
    "weibo": {
      "command": "uvx",
      "args": ["mcp-server-weibo"],
    }
  }
}
  • 从 Docker 安装,请使用以下命令:
docker build -t mcp-server-weibo .
docker run -d --name mcp-server-weibo -p 4200:4200 mcp-server-weibo

参考配置:

{
  "mcpServers": {
    "weibo": {
      "url": "http://localhost:4200/mcp",
    }
  }
}

组件

工具

search_users(keyword, limit)

描述:搜索微博用户

返回值示例如下:

[
  {
    "id": 1749127163,
    "screen_name": "雷军",
    "profile_image_url": "https://tvax1.sinaimg.cn/crop.0.0.1080.1080.180/001Un9Srly8i1p6mooym8j60u00u10tu02.jpg?KID=imgbed,tva&Expires=1749109677&ssig=QzOuVFBlRp",
    "profile_url": "https://m.weibo.cn/u/1749127163?",
    "description": "小米董事长,金山软件董事长。业余爱好是天使投资。",
    "follow_count": 1562,
    "followers_count": "2671.2万",
    "avatar_hd": "https://wx1.sinaimg.cn/orj480/001Un9Srly8i1p6mooym8j60u00u10tu02.jpg",
    "verified": true,
    "verified_reason": "小米创办人,董事长兼CEO;金山软件董事长;天使投资人。",
    "gender": "m"
  }
]

get_profile(uid)

描述:获取用户详细信息

返回值示例如下:

{
  "id": 1749127163,
  "screen_name": "雷军",
  "profile_image_url": "https://tvax1.sinaimg.cn/crop.0.0.1080.1080.180/001Un9Srly8i1p6mooym8j60u00u10tu02.jpg?KID=imgbed,tva&Expires=1749109733&ssig=5OrMoqbwcY",
  "profile_url": "https://m.weibo.cn/u/1749127163?",
  "description": "小米董事长,金山软件董事长。业余爱好是天使投资。",
  "follow_count": 1562,
  "followers_count": "2671.2万",
  "avatar_hd": "https://wx1.sinaimg.cn/orj480/001Un9Srly8i1p6mooym8j60u00u10tu02.jpg",
  "verified": true,
  "verified_reason": "小米创办人,董事长兼CEO;金山软件董事长;天使投资人。",
  "gender": "m"
}

get_feeds(uid, limit)

描述: 获取用户动态

返回值示例如下:

[
  {
    "id": 5167970394572058,
    "text": "今年是小米创业15周年。<br />早在11年前,2014年,我们就开始芯片研发之旅。<br /><br />2014年9月,澎湃项目立项。2017年,小米首款手机芯片“澎湃S1”正式亮相,定位中高端。后来,因为种种原因,遭遇挫折,我们暂停了SoC大芯片的研发。但我们还是保留了芯片研发的火种,转向了“小芯片”路线。再后来,小米澎湃各 ...<a href=\"/status/5167970394572058\">全文</a>",
    "source": "Xiaomi 15S Pro",
    "created_at": "Mon May 19 11:00:21 +0800 2025",
    "user": {
      "id": 1749127163,
      "screen_name": "雷军",
      "profile_image_url": "https://tvax1.sinaimg.cn/crop.0.0.1080.1080.180/001Un9Srly8i1p6mooym8j60u00u10tu02.jpg?KID=imgbed,tva&Expires=1749109794&ssig=29j5mGcswB",
      "profile_url": "https://m.weibo.cn/u/1749127163?",
      "description": "小米董事长,金山软件董事长。业余爱好是天使投资。",
      "follow_count": 1562,
      "followers_count": "2671.2万",
      "avatar_hd": "https://wx1.sinaimg.cn/orj480/001Un9Srly8i1p6mooym8j60u00u10tu02.jpg",
      "verified": true,
      "verified_reason": "小米创办人,董事长兼CEO;金山软件董事长;天使投资人。",
      "gender": "m"
    },
    "comments_count": 10183,
    "attitudes_count": 141025,
    "reposts_count": 5884,
    "raw_text": "",
    "region_name": "发布于 北京",
    "pics": [
      {
        "thumbnail": "https://wx2.sinaimg.cn/orj360/001Un9Srly1i1k4dr5djgj60u04gp7wh02.jpg",
        "large": "https://wx2.sinaimg.cn/large/001Un9Srly1i1k4dr5djgj60u04gp7wh02.jpg"
      }
    ],
    "videos": {}
  }
]

get_trendings(limit)

描述:获取微博热搜

返回值示例如下:

[
  {
    "id": 0,
    "trending": 0,
    "description": "跟着总书记探寻中华文明",
    "url": "https://m.weibo.cn/search?containerid=100103type%3D1%26t%3D10%26q%3D%23%E8%B7%9F%E7%9D%80%E6%80%BB%E4%B9%A6%E8%AE%B0%E6%8E%A2%E5%AF%BB%E4%B8%AD%E5%8D%8E%E6%96%87%E6%98%8E%23&stream_entry_id=51&isnewpage=1&extparam=seat%3D1%26stream_entry_id%3D51%26c_type%3D51%26filter_type%3Drealtimehot%26pos%3D0%26cate%3D10103%26dgr%3D0%26q%3D%2523%25E8%25B7%259F%25E7%259D%2580%25E6%2580%25BB%25E4%25B9%25A6%25E8%25AE%25B0%25E6%258E%25A2%25E5%25AF%25BB%25E4%25B8%25AD%25E5%258D%258E%25E6%2596%2587%25E6%2598%258E%2523%26display_time%3D1749098276%26pre_seqid%3D17490982767230055147"
  },
  {
    "id": 3,
    "trending": 591855,
    "description": "建议大家要远离恋爱式友情",
    "url": "https://m.weibo.cn/search?containerid=100103type%3D1%26t%3D10%26q%3D%E5%BB%BA%E8%AE%AE%E5%A4%A7%E5%AE%B6%E8%A6%81%E8%BF%9C%E7%A6%BB%E6%81%8B%E7%88%B1%E5%BC%8F%E5%8F%8B%E6%83%85&stream_entry_id=31&isnewpage=1&extparam=seat%3D1%26dgr%3D0%26c_type%3D31%26cate%3D5001%26realpos%3D12%26stream_entry_id%3D31%26lcate%3D5001%26q%3D%25E5%25BB%25BA%25E8%25AE%25AE%25E5%25A4%25A7%25E5%25AE%25B6%25E8%25A6%2581%25E8%25BF%259C%25E7%25A6%25BB%25E6%2581%258B%25E7%2588%25B1%25E5%25BC%258F%25E5%258F%258B%25E6%2583%2585%26pos%3D11%26band_rank%3D12%26flag%3D1%26filter_type%3Drealtimehot%26display_time%3D1749098276%26pre_seqid%3D17490982767230055147"
  },
  {
    "id": 13,
    "trending": 584808,
    "description": "李昀锐的清爽感是夏日刚需",
    "url": "https://m.weibo.cn/search?containerid=100103type%3D1%26t%3D10%26q%3D%23%E6%9D%8E%E6%98%80%E9%94%90%E7%9A%84%E6%B8%85%E7%88%BD%E6%84%9F%E6%98%AF%E5%A4%8F%E6%97%A5%E5%88%9A%E9%9C%80%23&stream_entry_id=31&isnewpage=1&extparam=seat%3D1%26dgr%3D0%26c_type%3D31%26cate%3D5001%26realpos%3D13%26stream_entry_id%3D31%26lcate%3D5001%26q%3D%2523%25E6%259D%258E%25E6%2598%2580%25E9%2594%2590%25E7%259A%2584%25E6%25B8%2585%25E7%2588%25BD%25E6%2584%259F%25E6%2598%25AF%25E5%25A4%258F%25E6%2597%25A5%25E5%2588%259A%25E9%259C%2580%2523%26pos%3D12%26band_rank%3D13%26flag%3D1%26filter_type%3Drealtimehot%26display_time%3D1749098276%26pre_seqid%3D17490982767230055147"
  },
  {
    "id": 14,
    "trending": 573889,
    "description": "陈思诚张小斐首度合作",
    "url": "https://m.weibo.cn/search?containerid=100103type%3D1%26t%3D10%26q%3D%E9%99%88%E6%80%9D%E8%AF%9A%E5%BC%A0%E5%B0%8F%E6%96%90%E9%A6%96%E5%BA%A6%E5%90%88%E4%BD%9C&stream_entry_id=31&isnewpage=1&extparam=seat%3D1%26dgr%3D0%26c_type%3D31%26cate%3D5001%26realpos%3D14%26stream_entry_id%3D31%26lcate%3D5001%26q%3D%25E9%2599%2588%25E6%2580%259D%25E8%25AF%259A%25E5%25BC%25A0%25E5%25B0%258F%25E6%2596%2590%25E9%25A6%2596%25E5%25BA%25A6%25E5%2590%2588%25E4%25BD%259C%26pos%3D13%26band_rank%3D14%26flag%3D1%26filter_type%3Drealtimehot%26display_time%3D1749098276%26pre_seqid%3D17490982767230055147"
  }
]

search_content(keyword, limit, page)

描述:搜索微博内容

返回值示例如下:

[
  {
    "id": 5174033353539603,
    "text": "<a  href=\"https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%23%E5%9C%B0%E9%9C%87%E9%A2%84%E8%AD%A6%23&isnewpage=1\" data-hide=\"\"><span class=\"surl-text\">#地震预警#</span></a> 据中国地震预警网,04:31云南大理鹤庆(E100.1,N26.3)附近发生4.7级左右地震,预警网在地震波到达前73秒向昆明发出预警提示,预估烈度0.7度。可下载ICL“地震预警”APP接收预警并获取更多服务,国产手机也可开启操作系统内置地震预警功能 ",
    "source": "地震预警",
    "created_at": "Thu Jun 05 04:32:22 +0800 2025",
    "user": {
      "id": 2867810960,
      "screen_name": "成都高新减灾研究所",
      "profile_image_url": "https://tvax3.sinaimg.cn/crop.0.0.996.996.180/aaef5290ly8gdig1jpisaj20ro0romxi.jpg?KID=imgbed,tva&Expires=1749110036&ssig=JEEuM0wUxA",
      "profile_url": "https://m.weibo.cn/u/2867810960?",
      "description": "成都高新减灾研究所成立于汶川地震后,专注于灾害预警技术研发、成果转化及应用。",
      "follow_count": 307,
      "followers_count": "34.5万",
      "avatar_hd": "https://wx3.sinaimg.cn/orj480/aaef5290ly8gdig1jpisaj20ro0romxi.jpg",
      "verified": true,
      "verified_reason": "成都高新减灾研究所",
      "gender": "m"
    },
    "comments_count": 33,
    "attitudes_count": 53,
    "reposts_count": 1,
    "raw_text": "",
    "region_name": "北京",
    "pics": [],
    "videos": {}
  },
  {
    "id": 5173507416919189,
    "text": "<a  href=\"https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%23%E5%90%89%E5%88%A9%E9%93%B6%E6%B2%B3%23&extparam=%23%E5%90%89%E5%88%A9%E9%93%B6%E6%B2%B3%23\" data-hide=\"\"><span class=\"surl-text\">#吉利银河#</span></a><br />省流:<br />1.推荐度系列分为四个等级,一般/可买/推荐/非常推荐。「一般/可买」车型减少展开,想看的人比较多的话,我们会给大家再出详细的视频<br />2.本期非常推荐的有吉利星愿、星耀8 ,推荐有熊猫mini、星舰7、银河E5<br />3.大家还有什么想看的品牌的年中横评也可以在评论下留言  ...<a href=\"/status/5173507416919189\">全文</a>",
    "source": "微博视频号",
    "created_at": "Tue Jun 03 17:42:30 +0800 2025",
    "user": {
      "id": 2098256142,
      "screen_name": "农民新八",
      "profile_image_url": "https://tvax2.sinaimg.cn/crop.0.0.1080.1080.180/7d10d90ely8hcufl69gx9j20u00u0mxu.jpg?KID=imgbed,tva&Expires=1749110036&ssig=cgiHgZmsMD",
      "profile_url": "https://m.weibo.cn/u/2098256142?",
      "description": "新八,26岁。喜机械,喜机车,喜汽车,喜摄影。",
      "follow_count": 429,
      "followers_count": "19.9万",
      "avatar_hd": "https://wx2.sinaimg.cn/orj480/7d10d90ely8hcufl69gx9j20u00u0mxu.jpg",
      "verified": true,
      "verified_reason": "微博原创视频博主",
      "gender": "m"
    },
    "comments_count": 14,
    "attitudes_count": 33,
    "reposts_count": 2,
    "raw_text": "",
    "region_name": "浙江",
    "pics": [],
    "videos": {
      "stream_url": "https://f.video.weibocdn.com/o0/Znlc5yrLlx08oKQqLjm8010412027DBU0E010.mp4?label=mp4_ld&template=640x360.25.0&ori=0&ps=1BVp4ysnknHVZu&Expires=1749102785&ssig=usxCRRQp1I&KID=unistore,video",
      "stream_url_hd": "https://f.video.weibocdn.com/o0/WTxFgJ3rlx08oKQqpRpC01041203hVWU0E020.mp4?label=mp4_hd&template=852x480.25.0&ori=0&ps=1BVp4ysnknHVZu&Expires=1749102785&ssig=qTWtMQ8ugG&KID=unistore,video"
    }
  },
  {
    "id": 5173089152273188,
    "text": "第十个🥰 ",
    "source": "iPhone 16 Pro",
    "created_at": "Mon Jun 02 14:00:28 +0800 2025",
    "user": {
      "id": 5205701205,
      "screen_name": "·MooNquake·",
      "profile_image_url": "https://tvax3.sinaimg.cn/crop.0.0.512.512.180/005GiAGFly8i0qxuw3pw6j30e80e8dg1.jpg?KID=imgbed,tva&Expires=1749110036&ssig=72lXbXDOmv",
      "profile_url": "https://m.weibo.cn/u/5205701205?",
      "description": "请享受无法回避的痛苦",
      "follow_count": 493,
      "followers_count": "1245",
      "avatar_hd": "https://wx3.sinaimg.cn/orj480/005GiAGFly8i0qxuw3pw6j30e80e8dg1.jpg",
      "verified": false,
      "verified_reason": "",
      "gender": "m"
    },
    "comments_count": 15,
    "attitudes_count": 21,
    "reposts_count": 0,
    "raw_text": "",
    "region_name": "浙江",
    "pics": [
      {
        "thumbnail": "https://wx3.sinaimg.cn/orj360/005GiAGFgy1i20y541pyij320u0xiqv5.jpg",
        "large": "https://wx3.sinaimg.cn/large/005GiAGFgy1i20y541pyij320u0xiqv5.jpg"
      },
      {
        "thumbnail": "https://wx3.sinaimg.cn/orj360/005GiAGFgy1i20y52tin9j320u0xiqv5.jpg",
        "large": "https://wx3.sinaimg.cn/large/005GiAGFgy1i20y52tin9j320u0xiqv5.jpg"
      },
      {
        "thumbnail": "https://wx2.sinaimg.cn/orj360/005GiAGFgy1i20y4jg6gaj31hc0oktl2.jpg",
        "large": "https://wx2.sinaimg.cn/large/005GiAGFgy1i20y4jg6gaj31hc0oktl2.jpg"
      },
      {
        "thumbnail": "https://wx3.sinaimg.cn/orj360/005GiAGFgy1i20y6fgcg3j320u0xib29.jpg",
        "large": "https://wx3.sinaimg.cn/large/005GiAGFgy1i20y6fgcg3j320u0xib29.jpg"
      }
    ],
    "videos": {}
  }
]

search_topics(keyword, limit, page)

描述:搜索微博话题

返回值示例如下:

[
  {
    "title": "#许嵩#",
    "desc1": "",
    "desc2": "1913.8万讨论 26.8亿阅读",
    "url": "https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%23%E8%AE%B8%E5%B5%A9%23&isnewpage=1"
  },
  {
    "title": "#许嵩呼吸之野演唱会#",
    "desc1": "",
    "desc2": "1738.4万讨论 6.9亿阅读",
    "url": "https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%23%E8%AE%B8%E5%B5%A9%E5%91%BC%E5%90%B8%E4%B9%8B%E9%87%8E%E6%BC%94%E5%94%B1%E4%BC%9A%23&extparam=%23%E8%AE%B8%E5%B5%A9%E5%91%BC%E5%90%B8%E4%B9%8B%E9%87%8E%E6%BC%94%E5%94%B1%E4%BC%9A%23"
  },
  {
    "title": "#冯禧许嵩疑分手#",
    "desc1": "",
    "desc2": "6157讨论 8040.5万阅读",
    "url": "https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%23%E5%86%AF%E7%A6%A7%E8%AE%B8%E5%B5%A9%E7%96%91%E5%88%86%E6%89%8B%23&extparam=%23%E5%86%AF%E7%A6%A7%E8%AE%B8%E5%B5%A9%E7%96%91%E5%88%86%E6%89%8B%23"
  }
]

get_comments(feed_id, page)

描述:获取指定微博下的评论 返回值示例如下:

[{
	"id": 5176653778784993,
	"text": "回复<a href='https://m.weibo.cn/n/需要爱谁'>@需要爱谁</a>:这是openRouter的使用数据。ds除了那波发布的新鲜劲头,主要服务国内市场。国内用户没理由用国内ai还特意找openRouter这个海外中间商",
	"created_at": "55分钟前",
	"source": "来自广东",
	"user": {
		"id": 1784072130,
		"screen_name": "呗塔熊",
		"profile_image_url": "https://tva2.sinaimg.cn/crop.0.0.749.749.180/6a56c7c2jw8f2l1ermz4hj20ku0kt3z8.jpg?KID=imgbed,tva&Expires=1749708042&ssig=eLSiu6Jz5j",
		"profile_url": "https://m.weibo.cn/u/1784072130?",
		"description": "",
		"follow_count": 0,
		"followers_count": "158",
		"avatar_hd": "",
		"verified": false,
		"verified_reason": "",
		"gender": ""
	},
	"reply_id": 5176636326281776,
	"reply_text": "DS怎么是0%<span class=\"url-icon\"><img alt=[思考] src=\"https://h5.sinaimg.cn/m/emoticon/icon/default/d_sikao-ff9602dd08.png\" style=\"width:1em; height:1em;\" /></span>"
}]

资源

提示

依赖要求

  • Python >= 3.10
  • httpx >= 0.24.0

许可证

MIT 许可证 - 详见 LICENSE 文件

免责声明

本项目与微博官方无关,仅用于学习和研究目的。

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

mcp_server_weibo-1.0.3.tar.gz (47.8 kB view details)

Uploaded Source

Built Distribution

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

mcp_server_weibo-1.0.3-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file mcp_server_weibo-1.0.3.tar.gz.

File metadata

  • Download URL: mcp_server_weibo-1.0.3.tar.gz
  • Upload date:
  • Size: 47.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.5

File hashes

Hashes for mcp_server_weibo-1.0.3.tar.gz
Algorithm Hash digest
SHA256 6687ff7b47c0741dda6533b82efb661cb98d9f00c80c628a4c231f218c99fd91
MD5 d262d5e53b5cab79d1c8da051dbf0cff
BLAKE2b-256 967930e8cb4ad41b9d82b4365c782afc5b3acf1cedcc1d860b6d45cc4743f171

See more details on using hashes here.

File details

Details for the file mcp_server_weibo-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_server_weibo-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 67c73bbe6de60cdea0d6c766c0392259646c046e92c4435f8eda04e0f9a5314b
MD5 19f488bd045c25c059eb51d44d583800
BLAKE2b-256 60bc74dfdf50e259086eb07e198af732e3a9b3f596b73e2080c76a7f48a64245

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