Back to use cases

    Use case / Marketers / Python 3 / Published

    Reddit Lead Generation: Find Threads Where People Ask for a Tool

    Card for Reddit Lead Generation: Find Threads Where People Ask for a Tool

    Forum Intent Board is a small Python script for founders and marketers doing Reddit lead generation. Give it 5 to 8 keywords from your niche and it finds public Reddit and Hacker News threads where people are asking for a tool, a recommendation or an alternative, then ranks them on a board.

    The problem

    People ask for product recommendations on Reddit and Hacker News every day, and those threads are some of the warmest leads there are. Finding them means searching each keyword on each site, skipping the noise, and checking that the thread is real and recent.

    What the app does

    • Takes a niche label and up to 8 keywords.
    • Searches Reddit and Hacker News separately for each keyword.
    • Checks HN threads exist and reads their posting time.
    • Scores titles and snippets for intent phrases such as "looking for", "alternative to" and "recommend".
    • Keeps threads that are on topic and shows intent terms, so you can see why each row made the board.
    • Writes forum_hits.csv, a ranked board and a call log with cost.

    How it works

    1. Search. One hosted MCP ai-search call per keyword and source (reddit or hackernews), links only, past month by default.
    2. Clean titles. Generic Reddit titles are replaced by the thread's URL slug.
    3. Link check. HN links are checked against public HN item data. Non-thread links are dropped.
    4. Score intent with weighted phrase rules you can edit at the top of the script.
    5. Board. Unique, on-topic threads with intent, sorted by score then by newest.

    The code

    async def run_mcp(keywords, args, key):
        import httpx2  # noqa: F401  (installed with mcp)
        from mcp import ClientSession
        from mcp.client.streamable_http import streamable_http_client
        from mcp.shared._httpx_utils import create_mcp_http_client
        calls = []
        client = create_mcp_http_client(headers={"Authorization": f"Bearer {key}"})
        async with client:
            async with streamable_http_client(MCP_URL, http_client=client) as (r, w):
                async with ClientSession(r, w) as s:
                    await s.initialize()
                    for kw in keywords:
                        for src in SOURCES:
                            a = {"prompt": kw, "tools": [src], "result_type": args.result_type}
                            if args.date_filter:
                                a["date_filter"] = args.date_filter
                            t0 = time.time(); at = now_local().isoformat(timespec="seconds")
                            try:
                                res = await s.call_tool("ai-search", a)
                                text = res.content[0].text if res.content else ""
                                err = bool(res.is_error)
                            except Exception as e:  # keep going, log it
                                text, err = f"{type(e).__name__}: {e}", True
                            try:
                                body = json.loads(text)
                            except Exception:
                                body = {"_text": text}
                            c = {"keyword": kw, "source": src, "arguments": a, "at": at, "seconds": round(time.time() - t0, 2),
                                 "is_error": err, "cost_usd": body.get("cost_usd"), "usage_count": body.get("usage_count"),
                                 "results": body.get("search") or [], "extra_keys": sorted(k for k in body if k != "search")}
                            if err or "_text" in body:
                                c["error_text"] = text[:500]
                            calls.append(c)
                            print(f"{at} ai-search {src:10s} {kw!r}: {len(c['results'])} links, cost {c['cost_usd']}", flush=True)
        return calls
    

    The folder has forum_intent_board.py, an example keywords.json, and the sample run in output/.

    Endpoints

    • MCP tool ai-search (reddit)
    • MCP tool ai-search (hackernews)

    Example output

    From a run on 2026-10-12 for 8 keywords in crypto and on-chain data tools:

    MeasureResult
    Calls16 (10 links each)
    Unique links156
    HN item links that were live74 of 75
    Threads on the board19 (7 HN, 12 Reddit)
    Cost$0.064

    A spot check of 20 rows found 13 on topic. Keywords with a product noun ("crypto tax software") gave cleaner boards than broad ones.

    Run it yourself

    The public examples folder linked above includes the script and a README. Install its requirements, set DESEARCH_API_KEY from console.desearch.ai, and use the run command in that README.

    Useful flags: --date-filter (default PAST_MONTH), --board-size (default 20), --no-link-check, --from-raw FILE (rebuild with no API calls).

    What it costs

    Each ai-search call cost $0.004 (10 links), as reported in the tool result on 2026-10-12. 8 keywords on two sources came to $0.064. See pricing.

    Ideas to extend it

    • Run it weekly and only show threads you have not seen before.
    • Draft a helpful, disclosed reply for each top thread and review it by hand.
    • Add more sources from the same search tool.

    Use with AI agents

    Point an MCP client at the hosted Desearch server. Replace the placeholder with a key from the console. Do not commit the key.

    {
      "mcpServers": {
        "desearch": {
          "url": "https://mcp.desearch.ai/mcp",
          "headers": {
            "Authorization": "Bearer <DESEARCH_API_KEY>"
          }
        }
      }
    }

    Prompt you can paste for this example:

    Use Desearch to find public Reddit and Hacker News threads in the niche I name where people ask for a tool, a recommendation, or an alternative. Return the thread link and the ask in their words. Do not invent threads.

    Build your own example.

    Give your agents access to web and social search. Get an API key to start building, or talk to us about your integration.

    Read docs