TypeScript SDK
The official SubScraper SDK is the easiest way to interact with Reddit data in your Node.js or browser applications. It provides full TypeScript types and a clean, promise-based API.
Installation
Getting Started
First, get your API key from the dashboard. Then initialize the client:
import { SubScraperClient } from '@subscraper/sdk'; const client = new SubScraperClient({ apiKey: 'sk-your-api-key-here' // Get this from your dashboard });
Example: Search Posts
// Search Reddit posts by keyword const result = await client.searchPosts({ query: 'nextjs', limit: 3, sort: 'top', time: 'year' }); console.log(result.results);
Example: Get User Profile
// Fetch user karma, bio, and account age const profile = await client.getUserProfile({ username: 'shittymorph' }); console.log(`Total Karma: ${profile.karma.post + profile.karma.comment}`);
MCP for AI Agents
The Model Context Protocol (MCP) server allows AI assistants like Cursor, Claude Desktop, and Windsurf to directly fetch live Reddit data using your API key. It exposes all 14 endpoints as native AI tools.
Installation
Cursor Installation
To use SubScraper in Cursor, edit your ~/.cursor/mcp.json file to include the server:
{
"mcpServers": {
"subscraper": {
"command": "npx",
"args": ["-y", "@subscraper/mcp"],
"env": {
"REDDIT_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}Next step: Restart Cursor, open the Agent tab, and ask it to:
"Search Reddit for posts about indie hackers and show me the top 5"
Claude Desktop Installation
Edit your claude_desktop_config.json (usually in ~/Library/Application Support/Claude/ on Mac):
{
"mcpServers": {
"subscraper": {
"command": "npx",
"args": ["-y", "@subscraper/mcp"],
"env": {
"REDDIT_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}Next step: Restart Claude Desktop and you'll see the SubScraper tools (like search, get_user_profile) available in the tools menu.
REST API
You can call the SubScraper API directly from any language or HTTP client. All endpoints accept POST requests with a JSON body and require your API key as a Bearer token.
Authentication
Pass your API key in the Authorization header:
Example: curl
curl -X POST https://subscraper.dev/api/v1/search \ -H "Authorization: Bearer sk-your-api-key" \ -H "Content-Type: application/json" \ -d '{ "query": "best mechanical keyboard", "sort": "top", "limit": 5 }'