FetchLayer fetchlayer.dev Sign in

+ Integration Guide

How to Connect Reddit MCP to Claude Code

Set up FetchLayer's Reddit MCP server in Claude Code (Anthropic's terminal agent) so you can search Reddit and scrape data from the command line.

  • MCP
  • Claude Code
  • reddit scraping
  • AI agent
  • terminal
  • Anthropic

Claude Code is Anthropic’s agentic coding tool that runs in the terminal. It supports MCP servers, which means you can give it access to Reddit data through FetchLayer — right from your command line.


Prerequisites

  • Claude Code installed (npm install -g @anthropic-ai/claude-code)
  • A FetchLayer API key — get one free (no credit card)

Option 1: Add via CLI

The fastest way to add the FetchLayer MCP server:

claude mcp add fetchlayer \
  --transport streamable-http \
  https://mcp.fetchlayer.dev \
  -- --header "Authorization: Bearer sk-your-api-key"

This saves the config to ~/.claude/settings.json (global) so it’s available in all projects.

To add it for the current project only:

claude mcp add fetchlayer \
  --transport streamable-http \
  --scope project \
  https://mcp.fetchlayer.dev \
  -- --header "Authorization: Bearer sk-your-api-key"

This saves to .mcp.json in your project root.


Option 2: Edit config manually

If you prefer editing the config file directly, add this to ~/.claude/settings.json:

{
  "mcpServers": {
    "fetchlayer": {
      "url": "https://mcp.fetchlayer.dev",
      "headers": {
        "Authorization": "Bearer sk-your-api-key"
      }
    }
  }
}

Or for project-level config, create .mcp.json in your project root with the same content.


Verify it works

Run Claude Code and check that the MCP server is connected:

claude

Then type:

/mcp

You should see “fetchlayer” listed with its available tools.


Try it out

Once connected, just ask Claude Code to use Reddit data in your prompts:

> Search Reddit for "best API testing tools" and show me the top 5 results
> Get the latest posts from r/ExperiencedDevs about salary negotiation
> Scrape the comments from https://reddit.com/r/programming/comments/... and summarize the key opinions

Claude Code will call the FetchLayer tools automatically and incorporate the results into its responses.


Real workflow example

Here’s a practical use case — competitive research while coding:

> I'm building a URL shortener. Search Reddit for "self-hosted URL shortener"
> discussions from the past year. What are people recommending and what
> features do they care about most?

Claude Code will:

  1. Call scrape_search with the query
  2. Potentially call scrape_post on the most relevant threads to read comments
  3. Synthesize the findings into an actionable summary

All without leaving your terminal.


Available Tools

All 13 FetchLayer Reddit tools are available:

  • scrape_search — Search posts by keyword
  • scrape_post — Get a full post with comments
  • scrape_community_posts — Browse subreddit posts
  • scrape_community_details — Get subreddit metadata
  • scrape_user_profile — User karma, bio, account age
  • scrape_user_posts / scrape_user_comments — User history
  • scrape_search_communities / scrape_search_users — Discovery
  • scrape_comment_permalink — Specific comment with context
  • scrape_popular — What’s trending on Reddit
  • scrape_leaderboard — Trending communities
  • scrape_explore — Discover communities by topic

Troubleshooting

MCP server not connecting?

  • Run claude mcp list to see configured servers
  • Check that the URL is correct: https://mcp.fetchlayer.dev
  • Verify your API key is valid

Permission denied?

  • Claude Code may ask you to approve MCP tool usage — accept when prompted
  • Check the Claude Code permission settings with /permissions

What’s Next