tokens-for-good 0.1.8 → 0.2.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/package.json +1 -1
- package/src/api-client.js +4 -0
- package/src/mcp-server.js +31 -2
package/package.json
CHANGED
package/src/api-client.js
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.
|
|
29
|
+
version: '0.2.0',
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
// --- No-key onboarding message ---
|
|
@@ -42,6 +42,8 @@ Walk them through setup:
|
|
|
42
42
|
3. **Add the key to their MCP config:** Update their tokens-for-good MCP configuration to include the key as an environment variable:
|
|
43
43
|
|
|
44
44
|
For Claude Code (create \`.mcp.json\` in your project root or home directory):
|
|
45
|
+
|
|
46
|
+
Mac/Linux:
|
|
45
47
|
\`\`\`json
|
|
46
48
|
{
|
|
47
49
|
"mcpServers": {
|
|
@@ -54,6 +56,19 @@ For Claude Code (create \`.mcp.json\` in your project root or home directory):
|
|
|
54
56
|
}
|
|
55
57
|
\`\`\`
|
|
56
58
|
|
|
59
|
+
Windows:
|
|
60
|
+
\`\`\`json
|
|
61
|
+
{
|
|
62
|
+
"mcpServers": {
|
|
63
|
+
"tokens-for-good": {
|
|
64
|
+
"command": "cmd",
|
|
65
|
+
"args": ["/c", "npx", "-y", "tokens-for-good", "--mcp"],
|
|
66
|
+
"env": { "TFG_API_KEY": "tfg_live_their_key_here" }
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
\`\`\`
|
|
71
|
+
|
|
57
72
|
For Opencode (opencode.json):
|
|
58
73
|
\`\`\`json
|
|
59
74
|
{
|
|
@@ -129,7 +144,21 @@ Cost: ~$0.15-0.25 per org in tokens. Scale: 750K+ US nonprofits to research.`,
|
|
|
129
144
|
|
|
130
145
|
// --- Tools ---
|
|
131
146
|
|
|
132
|
-
server.tool('
|
|
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.', {
|
|
133
162
|
platform: z.string().optional().describe('Your platform (claude-code, opencode, cursor, windsurf, devin)'),
|
|
134
163
|
}, async ({ platform: plat }) => {
|
|
135
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' }] };
|