@prmichaelsen/reddit-mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +23 -0
- package/.env.example +13 -0
- package/AGENT.md +1772 -0
- package/README.md +54 -0
- package/agent/commands/acp.clarification-capture.md +386 -0
- package/agent/commands/acp.clarification-create.md +432 -0
- package/agent/commands/acp.clarifications-research.md +326 -0
- package/agent/commands/acp.command-create.md +432 -0
- package/agent/commands/acp.design-create.md +286 -0
- package/agent/commands/acp.design-reference.md +355 -0
- package/agent/commands/acp.index.md +423 -0
- package/agent/commands/acp.init.md +546 -0
- package/agent/commands/acp.package-create.md +895 -0
- package/agent/commands/acp.package-info.md +212 -0
- package/agent/commands/acp.package-install.md +539 -0
- package/agent/commands/acp.package-list.md +280 -0
- package/agent/commands/acp.package-publish.md +541 -0
- package/agent/commands/acp.package-remove.md +293 -0
- package/agent/commands/acp.package-search.md +307 -0
- package/agent/commands/acp.package-update.md +361 -0
- package/agent/commands/acp.package-validate.md +540 -0
- package/agent/commands/acp.pattern-create.md +386 -0
- package/agent/commands/acp.plan.md +577 -0
- package/agent/commands/acp.proceed.md +882 -0
- package/agent/commands/acp.project-create.md +675 -0
- package/agent/commands/acp.project-info.md +312 -0
- package/agent/commands/acp.project-list.md +226 -0
- package/agent/commands/acp.project-remove.md +379 -0
- package/agent/commands/acp.project-set.md +227 -0
- package/agent/commands/acp.project-update.md +307 -0
- package/agent/commands/acp.projects-restore.md +228 -0
- package/agent/commands/acp.projects-sync.md +347 -0
- package/agent/commands/acp.report.md +407 -0
- package/agent/commands/acp.resume.md +239 -0
- package/agent/commands/acp.sessions.md +301 -0
- package/agent/commands/acp.status.md +293 -0
- package/agent/commands/acp.sync.md +364 -0
- package/agent/commands/acp.task-create.md +500 -0
- package/agent/commands/acp.update.md +302 -0
- package/agent/commands/acp.validate.md +466 -0
- package/agent/commands/acp.version-check-for-updates.md +276 -0
- package/agent/commands/acp.version-check.md +191 -0
- package/agent/commands/acp.version-update.md +289 -0
- package/agent/commands/command.template.md +339 -0
- package/agent/commands/git.commit.md +526 -0
- package/agent/commands/git.init.md +514 -0
- package/agent/design/.gitkeep +0 -0
- package/agent/design/design.template.md +154 -0
- package/agent/design/requirements.md +332 -0
- package/agent/design/requirements.template.md +387 -0
- package/agent/index/.gitkeep +0 -0
- package/agent/index/local.main.template.yaml +37 -0
- package/agent/manifest.template.yaml +13 -0
- package/agent/manifest.yaml +61 -0
- package/agent/milestones/.gitkeep +0 -0
- package/agent/milestones/milestone-1-foundation-listings-mvp.md +140 -0
- package/agent/milestones/milestone-1-{title}.template.md +206 -0
- package/agent/milestones/milestone-2-content-interaction.md +56 -0
- package/agent/milestones/milestone-3-users-and-messaging.md +54 -0
- package/agent/milestones/milestone-4-subreddits-and-flair.md +56 -0
- package/agent/milestones/milestone-5-moderation.md +53 -0
- package/agent/milestones/milestone-6-advanced-features-and-polish.md +56 -0
- package/agent/package.template.yaml +86 -0
- package/agent/patterns/.gitkeep +0 -0
- package/agent/patterns/bootstrap.template.md +1237 -0
- package/agent/patterns/pattern.template.md +382 -0
- package/agent/progress.template.yaml +161 -0
- package/agent/progress.yaml +223 -0
- package/agent/schemas/package.schema.yaml +276 -0
- package/agent/scripts/acp.common.sh +1781 -0
- package/agent/scripts/acp.yaml-parser.sh +985 -0
- package/agent/tasks/.gitkeep +0 -0
- package/agent/tasks/milestone-1-foundation-listings-mvp/task-1-project-scaffolding.md +75 -0
- package/agent/tasks/milestone-1-foundation-listings-mvp/task-2-reddit-oauth.md +71 -0
- package/agent/tasks/milestone-1-foundation-listings-mvp/task-3-reddit-api-client.md +71 -0
- package/agent/tasks/milestone-1-foundation-listings-mvp/task-4-listing-tools.md +65 -0
- package/agent/tasks/milestone-1-foundation-listings-mvp/task-5-search-tools.md +43 -0
- package/agent/tasks/milestone-1-foundation-listings-mvp/task-6-testing-verification.md +49 -0
- package/agent/tasks/milestone-2-content-interaction/task-7-post-tools.md +56 -0
- package/agent/tasks/milestone-2-content-interaction/task-8-comment-tools.md +49 -0
- package/agent/tasks/milestone-2-content-interaction/task-9-vote-save-report-tools.md +50 -0
- package/agent/tasks/milestone-3-users-and-messaging/task-10-account-tools.md +44 -0
- package/agent/tasks/milestone-3-users-and-messaging/task-11-user-profile-tools.md +50 -0
- package/agent/tasks/milestone-3-users-and-messaging/task-12-private-message-tools.md +50 -0
- package/agent/tasks/milestone-4-subreddits-and-flair/task-13-subreddit-tools.md +47 -0
- package/agent/tasks/milestone-4-subreddits-and-flair/task-14-flair-tools.md +46 -0
- package/agent/tasks/milestone-4-subreddits-and-flair/task-15-http-transport.md +53 -0
- package/agent/tasks/milestone-5-moderation/task-16-mod-action-tools.md +48 -0
- package/agent/tasks/milestone-5-moderation/task-17-mod-listing-tools.md +47 -0
- package/agent/tasks/milestone-5-moderation/task-18-mod-management-tools.md +42 -0
- package/agent/tasks/milestone-6-advanced-features-and-polish/task-19-multireddit-tools.md +49 -0
- package/agent/tasks/milestone-6-advanced-features-and-polish/task-20-wiki-tools.md +47 -0
- package/agent/tasks/milestone-6-advanced-features-and-polish/task-21-documentation-polish.md +65 -0
- package/agent/tasks/task-1-{title}.template.md +244 -0
- package/dist/auth/oauth.d.ts +15 -0
- package/dist/auth/oauth.d.ts.map +1 -0
- package/dist/client/reddit.d.ts +28 -0
- package/dist/client/reddit.d.ts.map +1 -0
- package/dist/factory.d.ts +2 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +30394 -0
- package/dist/factory.js.map +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31955 -0
- package/dist/index.js.map +7 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +30401 -0
- package/dist/server.js.map +7 -0
- package/dist/tools/listings.d.ts +4 -0
- package/dist/tools/listings.d.ts.map +1 -0
- package/dist/tools/search.d.ts +4 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/transport/http.d.ts +7 -0
- package/dist/transport/http.d.ts.map +1 -0
- package/dist/types/index.d.ts +78 -0
- package/dist/types/index.d.ts.map +1 -0
- package/esbuild.build.js +21 -0
- package/jest.config.js +18 -0
- package/package.json +46 -0
- package/src/auth/oauth.ts +200 -0
- package/src/client/reddit.ts +245 -0
- package/src/factory.ts +5 -0
- package/src/index.ts +31 -0
- package/src/server.ts +36 -0
- package/src/tools/listings.ts +202 -0
- package/src/tools/search.ts +85 -0
- package/src/transport/http.ts +49 -0
- package/src/types/index.ts +83 -0
- package/tests/fixtures/reddit-responses.ts +132 -0
- package/tests/helpers/mock-client.ts +36 -0
- package/tests/unit/auth.test.ts +89 -0
- package/tests/unit/client.test.ts +218 -0
- package/tests/unit/listings.test.ts +113 -0
- package/tests/unit/search.test.ts +59 -0
- package/tests/unit/server.test.ts +14 -0
- package/tsconfig.json +21 -0
|
File without changes
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Task 1: Project Scaffolding
|
|
2
|
+
|
|
3
|
+
**Milestone**: [M1 - Foundation + Listings MVP](../../milestones/milestone-1-foundation-listings-mvp.md)
|
|
4
|
+
**Design Reference**: [Requirements](../../design/requirements.md)
|
|
5
|
+
**Estimated Time**: 2 hours
|
|
6
|
+
**Dependencies**: None
|
|
7
|
+
**Status**: Not Started
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Set up the project directory structure, package.json, TypeScript config, build system, test config, and install all dependencies. Following the youtube-mcp pattern.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Context
|
|
18
|
+
|
|
19
|
+
This task creates the foundation that all subsequent development builds upon. The structure follows the youtube-mcp reference project pattern — ESM TypeScript with esbuild bundling, Jest for tests, and MCP SDK for the server.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Steps
|
|
24
|
+
|
|
25
|
+
### 1. Create package.json
|
|
26
|
+
- Name: `@prmichaelsen/reddit-mcp`
|
|
27
|
+
- Type: `module` (ESM)
|
|
28
|
+
- Exports: `.` → `dist/server.js`, `./factory` → `dist/factory.js`
|
|
29
|
+
- Scripts: build, dev, test, typecheck
|
|
30
|
+
- Dependencies: `@modelcontextprotocol/sdk`, `zod`
|
|
31
|
+
- Dev deps: `typescript`, `jest`, `ts-jest`, `esbuild`, `tsx`
|
|
32
|
+
|
|
33
|
+
### 2. Create tsconfig.json
|
|
34
|
+
- Target: ES2022, Module: Node16
|
|
35
|
+
- Strict mode, declaration generation, source maps
|
|
36
|
+
- Include src/, exclude node_modules, dist, tests
|
|
37
|
+
|
|
38
|
+
### 3. Create esbuild.build.js
|
|
39
|
+
- Entry points: src/index.ts, src/server.ts, src/factory.ts
|
|
40
|
+
- Bundle: true, target: node20, format: esm
|
|
41
|
+
- Generate .d.ts via tsc
|
|
42
|
+
|
|
43
|
+
### 4. Create jest.config.js
|
|
44
|
+
- Preset: ts-jest/presets/default-esm
|
|
45
|
+
- Coverage threshold: 70%
|
|
46
|
+
- Test pattern: tests/**/*.test.ts
|
|
47
|
+
|
|
48
|
+
### 5. Create directory structure
|
|
49
|
+
```
|
|
50
|
+
src/auth/, src/client/, src/tools/, src/transport/, src/types/
|
|
51
|
+
tests/unit/, tests/fixtures/, tests/helpers/
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 6. Create .env.example
|
|
55
|
+
Document all required environment variables.
|
|
56
|
+
|
|
57
|
+
### 7. Create .gitignore
|
|
58
|
+
Add dist/, node_modules/, .env*, .tokens/, coverage/
|
|
59
|
+
|
|
60
|
+
### 8. Install dependencies
|
|
61
|
+
Run `npm install`
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Verification
|
|
66
|
+
|
|
67
|
+
- [ ] `npm install` completes without errors
|
|
68
|
+
- [ ] `npm run build` completes without errors
|
|
69
|
+
- [ ] `npm run typecheck` passes
|
|
70
|
+
- [ ] Directory structure matches specification
|
|
71
|
+
- [ ] package.json has correct exports configuration
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
**Next Task**: [Task 2: Reddit OAuth 2.0](task-2-reddit-oauth.md)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Task 2: Reddit OAuth 2.0
|
|
2
|
+
|
|
3
|
+
**Milestone**: [M1 - Foundation + Listings MVP](../../milestones/milestone-1-foundation-listings-mvp.md)
|
|
4
|
+
**Design Reference**: [Requirements](../../design/requirements.md)
|
|
5
|
+
**Estimated Time**: 3 hours
|
|
6
|
+
**Dependencies**: Task 1
|
|
7
|
+
**Status**: Not Started
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Implement Reddit OAuth 2.0 authentication with authorization code flow, token storage, and automatic token refresh.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Context
|
|
18
|
+
|
|
19
|
+
Reddit requires OAuth 2.0 for API access. Unlike YouTube which uses the googleapis library, Reddit has no official Node.js SDK — we implement OAuth directly with fetch. The auth module must support both direct user auth (for stdio) and raw access token injection (for mcp-auth factory pattern).
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Steps
|
|
24
|
+
|
|
25
|
+
### 1. Create RedditAuth class (src/auth/oauth.ts)
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
export class RedditAuth {
|
|
29
|
+
constructor(config: RedditAuthConfig)
|
|
30
|
+
getAuthUrl(scopes: string[]): string
|
|
31
|
+
exchangeCode(code: string): Promise<TokenData>
|
|
32
|
+
getAccessToken(): Promise<string> // auto-refresh
|
|
33
|
+
hasStoredCredentials(): boolean
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Key behaviors:
|
|
38
|
+
- Authorization URL generation with state parameter
|
|
39
|
+
- Code exchange via POST to `https://www.reddit.com/api/v1/access_token`
|
|
40
|
+
- Basic auth header with client_id:client_secret
|
|
41
|
+
- Token refresh 5 minutes before expiry
|
|
42
|
+
- File-based token storage with 0o600 permissions
|
|
43
|
+
|
|
44
|
+
### 2. Create factory function
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
export function createAuthFromEnv(): RedditAuth
|
|
48
|
+
```
|
|
49
|
+
Reads REDDIT_CLIENT_ID, REDDIT_CLIENT_SECRET, REDDIT_REDIRECT_URI, REDDIT_USER_AGENT, TOKEN_STORAGE_PATH from environment.
|
|
50
|
+
|
|
51
|
+
### 3. Reddit-specific OAuth details
|
|
52
|
+
- Token endpoint: `https://www.reddit.com/api/v1/access_token`
|
|
53
|
+
- Authorization endpoint: `https://www.reddit.com/api/v1/authorize`
|
|
54
|
+
- Use `duration=permanent` for refresh tokens
|
|
55
|
+
- Basic auth header (not body params) for client credentials
|
|
56
|
+
- Reddit returns `expires_in` in seconds (typically 3600)
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Verification
|
|
61
|
+
|
|
62
|
+
- [ ] RedditAuth class created with all methods
|
|
63
|
+
- [ ] Token exchange works with Reddit OAuth endpoint
|
|
64
|
+
- [ ] Token refresh works before expiry
|
|
65
|
+
- [ ] Tokens stored securely (0o600 file permissions)
|
|
66
|
+
- [ ] Factory function reads from environment correctly
|
|
67
|
+
- [ ] Unit tests cover auth flow, refresh, and error cases
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
**Next Task**: [Task 3: Reddit API Client Wrapper](task-3-reddit-api-client.md)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Task 3: Reddit API Client Wrapper
|
|
2
|
+
|
|
3
|
+
**Milestone**: [M1 - Foundation + Listings MVP](../../milestones/milestone-1-foundation-listings-mvp.md)
|
|
4
|
+
**Design Reference**: [Requirements](../../design/requirements.md)
|
|
5
|
+
**Estimated Time**: 3 hours
|
|
6
|
+
**Dependencies**: Task 2
|
|
7
|
+
**Status**: Not Started
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Create a Reddit API HTTP client wrapper with proper headers, rate limit handling, error mapping, and retry logic.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Context
|
|
18
|
+
|
|
19
|
+
Reddit has no official Node.js SDK, so we build a thin HTTP client using fetch. The client must handle Reddit-specific concerns: User-Agent header, OAuth bearer tokens, rate limit headers, and Reddit's JSON response format.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Steps
|
|
24
|
+
|
|
25
|
+
### 1. Create RedditClient class (src/client/reddit.ts)
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
export class RedditClient {
|
|
29
|
+
constructor(auth: RedditAuth | string) // auth object or raw access token
|
|
30
|
+
async get<T>(path: string, params?: Record<string, string>): Promise<T>
|
|
31
|
+
async post<T>(path: string, body: Record<string, string>): Promise<T>
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 2. Base URL and Headers
|
|
36
|
+
- Base URL: `https://oauth.reddit.com`
|
|
37
|
+
- Headers: `Authorization: Bearer {token}`, `User-Agent: {configured agent}`
|
|
38
|
+
- Accept: `application/json`
|
|
39
|
+
|
|
40
|
+
### 3. Rate Limit Handling
|
|
41
|
+
- Parse response headers: `X-Ratelimit-Remaining`, `X-Ratelimit-Reset`, `X-Ratelimit-Used`
|
|
42
|
+
- If remaining < 5, delay before next request
|
|
43
|
+
- On 429 response, wait for reset period
|
|
44
|
+
|
|
45
|
+
### 4. Error Mapping
|
|
46
|
+
- 400 → RedditApiError (bad request, include Reddit's error message)
|
|
47
|
+
- 401 → RedditApiError (unauthorized, token expired)
|
|
48
|
+
- 403 → RedditApiError (forbidden, scope missing or banned)
|
|
49
|
+
- 404 → RedditApiError (not found)
|
|
50
|
+
- 429 → RedditApiError (rate limited, include reset time)
|
|
51
|
+
- 5xx → RedditApiError (server error, retryable)
|
|
52
|
+
|
|
53
|
+
### 5. Retry Logic
|
|
54
|
+
- Max 3 retries for 5xx errors and network failures
|
|
55
|
+
- Exponential backoff: 1s, 2s, 4s
|
|
56
|
+
- No retry for 4xx errors (except 429)
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Verification
|
|
61
|
+
|
|
62
|
+
- [ ] RedditClient created with get/post methods
|
|
63
|
+
- [ ] Proper Authorization and User-Agent headers sent
|
|
64
|
+
- [ ] Rate limit headers parsed and respected
|
|
65
|
+
- [ ] Error mapping works for all status codes
|
|
66
|
+
- [ ] Retry logic works for 5xx errors
|
|
67
|
+
- [ ] Unit tests cover client, errors, and retry
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
**Next Task**: [Task 4: Listing Tools](task-4-listing-tools.md)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Task 4: Listing Tools
|
|
2
|
+
|
|
3
|
+
**Milestone**: [M1 - Foundation + Listings MVP](../../milestones/milestone-1-foundation-listings-mvp.md)
|
|
4
|
+
**Design Reference**: [Requirements](../../design/requirements.md)
|
|
5
|
+
**Estimated Time**: 3 hours
|
|
6
|
+
**Dependencies**: Task 3
|
|
7
|
+
**Status**: Not Started
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Implement the core listing tools that allow browsing Reddit — hot, new, top, rising, controversial, best posts, comment threads, duplicates, and info lookup.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Steps
|
|
18
|
+
|
|
19
|
+
### 1. Create MCP server factory (src/server.ts)
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
export function createServer(auth?: RedditAuth): McpServer
|
|
23
|
+
export function createServerWithToken(accessToken: string): McpServer
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 2. Create src/tools/listings.ts
|
|
27
|
+
|
|
28
|
+
Register 9 tools:
|
|
29
|
+
|
|
30
|
+
| Tool | Endpoint | Parameters |
|
|
31
|
+
|------|----------|------------|
|
|
32
|
+
| `reddit_listings_best` | GET /best | limit, after, before |
|
|
33
|
+
| `reddit_listings_hot` | GET /r/{subreddit}/hot or /hot | subreddit?, limit, after, before |
|
|
34
|
+
| `reddit_listings_new` | GET /r/{subreddit}/new or /new | subreddit?, limit, after, before |
|
|
35
|
+
| `reddit_listings_rising` | GET /r/{subreddit}/rising or /rising | subreddit?, limit, after, before |
|
|
36
|
+
| `reddit_listings_top` | GET /r/{subreddit}/top or /top | subreddit?, t (hour/day/week/month/year/all), limit, after, before |
|
|
37
|
+
| `reddit_listings_controversial` | GET /r/{subreddit}/controversial | subreddit?, t, limit, after, before |
|
|
38
|
+
| `reddit_comments_thread` | GET /r/{subreddit}/comments/{article} | subreddit, article, sort?, limit?, depth? |
|
|
39
|
+
| `reddit_duplicates` | GET /duplicates/{article} | article, limit, after, before |
|
|
40
|
+
| `reddit_info` | GET /api/info | id (fullname, e.g. t3_abc123) |
|
|
41
|
+
|
|
42
|
+
### 3. Tool pattern
|
|
43
|
+
Each tool:
|
|
44
|
+
- Define zod schema for input validation
|
|
45
|
+
- Register via `server.tool(name, description, schema, handler)`
|
|
46
|
+
- Include scope requirement in description
|
|
47
|
+
- Return JSON-serialized API response
|
|
48
|
+
|
|
49
|
+
### 4. Create src/index.ts
|
|
50
|
+
Transport selector: parse --transport flag, default to stdio.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Verification
|
|
55
|
+
|
|
56
|
+
- [ ] All 9 listing tools registered on MCP server
|
|
57
|
+
- [ ] Each tool validates input with zod
|
|
58
|
+
- [ ] Tools correctly build Reddit API URLs
|
|
59
|
+
- [ ] Subreddit parameter is optional for frontpage listings
|
|
60
|
+
- [ ] Comment thread tool supports sort and depth
|
|
61
|
+
- [ ] Unit tests for each tool
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
**Next Task**: [Task 5: Search Tools](task-5-search-tools.md)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Task 5: Search Tools
|
|
2
|
+
|
|
3
|
+
**Milestone**: [M1 - Foundation + Listings MVP](../../milestones/milestone-1-foundation-listings-mvp.md)
|
|
4
|
+
**Design Reference**: [Requirements](../../design/requirements.md)
|
|
5
|
+
**Estimated Time**: 1.5 hours
|
|
6
|
+
**Dependencies**: Task 4
|
|
7
|
+
**Status**: Not Started
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Implement search tools for searching across all of Reddit and within specific subreddits.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Steps
|
|
18
|
+
|
|
19
|
+
### 1. Create src/tools/search.ts
|
|
20
|
+
|
|
21
|
+
Register 2 tools:
|
|
22
|
+
|
|
23
|
+
| Tool | Endpoint | Parameters |
|
|
24
|
+
|------|----------|------------|
|
|
25
|
+
| `reddit_search` | GET /search | q, sort (relevance/hot/top/new/comments), t (time filter), type (link/sr/user), limit, after, before |
|
|
26
|
+
| `reddit_search_subreddit` | GET /r/{subreddit}/search | subreddit, q, restrict_sr=true, sort, t, limit, after, before |
|
|
27
|
+
|
|
28
|
+
### 2. Register in server.ts
|
|
29
|
+
Add search tool registration to the MCP server factory.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Verification
|
|
34
|
+
|
|
35
|
+
- [ ] Both search tools registered
|
|
36
|
+
- [ ] Query parameter (q) is required
|
|
37
|
+
- [ ] Sort and time filter parameters validated
|
|
38
|
+
- [ ] restrict_sr automatically set for subreddit search
|
|
39
|
+
- [ ] Unit tests for search tools
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
**Next Task**: [Task 6: Testing & Verification](task-6-testing-verification.md)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Task 6: Testing & Verification
|
|
2
|
+
|
|
3
|
+
**Milestone**: [M1 - Foundation + Listings MVP](../../milestones/milestone-1-foundation-listings-mvp.md)
|
|
4
|
+
**Design Reference**: [Requirements](../../design/requirements.md)
|
|
5
|
+
**Estimated Time**: 3 hours
|
|
6
|
+
**Dependencies**: Tasks 1-5
|
|
7
|
+
**Status**: Not Started
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Create comprehensive unit tests, mock client, response fixtures, and verify MVP end-to-end.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Steps
|
|
18
|
+
|
|
19
|
+
### 1. Create test helpers (tests/helpers/mock-client.ts)
|
|
20
|
+
Mock RedditClient that returns fixture data without hitting the API.
|
|
21
|
+
|
|
22
|
+
### 2. Create response fixtures (tests/fixtures/reddit-responses.ts)
|
|
23
|
+
Sample Reddit API responses for listings, search, comments, errors.
|
|
24
|
+
|
|
25
|
+
### 3. Create unit test suites
|
|
26
|
+
- tests/unit/auth.test.ts — OAuth flow, token refresh, error cases
|
|
27
|
+
- tests/unit/client.test.ts — HTTP client, error mapping, retry, rate limits
|
|
28
|
+
- tests/unit/server.test.ts — Server creation, tool registration count
|
|
29
|
+
- tests/unit/listings.test.ts — All listing tool definitions and handlers
|
|
30
|
+
- tests/unit/search.test.ts — Search tool definitions and handlers
|
|
31
|
+
|
|
32
|
+
### 4. Verify end-to-end
|
|
33
|
+
- Server creates successfully
|
|
34
|
+
- All 11 tools registered
|
|
35
|
+
- stdio transport starts without errors
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Verification
|
|
40
|
+
|
|
41
|
+
- [ ] All test suites pass
|
|
42
|
+
- [ ] Coverage >= 70% (branches, functions, lines, statements)
|
|
43
|
+
- [ ] Mock client properly simulates Reddit API responses
|
|
44
|
+
- [ ] Error cases tested (401, 403, 429, 5xx)
|
|
45
|
+
- [ ] `npm test` runs cleanly
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
**Next Task**: [Task 7: Post Tools](../milestone-2-content-interaction/task-7-post-tools.md)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Task 7: Post Tools
|
|
2
|
+
|
|
3
|
+
**Milestone**: [M2 - Content Interaction](../../milestones/milestone-2-content-interaction.md)
|
|
4
|
+
**Design Reference**: [Requirements](../../design/requirements.md)
|
|
5
|
+
**Estimated Time**: 3 hours
|
|
6
|
+
**Dependencies**: Task 6
|
|
7
|
+
**Status**: Not Started
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Implement tools for creating, editing, deleting, and managing posts — including hide/unhide, NSFW marking, and spoiler marking.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Steps
|
|
18
|
+
|
|
19
|
+
### 1. Create src/tools/posts.ts
|
|
20
|
+
|
|
21
|
+
Register 9 tools:
|
|
22
|
+
|
|
23
|
+
| Tool | Endpoint | Parameters | Scope |
|
|
24
|
+
|------|----------|------------|-------|
|
|
25
|
+
| `reddit_submit` | POST /api/submit | sr, title, kind (self/link), text/url, nsfw?, spoiler?, flair_id? | submit |
|
|
26
|
+
| `reddit_edit` | POST /api/editusertext | thing_id, text | edit |
|
|
27
|
+
| `reddit_delete` | POST /api/del | id | edit |
|
|
28
|
+
| `reddit_hide` | POST /api/hide | id | report |
|
|
29
|
+
| `reddit_unhide` | POST /api/unhide | id | report |
|
|
30
|
+
| `reddit_mark_nsfw` | POST /api/marknsfw | id | modposts |
|
|
31
|
+
| `reddit_unmark_nsfw` | POST /api/unmarknsfw | id | modposts |
|
|
32
|
+
| `reddit_spoiler` | POST /api/spoiler | id | modposts |
|
|
33
|
+
| `reddit_unspoiler` | POST /api/unspoiler | id | modposts |
|
|
34
|
+
|
|
35
|
+
### 2. Submit tool details
|
|
36
|
+
- Support both self-posts (text) and link posts (url)
|
|
37
|
+
- `kind` parameter: "self" or "link"
|
|
38
|
+
- Optional flair_id for post flair
|
|
39
|
+
- Return the created post's fullname
|
|
40
|
+
|
|
41
|
+
### 3. Register in server.ts
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Verification
|
|
46
|
+
|
|
47
|
+
- [ ] `reddit_submit` creates both self and link posts
|
|
48
|
+
- [ ] `reddit_edit` updates post/comment text
|
|
49
|
+
- [ ] `reddit_delete` removes content
|
|
50
|
+
- [ ] Hide/unhide, NSFW, spoiler toggles work
|
|
51
|
+
- [ ] All tools validate required parameters
|
|
52
|
+
- [ ] Unit tests for each tool
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
**Next Task**: [Task 8: Comment Tools](task-8-comment-tools.md)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Task 8: Comment Tools
|
|
2
|
+
|
|
3
|
+
**Milestone**: [M2 - Content Interaction](../../milestones/milestone-2-content-interaction.md)
|
|
4
|
+
**Design Reference**: [Requirements](../../design/requirements.md)
|
|
5
|
+
**Estimated Time**: 2 hours
|
|
6
|
+
**Dependencies**: Task 7
|
|
7
|
+
**Status**: Not Started
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Implement tools for posting comments/replies and loading collapsed comment threads.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Steps
|
|
18
|
+
|
|
19
|
+
### 1. Create src/tools/comments.ts
|
|
20
|
+
|
|
21
|
+
Register 2 tools:
|
|
22
|
+
|
|
23
|
+
| Tool | Endpoint | Parameters | Scope |
|
|
24
|
+
|------|----------|------------|-------|
|
|
25
|
+
| `reddit_comment` | POST /api/comment | parent (fullname t1_ or t3_), text | submit |
|
|
26
|
+
| `reddit_more_children` | GET /api/morechildren | link_id, children (comma-separated IDs), sort? | read |
|
|
27
|
+
|
|
28
|
+
### 2. Comment tool details
|
|
29
|
+
- `parent` is a fullname: t3_ for posts, t1_ for comments (replies)
|
|
30
|
+
- `text` is markdown-formatted
|
|
31
|
+
- Returns the created comment data
|
|
32
|
+
|
|
33
|
+
### 3. More children details
|
|
34
|
+
- Used to expand "load more comments" stubs
|
|
35
|
+
- `children` is a comma-separated list of comment IDs from the "more" object
|
|
36
|
+
- `link_id` is the parent post's fullname
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Verification
|
|
41
|
+
|
|
42
|
+
- [ ] `reddit_comment` posts top-level comments (parent=t3_)
|
|
43
|
+
- [ ] `reddit_comment` posts replies (parent=t1_)
|
|
44
|
+
- [ ] `reddit_more_children` loads expanded comments
|
|
45
|
+
- [ ] Unit tests cover both tools
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
**Next Task**: [Task 9: Vote, Save & Report Tools](task-9-vote-save-report-tools.md)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Task 9: Vote, Save & Report Tools
|
|
2
|
+
|
|
3
|
+
**Milestone**: [M2 - Content Interaction](../../milestones/milestone-2-content-interaction.md)
|
|
4
|
+
**Design Reference**: [Requirements](../../design/requirements.md)
|
|
5
|
+
**Estimated Time**: 1.5 hours
|
|
6
|
+
**Dependencies**: Task 7
|
|
7
|
+
**Status**: Not Started
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Implement voting, save/unsave, and report tools.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Steps
|
|
18
|
+
|
|
19
|
+
### 1. Create src/tools/voting.ts
|
|
20
|
+
|
|
21
|
+
| Tool | Endpoint | Parameters | Scope |
|
|
22
|
+
|------|----------|------------|-------|
|
|
23
|
+
| `reddit_vote` | POST /api/vote | id (fullname), dir (1=up, 0=unvote, -1=down) | vote |
|
|
24
|
+
|
|
25
|
+
### 2. Create src/tools/save.ts
|
|
26
|
+
|
|
27
|
+
| Tool | Endpoint | Parameters | Scope |
|
|
28
|
+
|------|----------|------------|-------|
|
|
29
|
+
| `reddit_save` | POST /api/save | id, category? | save |
|
|
30
|
+
| `reddit_unsave` | POST /api/unsave | id | save |
|
|
31
|
+
|
|
32
|
+
### 3. Create src/tools/report.ts
|
|
33
|
+
|
|
34
|
+
| Tool | Endpoint | Parameters | Scope |
|
|
35
|
+
|------|----------|------------|-------|
|
|
36
|
+
| `reddit_report` | POST /api/report | thing_id, reason, other_reason? | report |
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Verification
|
|
41
|
+
|
|
42
|
+
- [ ] `reddit_vote` handles upvote (1), downvote (-1), unvote (0)
|
|
43
|
+
- [ ] `reddit_save` and `reddit_unsave` toggle save state
|
|
44
|
+
- [ ] `reddit_report` sends report with reason
|
|
45
|
+
- [ ] All parameters validated with zod
|
|
46
|
+
- [ ] Unit tests for each tool
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
**Next Task**: [Task 10: Account Tools](../milestone-3-users-and-messaging/task-10-account-tools.md)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Task 10: Account Tools
|
|
2
|
+
|
|
3
|
+
**Milestone**: [M3 - Users & Messaging](../../milestones/milestone-3-users-and-messaging.md)
|
|
4
|
+
**Design Reference**: [Requirements](../../design/requirements.md)
|
|
5
|
+
**Estimated Time**: 2 hours
|
|
6
|
+
**Dependencies**: Task 6
|
|
7
|
+
**Status**: Not Started
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Implement tools for viewing and managing the authenticated user's account — info, karma, preferences, trophies, friends, and blocked users.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Steps
|
|
18
|
+
|
|
19
|
+
### 1. Create src/tools/account.ts
|
|
20
|
+
|
|
21
|
+
Register 7 tools:
|
|
22
|
+
|
|
23
|
+
| Tool | Endpoint | Parameters | Scope |
|
|
24
|
+
|------|----------|------------|-------|
|
|
25
|
+
| `reddit_me` | GET /api/v1/me | — | identity |
|
|
26
|
+
| `reddit_me_karma` | GET /api/v1/me/karma | — | mysubreddits |
|
|
27
|
+
| `reddit_me_prefs` | GET /api/v1/me/prefs | — | identity |
|
|
28
|
+
| `reddit_me_prefs_update` | PATCH /api/v1/me/prefs | prefs (JSON object) | account |
|
|
29
|
+
| `reddit_me_trophies` | GET /api/v1/me/trophies | — | identity |
|
|
30
|
+
| `reddit_me_friends` | GET /prefs/friends | — | mysubreddits |
|
|
31
|
+
| `reddit_me_blocked` | GET /prefs/blocked | — | mysubreddits |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Verification
|
|
36
|
+
|
|
37
|
+
- [ ] `reddit_me` returns user profile data
|
|
38
|
+
- [ ] `reddit_me_karma` returns subreddit karma breakdown
|
|
39
|
+
- [ ] `reddit_me_prefs_update` accepts and applies preference changes
|
|
40
|
+
- [ ] Unit tests for each tool
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
**Next Task**: [Task 11: User Profile Tools](task-11-user-profile-tools.md)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Task 11: User Profile Tools
|
|
2
|
+
|
|
3
|
+
**Milestone**: [M3 - Users & Messaging](../../milestones/milestone-3-users-and-messaging.md)
|
|
4
|
+
**Design Reference**: [Requirements](../../design/requirements.md)
|
|
5
|
+
**Estimated Time**: 2.5 hours
|
|
6
|
+
**Dependencies**: Task 6
|
|
7
|
+
**Status**: Not Started
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Implement tools for viewing other users' profiles, post/comment history, saved items, votes, trophies, and blocking users.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Steps
|
|
18
|
+
|
|
19
|
+
### 1. Create src/tools/users.ts
|
|
20
|
+
|
|
21
|
+
Register 9 tools:
|
|
22
|
+
|
|
23
|
+
| Tool | Endpoint | Parameters | Scope |
|
|
24
|
+
|------|----------|------------|-------|
|
|
25
|
+
| `reddit_user_about` | GET /user/{username}/about | username | read |
|
|
26
|
+
| `reddit_user_overview` | GET /user/{username}/overview | username, sort?, t?, limit, after, before | history |
|
|
27
|
+
| `reddit_user_submitted` | GET /user/{username}/submitted | username, sort?, t?, limit, after, before | history |
|
|
28
|
+
| `reddit_user_comments` | GET /user/{username}/comments | username, sort?, t?, limit, after, before | history |
|
|
29
|
+
| `reddit_user_saved` | GET /user/{username}/saved | username, sort?, t?, limit, after, before | history |
|
|
30
|
+
| `reddit_user_upvoted` | GET /user/{username}/upvoted | username, sort?, t?, limit, after, before | history |
|
|
31
|
+
| `reddit_user_downvoted` | GET /user/{username}/downvoted | username, sort?, t?, limit, after, before | history |
|
|
32
|
+
| `reddit_user_trophies` | GET /api/v1/user/{username}/trophies | username | read |
|
|
33
|
+
| `reddit_block_user` | POST /api/block_user | name | account |
|
|
34
|
+
|
|
35
|
+
### 2. Listing parameters pattern
|
|
36
|
+
All user listing endpoints share: sort (hot/new/top/controversial), t (time filter), limit, after, before. Create a shared zod schema for these.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Verification
|
|
41
|
+
|
|
42
|
+
- [ ] `reddit_user_about` returns public profile info
|
|
43
|
+
- [ ] User listing tools return paginated results
|
|
44
|
+
- [ ] `reddit_block_user` blocks a user
|
|
45
|
+
- [ ] Shared listing parameters work correctly
|
|
46
|
+
- [ ] Unit tests for each tool
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
**Next Task**: [Task 12: Private Message Tools](task-12-private-message-tools.md)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Task 12: Private Message Tools
|
|
2
|
+
|
|
3
|
+
**Milestone**: [M3 - Users & Messaging](../../milestones/milestone-3-users-and-messaging.md)
|
|
4
|
+
**Design Reference**: [Requirements](../../design/requirements.md)
|
|
5
|
+
**Estimated Time**: 2 hours
|
|
6
|
+
**Dependencies**: Task 6
|
|
7
|
+
**Status**: Not Started
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Implement tools for reading, sending, and managing private messages.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Steps
|
|
18
|
+
|
|
19
|
+
### 1. Create src/tools/messages.ts
|
|
20
|
+
|
|
21
|
+
Register 7 tools:
|
|
22
|
+
|
|
23
|
+
| Tool | Endpoint | Parameters | Scope |
|
|
24
|
+
|------|----------|------------|-------|
|
|
25
|
+
| `reddit_inbox` | GET /message/inbox | limit, after, before | privatemessages |
|
|
26
|
+
| `reddit_unread` | GET /message/unread | limit, after, before | privatemessages |
|
|
27
|
+
| `reddit_sent` | GET /message/sent | limit, after, before | privatemessages |
|
|
28
|
+
| `reddit_compose` | POST /api/compose | to, subject, text | privatemessages |
|
|
29
|
+
| `reddit_read_message` | POST /api/read_message | id | privatemessages |
|
|
30
|
+
| `reddit_unread_message` | POST /api/unread_message | id | privatemessages |
|
|
31
|
+
| `reddit_del_msg` | POST /api/del_msg | id | privatemessages |
|
|
32
|
+
|
|
33
|
+
### 2. Compose details
|
|
34
|
+
- `to` is a username (without /u/ prefix)
|
|
35
|
+
- `subject` is required
|
|
36
|
+
- `text` is markdown-formatted body
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Verification
|
|
41
|
+
|
|
42
|
+
- [ ] `reddit_inbox` returns inbox messages
|
|
43
|
+
- [ ] `reddit_compose` sends a private message
|
|
44
|
+
- [ ] `reddit_read_message` marks message as read
|
|
45
|
+
- [ ] `reddit_del_msg` deletes a message
|
|
46
|
+
- [ ] Unit tests for each tool
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
**Next Task**: [Task 13: Subreddit Tools](../milestone-4-subreddits-and-flair/task-13-subreddit-tools.md)
|