Skip to content

Reddit and X data in LlamaIndex

llama-index-tools-mcp connects a LlamaIndex agent to ChatterAPI's hosted MCP server over Streamable HTTP. The agent gets Reddit and X tools, and you can feed their results into an index.

MCP server URLhttps://api.chatterapi.com/mcp

What you get

  • Reddit and X tools for a LlamaIndex agent, loaded from the server.
  • Threads with full comment trees, ready to chunk and index.
  • Credits in every result.

Set it up

  1. Create an API key

    Sign in at chatterapi.com/signup with Google and create a key on the Keys page. You get 100 free credits. A ca_test_ key returns recorded samples for 0 credits, which helps while you set things up.

  2. Install the MCP tools package

    Install it from PyPI.

    terminal
    pip install llama-index-tools-mcp
  3. Load the tools

    Pass BasicMCPClient the MCP URL and the header, then turn the server's tools into a tool list for your agent.

    agent.py
    import asyncio, os
    from llama_index.tools.mcp import BasicMCPClient, McpToolSpec
    
    client = BasicMCPClient(
        "https://api.chatterapi.com/mcp",
        headers={"Authorization": f"Bearer {os.environ['CHATTERAPI_KEY']}"},
    )
    
    async def main():
        tools = await McpToolSpec(client=client).to_tool_list_async()
        print([t.metadata.name for t in tools])
    
    asyncio.run(main())

A thread for your index

The agent calls reddit_thread with a post id and gets back the post and its comments. The response comes from a real recorded call.

Try this prompt

Read Reddit thread 1wdihhj and list each product people recommend.

{
  "method": "tools/call",
  "params": {
    "name": "reddit_thread",
    "arguments": {
      "id": "1wdihhj"
    }
  }
}
response, first 2 rows
{
  "data": {
    "post": {
      "id": "1wdihhj",
      "fullname": "t3_1wdihhj",
      "title": "What CRM should a small business use?",
      "body": "We’re a small B2B business with 6 people and sales is still pretty founder led, but revenue has grown enough that keeping leads, follow ups and customer conversations spread across spreadsheets and inboxes is starting to…",
      "author": "NotedWhisky",
      "subreddit": "CRM",
      "permalink": "/r/CRM/comments/1wdihhj/what_crm_should_a_small_business_use/",
      "url": "https://www.reddit.com/r/CRM/comments/1wdihhj/what_crm_should_a_small_business_use/",
      "externalUrl": null,
      "score": 52,
      "numComments": 186,
      "upvoteRatio": 0.96,
      "createdAt": "2026-09-11T14:52:16.000Z",
      "nsfw": false,
      "locked": false,
      "media": null
    },
    "comments": [
      {
        "id": "p97byh3",
        "fullname": "t1_p97byh3",
        "parentId": null,
        "postId": "1wdihhj",
        "postTitle": null,
        "author": "New_Dimension_5894",
        "body": "Since you're a small B2B team I’d seriously consider Monaco as an AI native CRM, especially if the goal is growing revenue without adding a bunch of CRM admin as the pipeline gets bigger. The agents can take ownership of…",
        "bodyTruncated": false,
        "score": 8,
        "subreddit": null,
        "permalink": "/r/CRM/comments/1wdihhj/what_crm_should_a_small_business_use/p97byh3/",
        "url": "https://www.reddit.com/r/CRM/comments/1wdihhj/what_crm_should_a_small_business_use/p97byh3/",
        "createdAt": "2026-09-11T18:15:02.000Z"
      },
      {
        "id": "p9636y0",
        "fullname": "t1_p9636y0",
        "parentId": null,
        "postId": "1wdihhj",
        "postTitle": null,
        "author": "OstrichSome3412",
        "body": "Just a FYI, don’t buy for the company you imagine having in 5 years. Buy for the next 12 or 18 months and make sure exporting your data isn’t painful if you eventually need something heavier.",
        "bodyTruncated": false,
        "score": 6,
        "subreddit": null,
        "permalink": "/r/CRM/comments/1wdihhj/what_crm_should_a_small_business_use/p9636y0/",
        "url": "https://www.reddit.com/r/CRM/comments/1wdihhj/what_crm_should_a_small_business_use/p9636y0/",
        "createdAt": "2026-09-11T15:02:24.000Z"
      }
    ],
    "unloadedReplyStubs": 0,
    "reportedCommentCount": 186
  },
  "page": {
    "nextCursor": null,
    "hasMore": false
  }
}

Recorded from a live call on . Long text is shortened and the cursor is cut. A live key is charged 3 credits for this call. A test key returns this same sample for 0 credits.

Limits worth knowing

  • The package connects to MCP servers by URL over Streamable HTTP or SSE, or to local commands. source
  • The package is published on PyPI as llama-index-tools-mcp. source

Last checked . Sources: llama-index-tools-mcp on GitHub, llama-index-tools-mcp on PyPI.

Questions

Does it cost more through LlamaIndex than through REST?
No. MCP and REST call the same tools, cost the same credits and draw from one balance.
Can I try it without spending credits?
Yes. Use a ca_test_ key. Every tool returns a recorded sample for 0 credits, whatever you ask.
Is ChatterAPI part of Reddit or X?
No. ChatterAPI is independent and not affiliated with Reddit, Inc. or X Corp.

What people build with it

Agent frameworks

Give your agent Reddit and X data

Sign up and get 100 free credits. No card required.