Skip to content

Conversation

@viniciusventura29
Copy link
Contributor

@viniciusventura29 viniciusventura29 commented Jan 6, 2026

Summary by cubic

Added a Reddit MCP server to fetch subreddit posts and search Reddit. Runs on Cloudflare Workers and uses Reddit’s public JSON API (no auth).

  • New Features

    • Tools: GET_SUBREDDIT_POSTS and SEARCH_REDDIT with sort, time, limit, and pagination.
    • Zod input/output schemas and a simplified post format (title, author, score, etc.).
    • Server setup with Deco runtime, tool aggregation, and README.
  • Dependencies

    • Added the reddit workspace, Vite/Cloudflare config, wrangler.toml, and tsconfig.
    • Updated bun.lock and root package.json to include the new module and tooling.

Written for commit 9bcc301. Summary will update on new commits.

- Introduced a new `reddit` module, including package.json, README, and TypeScript configuration.
- Implemented tools for fetching posts from subreddits and searching Reddit content.
- Updated bun.lock and package.json to include new dependencies for the Reddit module.
- Created server structure and types for handling API requests and responses.
- Added comprehensive documentation in README for usage and development instructions.
@github-actions
Copy link

github-actions bot commented Jan 6, 2026

🚀 Preview Deployments Ready!

Your changes have been deployed to preview environments:

📦 reddit

🔗 View Preview

These previews will be automatically updated with new commits to this PR.


Deployed from commit: 3d9650f

@viniciusventura29 viniciusventura29 merged commit 2eb4dc6 into main Jan 6, 2026
5 of 9 checks passed
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 13 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="reddit/server/tools/utils/reddit.ts">

<violation number="1" location="reddit/server/tools/utils/reddit.ts:88">
P2: The `subreddit` parameter is directly interpolated into the URL path without encoding. If it contains URL-special characters (`?`, `#`, `/`), the URL will be malformed. Consider using `encodeURIComponent(subreddit)` to ensure URL safety, or validate the subreddit name format (alphanumeric and underscores only).</violation>

<violation number="2" location="reddit/server/tools/utils/reddit.ts:132">
P2: Same URL path injection issue as `getSubredditPosts`. The `subreddit` parameter should be encoded with `encodeURIComponent()` to prevent URL malformation from special characters.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

} = params;

// If subreddit is specified, search within it, otherwise search all Reddit
const path = subreddit ? `/r/${subreddit}/search` : "/search";
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Same URL path injection issue as getSubredditPosts. The subreddit parameter should be encoded with encodeURIComponent() to prevent URL malformation from special characters.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At reddit/server/tools/utils/reddit.ts, line 132:

<comment>Same URL path injection issue as `getSubredditPosts`. The `subreddit` parameter should be encoded with `encodeURIComponent()` to prevent URL malformation from special characters.</comment>

<file context>
@@ -0,0 +1,169 @@
+  } = params;
+
+  // If subreddit is specified, search within it, otherwise search all Reddit
+  const path = subreddit ? `/r/${subreddit}/search` : &quot;/search&quot;;
+
+  const queryParams: Record&lt;string, string | number | undefined&gt; = {
</file context>
Fix with Cubic

}) {
const { subreddit, sort = "hot", time, limit = 25, after } = params;

const path = `/r/${subreddit}/${sort}`;
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The subreddit parameter is directly interpolated into the URL path without encoding. If it contains URL-special characters (?, #, /), the URL will be malformed. Consider using encodeURIComponent(subreddit) to ensure URL safety, or validate the subreddit name format (alphanumeric and underscores only).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At reddit/server/tools/utils/reddit.ts, line 88:

<comment>The `subreddit` parameter is directly interpolated into the URL path without encoding. If it contains URL-special characters (`?`, `#`, `/`), the URL will be malformed. Consider using `encodeURIComponent(subreddit)` to ensure URL safety, or validate the subreddit name format (alphanumeric and underscores only).</comment>

<file context>
@@ -0,0 +1,169 @@
+}) {
+  const { subreddit, sort = &quot;hot&quot;, time, limit = 25, after } = params;
+
+  const path = `/r/${subreddit}/${sort}`;
+  const queryParams: Record&lt;string, string | number | undefined&gt; = {
+    limit,
</file context>
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants