tokens-for-good 0.3.1 → 0.3.2
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 +1 -1
- package/src/api-client.js +4 -4
- package/src/mcp-server.js +7 -15
package/package.json
CHANGED
package/src/api-client.js
CHANGED
|
@@ -85,11 +85,11 @@ export class ApiClient {
|
|
|
85
85
|
return this.request('GET', '/research/impact');
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
async checkSchedule() {
|
|
89
|
-
return this.request('GET', '/research/schedule-check');
|
|
90
|
-
}
|
|
91
|
-
|
|
92
88
|
async getNextAction() {
|
|
93
89
|
return this.request('GET', '/research/next-action');
|
|
94
90
|
}
|
|
91
|
+
|
|
92
|
+
async enableSchedule() {
|
|
93
|
+
return this.request('POST', '/research/enable-schedule');
|
|
94
|
+
}
|
|
95
95
|
}
|
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.3.
|
|
29
|
+
version: '0.3.2',
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
// --- No-key onboarding message ---
|
|
@@ -335,7 +335,7 @@ server.tool('check_permissions', 'Check if permissions and hooks are set up for
|
|
|
335
335
|
"hooks": [
|
|
336
336
|
{
|
|
337
337
|
"type": "command",
|
|
338
|
-
"command": "result=$(curl -sf \\"https://fierce-philanthropy-directory.laravel.cloud/api/research/schedule-status
|
|
338
|
+
"command": "result=$(curl -sf -H \\"X-TFG-Api-Key: $TFG_API_KEY\\" \\"https://fierce-philanthropy-directory.laravel.cloud/api/research/schedule-status\\" 2>/dev/null) && echo \\"$result\\" | grep -q '\\"scheduled\\":false' && echo 'Tokens for Good: You have not set up scheduled daily research yet. Say \\"set up automation\\" to enable perpetual daily contributions via /schedule.' || true"
|
|
339
339
|
}
|
|
340
340
|
]
|
|
341
341
|
}
|
|
@@ -352,6 +352,11 @@ After setting up both, tell the user: "Done! Permissions and schedule reminder a
|
|
|
352
352
|
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).', {
|
|
353
353
|
frequency: z.enum(['hourly', 'daily', 'weekly']).optional().describe('How often to contribute'),
|
|
354
354
|
}, async ({ frequency }) => {
|
|
355
|
+
// Mark as auto-scheduled locally and on server
|
|
356
|
+
updateState({ auto_schedule: true });
|
|
357
|
+
if (client) {
|
|
358
|
+
try { await client.enableSchedule(); } catch { /* best effort */ }
|
|
359
|
+
}
|
|
355
360
|
const instructions = getAutomationInstructions(platform, frequency || 'daily', apiKey);
|
|
356
361
|
return { content: [{ type: 'text', text: instructions }] };
|
|
357
362
|
});
|
|
@@ -378,19 +383,6 @@ server.prompt('session_start', 'Check if you should research an org or complete
|
|
|
378
383
|
|
|
379
384
|
const state = loadState();
|
|
380
385
|
|
|
381
|
-
// Check for pending peer review first
|
|
382
|
-
try {
|
|
383
|
-
const review = await client.getNextPeerReview();
|
|
384
|
-
return {
|
|
385
|
-
messages: [{
|
|
386
|
-
role: 'user',
|
|
387
|
-
content: { type: 'text', text: `You have a pending peer review to complete before you can claim a new org. Use get_peer_review to see the report, then submit_peer_review with your score.` },
|
|
388
|
-
}],
|
|
389
|
-
};
|
|
390
|
-
} catch {
|
|
391
|
-
// No pending review, continue
|
|
392
|
-
}
|
|
393
|
-
|
|
394
386
|
if (isSnoozed()) {
|
|
395
387
|
return { messages: [{ role: 'user', content: { type: 'text', text: 'Tokens for Good is snoozed. No action needed.' } }] };
|
|
396
388
|
}
|