reddit-mcp
reddit-mcp
Nur-Lese-Reddit-Data-API-MCP-Connector für Cursor / Grok Bot Connect-Card-OAuth.
Läuft als Cloudflare Worker, der MCP Streamable HTTP spricht und das Authorization: Bearer-Token des Aufrufers an https://oauth.reddit.com weiterreicht.
Repository: https://github.com/pmsorhaindo/reddit-mcp
Architektur
Cursor / Grok Bot
│ OAuth (connect-card) against Reddit authorize/token
│ then MCP JSON-RPC with Bearer access token
▼
Cloudflare Worker (this repo)
│ POST /mcp → tools/list, tools/call
│ GET /.well-known/oauth-* → discovery pointing at Reddit
▼
https://oauth.reddit.com (User-Agent from env, Bearer passthrough)Route | Verwendungszweck |
| Liveness + Endpunktübersicht |
| MCP Streamable HTTP (JSON-RPC: |
| OAuth-AS-Metadaten (Reddit authorize/token) |
| Metadaten der geschützten Ressource für diese MCP-URL |
| Nur Entwicklungs-Landingpage – tauscht keine Codes aus |
Warum minimales JSON-RPC (nicht das vollwertige MCP SDK)?
@modelcontextprotocol/sdk zielte historisch auf Node-Transports. Dieser Worker implementiert eine Workers-native, schlanke Streamable-HTTP-JSON-RPC-Oberfläche (initialize / tools/list / tools/call), die genau das abdeckt, was Cursor/Grok für Tool-Aufrufe benötigen – ohne Durable Objects oder Session-Stores. Das passt zum Bearer-Passthrough: Der Worker hält niemals Reddit-Refresh-Tokens.
Tools
Tool | Reddit-API | Scopes |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Alle Tools geben kompaktes JSON zurück (gekürzte Textfelder). limit ist standardmäßig 25, das Maximum ist 100.
Ratenbegrenzung
Ausgehende Reddit-Aufrufe werden pro Worker-Isolate serialisiert (Promise-Kette).
Die Antwort-Header
X-Ratelimit-Remaining/X-Ratelimit-Resetwerden vor dem nächsten Aufruf berücksichtigt.HTTP 429 / 503 lösen begrenzte Wiederholungsversuche mit
Retry-Afteroder exponentiellem Backoff aus.
Geheimnis-Hygiene
Übertragen Sie niemals echte Geheimnisse.
Ein striktes
.gitignoredeckt ab:.env,.dev.vars,.wrangler/,node_modules/,dist/,credentials*.json,.mcp-auth/.Es werden nur Beispiel-Env-Dateien übertragen:
.dev.vars.example,.env.example.wrangler.tomlenthält keine Inline-Secrets.Fehler und
console-Logs enthalten niemalsAuthorization-Header, Tokens oder geheime Env-Werte.Tool-Fehlerantworten enthalten nur Status/Meldung – keine Upstream-Response-Bodies, die Anmeldedaten widerspiegeln könnten.
Related MCP server: reddit-mcp
Reddit-App-Einrichtung
Erstelle eine Reddit-App unter https://www.reddit.com/prefs/apps (Typ Web-App oder installierte App, passend zu deinem Client).
Füge Redirect-URIs hinzu:
http://localhost:8787/callback– lokales Wrangler / manuelle Testshttps://www.cursor.com/agents/mcp/oauth/callback– Cursor Connect-Card
Fordere Scopes an (durchgerechnet, mit Komma im in Reddit-Autorisierungs-URIs):
identity,read,mysubreddits,history
Notiere dir
client_id/client_secretfür den OAuth-Client (Cursor / deinen Secrets-Manager). Lege sie nicht in diesem Repository oder inwrangler.tomlab.
Annahmen zur OAuth-Erkennung
/.well-known/oauth-authorization-serverbewirbt:authorization_endpoint:https://www.reddit.com/api/v1/authorizetoken_endpoint:https://www.reddit.com/api/v1/access_token
Dieser Worker führt keinen Authorization-Code-Austausch durch und speichert keine Refresh-Tokens.
Cursor/Grok schließen OAuth-Authorisierung mit Reddit ab (mit den Reddit-App-Zugangsdaten, die du im Client konfigurierst) und senden dann
Authorization: Bearer <access_token>bei MCP-Anfragen.issuerin den Metadaten ist die Origin dieses Workers, damit MCP-Clients Doku aus der MCP-Basis-URL ableiten können; authorize/tokenBibliothek bleiben auf Reddit.Reddit-Scopes werden auf der authorize URL traditionell kommagetrennt übergeben – Clients müssen die Scopes entsprechend zusammenfügen.
Cloudflare-Bereitstellung
Voraussetzungen: Node 22+, ein Cloudflare-Konto, Wrangler eingeloggt (npx wrangler login).
git clone https://github.com/pmsorhaindo/reddit-mcp.git
cd reddit-mcp
npm install
# Local secrets (gitignored)
cp .dev.vars.example .dev.vars
# edit USER_AGENT — must identify you per Reddit API rules
npm run typecheck
npm run dev # http://127.0.0.1:8787
# Production secret (not committed)
npx wrangler secret put USER_AGENT
npm run deployUSER_AGENT Beispielsh Form (nur Platzhalter):
cloudflare-worker:reddit-mcp:0.1.0 (by /u/YOUR_REDDIT_USERNAME)Nach dem Deployment für die workers.dev- oder Custom-Domain-URL, z. B. https://reddit-mcp.<account>.workers.dev.
MCP-Server hinzufügen (Cursor / Grok)
Konfiguriere AddMcpServer (oder eine entsprechende Connect-Card) mit:
Feld | Wert |
URL |
|
Auth | OAuth (Connect-Card) |
Scopes |
|
Der Client sollte die Client-ID/Secret deiner Reddit-App und die oben genannte Cursor- Redirect URI verwenden. Nach Ende-Authentifizierungmüssen Anrufe für MCP-Tools den Reddit-Zugriffstoken als Bearer-Header enthalten; dieser Worker reicht ihn an Reddit weiter.
Smoke-Tests
Ersetze $BASE und $TOKEN lokal – committe keine Tokens.
BASE=http://127.0.0.1:8787
TOKEN=reddit_access_token_here
# Health
curl -sS "$BASE/health"
# OAuth metadata
curl -sS "$BASE/.well-known/oauth-authorization-server"
curl -sS "$BASE/.well-known/oauth-protected-resource"
# MCP initialize
curl -sS -X POST "$BASE/mcp" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"smoke","version":"0"}}}'
# tools/list
curl -sS -X POST "$BASE/mcp" \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
# tools/call get_me (requires valid Bearer)
curl -sS -X POST "$BASE/mcp" \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $TOKEN" \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_me","arguments":{}}}'Erwartet: JSON-RPC-Ergebnisse; get_me liefert kompakte Profilfelder. Ohne Bearer-Token → JSON-RPC-Fehler Unauthorized ohne Preisgabe von Headern.
Skripte
Skript | Befehl |
|
|
|
|
|
|
Außerhalb des Umfangs
Schreiben, Stimmen, Nachrichten, Moderation oder Ads-API
Speichern von Reddit-Refresh-Tokens oder Client-Stichdaten auf dem Worker
OAuth-Code-Austausch auf
/callbackVollständige MCP-Ressourcen/Pronomen/Sampler/Elicitation-Sessions
Multi-Tenant-Token-Vaults / Durable-Object-Session-Stores
Garantierte globale Ratenbegrenzung über Isolates hinweg (Limits gelten pro Isolate + Reddit-Header)**Eigenverantwortlich
Lizenz
Privat / unveröffentlicht, sofern Sie eine Lizenzdatei hinzufügen.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Reddit MCP server: search posts, subreddit feeds, comments & user profiles as JSON. No API key.
Reddit MCP — public Reddit data via JSON endpoints (no auth required)
Reddit & X data for AI agents over MCP. Semantic search, hosted, no Reddit API.
Read-only Reddit search API for AI agents: posts, comments, comment trees, subreddit rules.
Related MCP Servers
- AlicenseBqualityDmaintenanceAn MCP server that provides both read-only and authenticated access to Reddit content and interactions without requiring a developer API key. It enables users to browse posts, search subreddits, and perform write actions like commenting and voting by leveraging browser session cookies.81The Unlicense
- FlicenseNot gradedqualityDmaintenanceA read-only Model Context Protocol server that enables browsing subreddits, searching within subreddits, retrieving comment trees, and looking up user activity on Reddit via natural language.
- AlicenseNot gradedqualityDmaintenanceA read-only MCP server that connects to the Reddit Data API to search posts, browse subreddits, read comments, view user profiles, and check trending content through the Model Context Protocol.121MIT
- AlicenseNot gradedqualityCmaintenanceRead-only MCP server for public Reddit content using TypeScript. Enables listing posts, fetching post details and comments, and searching Reddit.322MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/pmsorhaindo/reddit-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server