# UGC Scraper MCP server

A [Model Context Protocol](https://modelcontextprotocol.io) server for the
[UGC Scraper](https://ugcscraper.com) Reddit API. It lets Claude Desktop (and any MCP client) scrape
a Reddit post and its full comment thread into clean, consistent JSON, and read your durable scrape
history, without leaving the model.

It is a thin, authenticated HTTP client over `https://api.ugcscraper.com`. No proxies, no Reddit API
keys, no scraping logic of its own.

## Tools

| Tool | What it does |
|------|--------------|
| `scrape_reddit_url` | Scrape a Reddit post URL (or bare post id) into one JSON schema (post + full comment thread). Spends quota only on success. |
| `get_history` | List durable snapshots you have already scraped (summaries), optionally by post id. Free. |
| `get_history_latest` | Re-fetch the latest stored full post for a post id, without spending quota. |
| `get_usage` | Report your tier, monthly quota, usage, and remaining allowance. |

## Setup

1. Get an API key at <https://ugcscraper.com/dashboard> (starts with `rps_live_`). The free tier
   includes 1,000 successful posts per month.
2. Add the server to your MCP client. For **Claude Desktop**, edit `claude_desktop_config.json`
   (Settings → Developer → Edit Config) and add:

```json
{
  "mcpServers": {
    "ugc-scraper-reddit": {
      "command": "npx",
      "args": ["-y", "ugc-scraper-reddit-mcp"],
      "env": {
        "UGC_SCRAPER_API_KEY": "rps_live_YOUR_KEY_HERE"
      }
    }
  }
}
```

3. Restart Claude Desktop. Ask it to "scrape this Reddit thread: <url>" and it will call
   `scrape_reddit_url`.

### Environment variables

| Var | Required | Default |
|-----|----------|---------|
| `UGC_SCRAPER_API_KEY` | yes | — |
| `UGC_SCRAPER_BASE_URL` | no | `https://api.ugcscraper.com` |

## Local development

```bash
npm install
npm run build
UGC_SCRAPER_API_KEY=rps_live_... npm start   # runs the stdio server
```

To run from source against a local API, set `UGC_SCRAPER_BASE_URL=http://localhost:8000`.

## License

MIT
