tokens-for-good 0.1.3 → 0.1.4
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/mcp-server.js +39 -10
package/package.json
CHANGED
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.
|
|
29
|
+
version: '0.1.4',
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
// --- No-key onboarding message ---
|
|
@@ -86,13 +86,7 @@ For Cursor (\`.cursor/mcp.json\` in your project root):
|
|
|
86
86
|
|
|
87
87
|
5. **Verify it loaded** by running \`/mcp\` — you should see \`tokens-for-good\` in the server list.
|
|
88
88
|
|
|
89
|
-
6. **
|
|
90
|
-
|
|
91
|
-
\`\`\`
|
|
92
|
-
/permissions
|
|
93
|
-
\`\`\`
|
|
94
|
-
|
|
95
|
-
Then add \`WebFetch\` and \`WebSearch\` to the allow list. Without this, every web request will pause for approval and the research won't complete unattended.
|
|
89
|
+
6. **Set up permissions for hands-free research:** After restarting, use the \`check_permissions\` tool to verify WebFetch and WebSearch are in the allowlist, and offer to add them if not. Without these permissions, every web request will pause for approval and the research won't complete unattended.
|
|
96
90
|
|
|
97
91
|
Once set up, they can say "Research an org for Fierce Philanthropy" and the AI does the rest. Each org takes ~5 minutes and costs ~$0.20 in tokens.
|
|
98
92
|
|
|
@@ -268,6 +262,36 @@ server.tool('setup_guide', 'Get setup instructions for Tokens for Good. Use this
|
|
|
268
262
|
return { content: [{ type: 'text', text: NO_KEY_INSTRUCTIONS }] };
|
|
269
263
|
});
|
|
270
264
|
|
|
265
|
+
server.tool('check_permissions', 'Check if WebFetch and WebSearch are in the tool allowlist. If not, offer to add them. Call this after setup or before first research run.', {}, async () => {
|
|
266
|
+
// We can't read the settings file directly, but we can tell the AI what to do
|
|
267
|
+
return {
|
|
268
|
+
content: [{ type: 'text', text: `Check if this user's Claude Code has WebFetch and WebSearch in their tool allowlist. To do this:
|
|
269
|
+
|
|
270
|
+
1. Read the file ~/.claude/settings.json
|
|
271
|
+
2. Look for the "permissions.allow" array
|
|
272
|
+
3. Check if it contains "WebFetch" and "WebSearch"
|
|
273
|
+
|
|
274
|
+
If BOTH are already present, tell the user they're all set for hands-free research.
|
|
275
|
+
|
|
276
|
+
If one or both are MISSING, explain:
|
|
277
|
+
"Tokens for Good needs WebFetch and WebSearch permissions to research nonprofits without pausing for approval on every web request. Can I add them to your allowlist?"
|
|
278
|
+
|
|
279
|
+
If they agree, edit ~/.claude/settings.json to add the missing entries to the "permissions.allow" array. For example:
|
|
280
|
+
{
|
|
281
|
+
"permissions": {
|
|
282
|
+
"allow": [
|
|
283
|
+
"WebFetch",
|
|
284
|
+
"WebSearch"
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
Merge with any existing entries — don't overwrite other allowed tools.
|
|
290
|
+
|
|
291
|
+
After adding, tell them: "Done! Research will now run hands-free. Try saying 'Research an org for Fierce Philanthropy' to get started."` }],
|
|
292
|
+
};
|
|
293
|
+
});
|
|
294
|
+
|
|
271
295
|
server.tool('setup_automation', 'Get instructions for setting up automated daily contributions on your platform.', {
|
|
272
296
|
frequency: z.enum(['hourly', 'daily', 'weekly']).optional().describe('How often to contribute'),
|
|
273
297
|
}, async ({ frequency }) => {
|
|
@@ -328,19 +352,24 @@ server.prompt('session_start', 'Check if you should research an org or complete
|
|
|
328
352
|
return { messages: [{ role: 'user', content: { type: 'text', text: 'Tokens for Good: You already contributed today. Nice work!' } }] };
|
|
329
353
|
}
|
|
330
354
|
|
|
355
|
+
// Check permissions before first research
|
|
356
|
+
const permNote = state.total_session_contributions === 0
|
|
357
|
+
? `\n\n**First time?** Before researching, use the \`check_permissions\` tool to make sure WebFetch and WebSearch are allowed — otherwise you'll get prompted for every web request.`
|
|
358
|
+
: '';
|
|
359
|
+
|
|
331
360
|
// Show the session start prompt
|
|
332
361
|
if (isSchedulable(platform)) {
|
|
333
362
|
return {
|
|
334
363
|
messages: [{
|
|
335
364
|
role: 'user',
|
|
336
|
-
content: { type: 'text', text: `Tokens for Good: Would you like to donate your spare tokens to research a nonprofit today?\n\n1. Set up automatic daily contributions (recommended)\n2. Just run one now\n3. Ask me tomorrow\n4. Ask me in a week\n\nUse setup_automation for option 1, claim_org for option 2
|
|
365
|
+
content: { type: 'text', text: `Tokens for Good: Would you like to donate your spare tokens to research a nonprofit today?\n\n1. Set up automatic daily contributions (recommended)\n2. Just run one now\n3. Ask me tomorrow\n4. Ask me in a week\n\nUse setup_automation for option 1, claim_org for option 2.${permNote}` },
|
|
337
366
|
}],
|
|
338
367
|
};
|
|
339
368
|
} else {
|
|
340
369
|
return {
|
|
341
370
|
messages: [{
|
|
342
371
|
role: 'user',
|
|
343
|
-
content: { type: 'text', text: `Tokens for Good: Would you like to research a nonprofit org today? It takes about 5 minutes and costs ~$0.20 in tokens.\n\n1. Research an org now\n2. Ask me tomorrow\n3. Ask me in a week\n\nUse claim_org for option 1
|
|
372
|
+
content: { type: 'text', text: `Tokens for Good: Would you like to research a nonprofit org today? It takes about 5 minutes and costs ~$0.20 in tokens.\n\n1. Research an org now\n2. Ask me tomorrow\n3. Ask me in a week\n\nUse claim_org for option 1.${permNote}` },
|
|
344
373
|
}],
|
|
345
374
|
};
|
|
346
375
|
}
|