From fedbf95f6100d14962c2c3ae73619b00ce7107d7 Mon Sep 17 00:00:00 2001 From: Pnant <73925474+Panniantong@users.noreply.github.com> Date: Sun, 8 Mar 2026 22:25:40 +0800 Subject: [PATCH] feat: add Weibo as default-install channel via Panniantong fork (#118) - Weibo now auto-installs during 'agent-reach install' (no login needed) - Uses Panniantong/mcp-server-weibo fork with visitor passport auth fix - Works from overseas servers without proxy or cookies - Updated README (CN/EN), install.md, and channel check to point to fork - 10 tools: trending, search content/users/topics, profile, feeds, comments Co-authored-by: Panniantong --- README.md | 1 + agent_reach/channels/weibo.py | 12 ++++----- agent_reach/cli.py | 49 +++++++++++++++++++++++++++++++++++ docs/README_en.md | 2 ++ docs/install.md | 9 ++++--- 5 files changed, 63 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 77f13bf..22aba88 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ AI Agent 已经能帮你写代码、改文档、管项目——但你让它去 | 💼 **LinkedIn** | Jina Reader 读公开页面 | Profile 详情、公司页面、职位搜索 | 告诉 Agent「帮我配 LinkedIn」 | | 🏢 **Boss直聘** | Jina Reader 读职位页 | 搜索职位、向 HR 打招呼 | 告诉 Agent「帮我配 Boss直聘」 | | 💬 **微信公众号** | 搜索 + 阅读公众号文章(全文 Markdown) | — | 无需配置 | +| 📰 **微博** | 热搜、搜索内容/用户/话题、用户动态、评论 | — | 无需配置 | > **不知道怎么配?不用查文档。** 直接告诉 Agent「帮我配 XXX」,它知道需要什么、会一步一步引导你。 > diff --git a/agent_reach/channels/weibo.py b/agent_reach/channels/weibo.py index 198f89b..cf2fc02 100644 --- a/agent_reach/channels/weibo.py +++ b/agent_reach/channels/weibo.py @@ -23,9 +23,9 @@ class WeiboChannel(Channel): return "off", ( "需要 mcporter + mcp-server-weibo。安装步骤:\n" " 1. npm install -g mcporter\n" - " 2. uvx mcp-server-weibo(或 pip install mcp-server-weibo)\n" - " 3. mcporter config add weibo --command 'uvx mcp-server-weibo'\n" - " 详见 https://github.com/qinyuanpei/mcp-server-weibo" + " 2. pip install git+https://github.com/Panniantong/mcp-server-weibo.git\n" + " 3. mcporter config add weibo --command 'mcp-server-weibo'\n" + " 详见 https://github.com/Panniantong/mcp-server-weibo" ) try: r = subprocess.run( @@ -35,10 +35,8 @@ class WeiboChannel(Channel): if "weibo" not in r.stdout: return "off", ( "mcporter 已装但微博 MCP 未配置。运行:\n" - " uvx mcp-server-weibo # 或 pip install mcp-server-weibo\n" - " mcporter config add weibo --command 'uvx mcp-server-weibo'\n" - " # 海外服务器需配置 WEIBO_COOKIE 环境变量,\n" - " # 详见 SKILL.md 微博章节" + " pip install git+https://github.com/Panniantong/mcp-server-weibo.git\n" + " mcporter config add weibo --command 'mcp-server-weibo'" ) except Exception: return "off", "mcporter 连接异常" diff --git a/agent_reach/cli.py b/agent_reach/cli.py index ffe0cd8..fc92a19 100644 --- a/agent_reach/cli.py +++ b/agent_reach/cli.py @@ -447,10 +447,59 @@ def _install_system_deps(): except Exception: print(" -- Could not configure yt-dlp JS runtime (YouTube may not work)") + # ── Weibo (mcp-server-weibo fork with visitor passport fix) ── + _install_weibo_deps() + # ── WeChat Articles (miku_ai + camoufox + wechat-article-for-ai) ── _install_wechat_deps() +def _install_weibo_deps(): + """Install Weibo MCP server (Panniantong fork with visitor passport auth).""" + import subprocess + + print("Setting up Weibo MCP server...") + + # Check if already installed and working + mcporter = shutil.which("mcporter") + if mcporter: + try: + r = subprocess.run( + [mcporter, "config", "list"], capture_output=True, + encoding="utf-8", errors="replace", timeout=5 + ) + if "weibo" in r.stdout: + print(" ✅ Weibo MCP already configured") + return + except Exception: + pass + + # Install from our fork (has visitor passport auth fix) + try: + subprocess.run( + [sys.executable, "-m", "pip", "install", "-q", + "git+https://github.com/Panniantong/mcp-server-weibo.git"], + check=True, timeout=120 + ) + print(" ✅ mcp-server-weibo installed (Panniantong fork)") + except Exception as e: + print(f" [!] mcp-server-weibo install failed: {e}") + return + + # Register with mcporter + if mcporter: + try: + subprocess.run( + [mcporter, "config", "add", "weibo", "--command", "mcp-server-weibo"], + check=True, capture_output=True, timeout=10 + ) + print(" ✅ Weibo MCP registered with mcporter") + except Exception: + print(" [!] mcporter config add failed. Run manually: mcporter config add weibo --command 'mcp-server-weibo'") + else: + print(" -- mcporter not found, skipping MCP registration. Install mcporter first, then run: mcporter config add weibo --command 'mcp-server-weibo'") + + def _install_wechat_deps(): """Install WeChat article reading and search dependencies.""" import subprocess diff --git a/docs/README_en.md b/docs/README_en.md index b545d94..34a0e25 100644 --- a/docs/README_en.md +++ b/docs/README_en.md @@ -68,6 +68,7 @@ Update Agent Reach: https://raw.githubusercontent.com/Panniantong/agent-reach/ma | 💼 **LinkedIn** | Jina Reader (public pages) | Full profiles, companies, job search | Tell your Agent "help me set up LinkedIn" | | 🏢 **Boss直聘** | Jina Reader (job pages) | Job search, greet recruiters | Tell your Agent "help me set up Boss直聘" | | 💬 **WeChat Articles** | Search + Read | Zero config | Search + read WeChat Official Account articles (full Markdown) ([wechat-article-for-ai](https://github.com/bzd6661/wechat-article-for-ai) + [miku_ai](https://github.com/GobinFan/Miku_Spider)) | +| 📰 **Weibo** | Trending · Search · Feeds · Comments | Zero config | Hot search, content/user/topic search, feeds, comments ([mcp-server-weibo](https://github.com/Panniantong/mcp-server-weibo)) | | 🔍 **Web Search** | Search | Auto-configured | Auto-configured during install, free, no API key ([Exa](https://exa.ai) via [mcporter](https://github.com/nicepkg/mcporter)) | | 📦 **GitHub** | Read · Search | Zero config | [gh CLI](https://cli.github.com) powered. Public repos work immediately. `gh auth login` unlocks Fork, Issue, PR | | 📺 **YouTube** | Read · **Search** | Zero config | Subtitles + search across 1800+ video sites ([yt-dlp](https://github.com/yt-dlp/yt-dlp) ⭐148K) | @@ -224,6 +225,7 @@ Each channel file only checks whether its upstream tool is installed and working | LinkedIn | [linkedin-scraper-mcp](https://github.com/stickerdaniel/linkedin-mcp-server) | 900+ stars, MCP server, browser automation | | Boss直聘 | [mcp-bosszp](https://github.com/mucsbr/mcp-bosszp) | MCP server, job search + recruiter greeting | | WeChat Articles | [wechat-article-for-ai](https://github.com/bzd6661/wechat-article-for-ai) + [miku_ai](https://github.com/GobinFan/Miku_Spider) | Stealth browser for full article reading + Sogou search | +| Weibo | `mcporter` | `mcporter call 'weibo.get_trendings(limit: 10)'` | > 📌 These are the *current* choices. Don't like one? Swap out the file. That's the whole point of scaffolding. diff --git a/docs/install.md b/docs/install.md index cfc2542..244af9b 100644 --- a/docs/install.md +++ b/docs/install.md @@ -163,14 +163,16 @@ mcporter config add xiaohongshu http://localhost:18060/mcp > **备选:** 本地电脑如果有浏览器,也可以打开 http://localhost:18060 扫码登录。 **微博 / Weibo (mcp-server-weibo):** -> "微博需要一个 MCP 服务。安装后可搜索微博内容、查看热搜、获取用户动态和评论。" +> "微博已默认安装,装好即用。可搜索微博内容、查看热搜、获取用户动态和评论。" + +如果自动安装失败,手动安装: ```bash -pip install mcp-server-weibo +pip install git+https://github.com/Panniantong/mcp-server-weibo.git mcporter config add weibo --command 'mcp-server-weibo' ``` -> **注意:** 微博 API (m.weibo.cn) 海外访问时需要 Cookie 认证。首次使用前建议在浏览器登录微博,用 Cookie-Editor 导出 Cookie 并配置到 `WEIBO_COOKIE` 环境变量中,否则 API 请求可能返回空响应。 +> 无需登录、无需 Cookie、无需代理。海外服务器也可以直接访问。 **抖音 / Douyin (douyin-mcp-server):** > "抖音视频解析需要一个 MCP 服务。安装 douyin-mcp-server 后即可解析视频、获取无水印下载链接。" @@ -319,6 +321,7 @@ After installation, use upstream tools directly. See SKILL.md for the full comma | Web | `curl` + Jina | `curl -s "https://r.jina.ai/URL"` | | Exa Search | `mcporter` | `mcporter call 'exa.web_search_exa(...)'` | | 小红书 | `mcporter` | `mcporter call 'xiaohongshu.search_feeds(...)'` | +| 微博 | `mcporter` | `mcporter call 'weibo.get_trendings(limit: 10)'` | | 抖音 | `mcporter` | `mcporter call 'douyin.parse_douyin_video_info(...)'` | | LinkedIn | `mcporter` | `mcporter call 'linkedin.get_person_profile(...)'` | | Boss直聘 | `mcporter` | `mcporter call 'bosszhipin.search_jobs_tool(...)'` |