Skip to content

Give your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.

fix: install 自动安装 gh CLI + Node.js,加大 mcporter 超时

Panniantong51f73639e23d
diff --git a/agent_reach/cli.py b/agent_reach/cli.py
index 18b25b69..6a287b6f 100644
--- a/agent_reach/cli.py
+++ b/agent_reach/cli.py
@@ -165,6 +165,10 @@ def _cmd_install(args):
config.set("bilibili_proxy", args.proxy)
print(f"✅ Proxy configured for Reddit + Bilibili")
+ # ── Install system dependencies ──
+ print()
+ _install_system_deps()
+
# ── mcporter (for Exa search + XiaoHongShu) ──
print()
_install_mcporter()
@@ -215,7 +219,71 @@ def _cmd_install(args):
print(f"✅ Installation complete! {ok}/{total} channels active.")
-def _install_mcporter():
+def _install_system_deps():
+ """Install system-level dependencies: gh CLI, Node.js (for mcporter)."""
+ import shutil
+ import subprocess
+ import platform
+
+ print("🔧 Checking system dependencies...")
+
+ # ── gh CLI ──
+ if shutil.which("gh"):
+ print(" ✅ gh CLI already installed")
+ else:
+ print(" 📥 Installing gh CLI...")
+ os_type = platform.system().lower()
+ if os_type == "linux":
+ try:
+ # Official GitHub method for Linux
+ cmds = [
+ "curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg 2>/dev/null",
+ 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null',
+ "apt-get update -qq 2>/dev/null",
+ "apt-get install -y -qq gh 2>/dev/null",
+ ]
+ for cmd in cmds:
+ subprocess.run(cmd, shell=True, capture_output=True, timeout=60)
+ if shutil.which("gh"):
+ print(" ✅ gh CLI installed")
+ else:
+ print(" ⚠️ gh CLI install failed. Install manually: https://cli.github.com")
+ except Exception:
+ print(" ⚠️ gh CLI install failed. Install manually: https://cli.github.com")
+ elif os_type == "darwin":
+ if shutil.which("brew"):
+ try:
+ subprocess.run(["brew", "install", "gh"], capture_output=True, timeout=120)
+ if shutil.which("gh"):
+ print(" ✅ gh CLI installed")
+ else:
+ print(" ⚠️ gh CLI install failed. Try: brew install gh")
+ except Exception:
+ print(" ⚠️ gh CLI install failed. Try: brew install gh")
+ else:
+ print(" ⚠️ gh CLI not found. Install: https://cli.github.com")
+ else:
+ print(" ⚠️ gh CLI not found. Install: https://cli.github.com")
+
+ # ── Node.js (needed for mcporter) ──
+ if shutil.which("node") and shutil.which("npm"):
+ print(" ✅ Node.js already installed")
+ else:
+ print(" 📥 Installing Node.js...")
+ try:
+ # Use NodeSource for quick install
+ subprocess.run(
+ "curl -fsSL https://deb.nodesource.com/setup_22.x | bash - 2>/dev/null && apt-get install -y -qq nodejs 2>/dev/null",
+ shell=True, capture_output=True, timeout=120,
+ )
+ if shutil.which("node"):
+ print(" ✅ Node.js installed")
+ else:
+ print(" ⚠️ Node.js install failed. Install manually: https://nodejs.org")
+ except Exception:
+ print(" ⚠️ Node.js install failed. Install manually: https://nodejs.org")
+
+
"""Install mcporter and configure Exa + XiaoHongShu MCP servers."""
import shutil
import subprocess
@@ -233,7 +301,7 @@ def _install_mcporter():
try:
subprocess.run(
["npm", "install", "-g", "mcporter"],
- capture_output=True, text=True, timeout=60,
+ capture_output=True, text=True, timeout=120,
)
if shutil.which("mcporter"):
print(" ✅ mcporter installed")
diff --git a/docs/install.md b/docs/install.md
index eb193745..b6e33c7e 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -20,9 +20,10 @@ agent-reach install --env=auto
```
This single command does everything automatically:
+- Installs system dependencies (gh CLI, Node.js, mcporter) if missing
+- Configures Exa search (free, no API key needed)
- Detects local computer vs server
-- Auto-imports browser cookies on local (Twitter, XiaoHongShu, Bilibili)
-- Auto-detects Exa API key if already in environment
+- Auto-imports browser cookies on local (Twitter)
- Tests all channels
- Shows what's working and what needs setup
@@ -33,20 +34,12 @@ This single command does everything automatically:
Based on the install output, you may need to configure one or two things.
Only ask the user for items the install output says are missing.
-**If search is not configured:**
-> "Want to unlock web search? Go to https://exa.ai → sign up (free) → send me the API key."
-
-```bash
-agent-reach configure exa-key THE_KEY
-```
-
**If cookies were not auto-imported (server users):**
-> "To unlock Twitter and XiaoHongShu, install the Cookie-Editor Chrome extension, go to the site, click Export → Header String, and paste it to me."
+> "To unlock Twitter search and posting, install the Cookie-Editor Chrome extension, go to twitter.com, click Export → Header String, and paste it to me."
> Extension: https://chromewebstore.google.com/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm
```bash
agent-reach configure twitter-cookies "PASTED_STRING"
-agent-reach configure xhs-cookie "PASTED_STRING"
```
**If on server and wants Reddit/Bilibili full access:**
@@ -70,11 +63,9 @@ Report what's active. Users can configure more anytime by asking.
| Command | What it does |
|---------|-------------|
-| `agent-reach install --env=auto` | Full auto-setup |
+| `agent-reach install --env=auto` | Full auto-setup (installs deps + configures) |
| `agent-reach doctor` | Show status |
-| `agent-reach configure exa-key KEY` | Unlock search |
-| `agent-reach configure twitter-cookies "..."` | Unlock Twitter |
-| `agent-reach configure xhs-cookie "..."` | Unlock XiaoHongShu |
+| `agent-reach configure twitter-cookies "..."` | Unlock Twitter search + posting |
| `agent-reach configure proxy URL` | Unlock Reddit + Bilibili (server) |
| `agent-reach read URL` | Read any URL |
| `agent-reach search "query"` | Search the web |