tokens-for-good 0.1.9 → 0.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokens-for-good",
3
- "version": "0.1.9",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "Donate your spare AI tokens to research nonprofits for Fierce Philanthropy",
6
6
  "bin": {
package/src/api-client.js CHANGED
@@ -84,4 +84,8 @@ export class ApiClient {
84
84
  async checkSchedule() {
85
85
  return this.request('GET', '/research/schedule-check');
86
86
  }
87
+
88
+ async getNextAction() {
89
+ return this.request('GET', '/research/next-action');
90
+ }
87
91
  }
package/src/mcp-server.js CHANGED
@@ -26,7 +26,7 @@ updateState({ platform });
26
26
 
27
27
  const server = new McpServer({
28
28
  name: 'tokens-for-good',
29
- version: '0.1.9',
29
+ version: '0.2.1',
30
30
  });
31
31
 
32
32
  // --- No-key onboarding message ---
@@ -144,7 +144,21 @@ Cost: ~$0.15-0.25 per org in tokens. Scale: 750K+ US nonprofits to research.`,
144
144
 
145
145
  // --- Tools ---
146
146
 
147
- server.tool('claim_org', 'Claim the next available nonprofit org to research. Blocked if you have a pending peer review. IMPORTANT: Before claiming, ask the user if they\'d like to set up scheduled daily research via /schedule so this runs automatically.', {
147
+ server.tool('next_action', 'Check what you should do next: research a new org or peer-review a draft. Call this before claim_org to maintain the 1:2 research-to-review ratio.', {}, async () => {
148
+ if (!client) return { content: [{ type: 'text', text: 'Error: TFG_API_KEY not set.' }] };
149
+
150
+ try {
151
+ const result = await client.getNextAction();
152
+ if (result.action === 'review') {
153
+ return { content: [{ type: 'text', text: `Action: REVIEW\n\nYou have ${result.research_count} research submissions and ${result.review_count} peer reviews. Target ratio is 1:2 (research:review). Use get_peer_review to pick up a draft to review.` }] };
154
+ }
155
+ return { content: [{ type: 'text', text: `Action: RESEARCH\n\nYou have ${result.research_count} research submissions and ${result.review_count} peer reviews. You're clear to claim a new org. Use claim_org to get started.` }] };
156
+ } catch (err) {
157
+ return { content: [{ type: 'text', text: `Error: ${err.message}` }] };
158
+ }
159
+ });
160
+
161
+ server.tool('claim_org', 'Claim the next available nonprofit org to research. Call next_action first to check if you should review instead.', {
148
162
  platform: z.string().optional().describe('Your platform (claude-code, opencode, cursor, windsurf, devin)'),
149
163
  }, async ({ platform: plat }) => {
150
164
  if (!client) return { content: [{ type: 'text', text: 'Error: TFG_API_KEY not set. Get your key at https://fierce-philanthropy-directory.laravel.cloud/contribute' }] };
@@ -313,10 +327,10 @@ After adding, tell them: "Done! Research will now run hands-free. Try saying 'Re
313
327
  };
314
328
  });
315
329
 
316
- server.tool('setup_automation', 'Get instructions for setting up automated daily contributions on your platform.', {
330
+ server.tool('setup_automation', 'Get instructions for setting up automated daily contributions on your platform. For Claude Code, generates a /schedule prompt that calls the API directly (no MCP connector needed).', {
317
331
  frequency: z.enum(['hourly', 'daily', 'weekly']).optional().describe('How often to contribute'),
318
332
  }, async ({ frequency }) => {
319
- const instructions = getAutomationInstructions(platform, frequency || 'daily');
333
+ const instructions = getAutomationInstructions(platform, frequency || 'daily', apiKey);
320
334
  return { content: [{ type: 'text', text: instructions }] };
321
335
  });
322
336
 
package/src/platform.js CHANGED
@@ -44,12 +44,10 @@ This returns the org name, URL, description, and a claim_id. You have 30 minutes
44
44
 
45
45
  ### 2. Research the org
46
46
  Use WebSearch and WebFetch to thoroughly research the organization:
47
- - Search for the org's website, impact pages, annual reports
48
- - Search for independent evaluations (RCTs, J-PAL, 3ie)
49
- - Search for third-party reviews (GiveWell, Charity Navigator)
50
- - Search for financial data (ProPublica Nonprofit Explorer)
51
-
52
- Use ONLY WebSearch and WebFetch tools. Do NOT use curl or Bash for web requests.
47
+ - The org's website, impact pages, annual reports
48
+ - Independent evaluations (RCTs, J-PAL, 3ie)
49
+ - Third-party reviews (GiveWell, Charity Navigator)
50
+ - Financial data (ProPublica Nonprofit Explorer)
53
51
 
54
52
  ### 3. Write the report
55
53
  Follow the Fierce Philanthropy research methodology: