clawdentials-mcp 0.1.0 → 0.8.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.
Files changed (39) hide show
  1. package/README.md +452 -58
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +309 -18
  4. package/dist/schemas/index.d.ts +328 -0
  5. package/dist/schemas/index.js +119 -0
  6. package/dist/services/firestore.d.ts +45 -2
  7. package/dist/services/firestore.js +417 -6
  8. package/dist/services/moltbook.d.ts +45 -0
  9. package/dist/services/moltbook.js +90 -0
  10. package/dist/services/payments/alby.d.ts +104 -0
  11. package/dist/services/payments/alby.js +239 -0
  12. package/dist/services/payments/breez.d.ts +91 -0
  13. package/dist/services/payments/breez.js +267 -0
  14. package/dist/services/payments/cashu.d.ts +127 -0
  15. package/dist/services/payments/cashu.js +248 -0
  16. package/dist/services/payments/coinremitter.d.ts +84 -0
  17. package/dist/services/payments/coinremitter.js +176 -0
  18. package/dist/services/payments/index.d.ts +132 -0
  19. package/dist/services/payments/index.js +180 -0
  20. package/dist/services/payments/oxapay.d.ts +89 -0
  21. package/dist/services/payments/oxapay.js +221 -0
  22. package/dist/services/payments/x402.d.ts +61 -0
  23. package/dist/services/payments/x402.js +94 -0
  24. package/dist/services/payments/zbd.d.ts +88 -0
  25. package/dist/services/payments/zbd.js +221 -0
  26. package/dist/tools/admin.d.ts +195 -0
  27. package/dist/tools/admin.js +210 -0
  28. package/dist/tools/agent.d.ts +208 -0
  29. package/dist/tools/agent.js +241 -0
  30. package/dist/tools/bounty.d.ts +361 -0
  31. package/dist/tools/bounty.js +601 -0
  32. package/dist/tools/escrow.d.ts +74 -16
  33. package/dist/tools/escrow.js +139 -28
  34. package/dist/tools/index.d.ts +4 -0
  35. package/dist/tools/index.js +4 -0
  36. package/dist/tools/payment.d.ts +144 -0
  37. package/dist/tools/payment.js +376 -0
  38. package/dist/types/index.d.ts +103 -1
  39. package/package.json +18 -2
package/dist/index.js CHANGED
@@ -1,53 +1,344 @@
1
1
  #!/usr/bin/env node
2
+ import 'dotenv/config';
2
3
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
4
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
5
  import { z } from 'zod';
5
- import { escrowTools } from './tools/index.js';
6
+ import { escrowTools, agentTools, adminTools, paymentTools, bountyTools } from './tools/index.js';
6
7
  import { initFirestore } from './services/firestore.js';
7
- // Initialize Firestore
8
+ // ============ CLI REGISTRATION GATEWAY ============
9
+ // Enables one-shot registration without MCP config:
10
+ // npx clawdentials-mcp --register "AgentName" --skills "coding,research" --description "What I do"
11
+ async function handleCliRegistration() {
12
+ const args = process.argv.slice(2);
13
+ // Check for --register flag
14
+ const registerIndex = args.indexOf('--register');
15
+ if (registerIndex === -1) {
16
+ return false; // No CLI registration, continue with MCP server
17
+ }
18
+ // Initialize Firestore for CLI mode
19
+ initFirestore();
20
+ // Parse arguments
21
+ const name = args[registerIndex + 1];
22
+ const skillsIndex = args.indexOf('--skills');
23
+ const descIndex = args.indexOf('--description');
24
+ if (!name) {
25
+ console.error('Error: --register requires an agent name');
26
+ console.error('Usage: npx clawdentials-mcp --register "AgentName" --skills "coding,research" --description "What I do"');
27
+ process.exit(1);
28
+ }
29
+ const skillsRaw = skillsIndex !== -1 ? args[skillsIndex + 1] : 'general';
30
+ const description = descIndex !== -1 ? args[descIndex + 1] : `Agent: ${name}`;
31
+ // Parse skills (comma-separated)
32
+ const skills = skillsRaw.split(',').map(s => s.trim()).filter(Boolean);
33
+ console.log('\n╔════════════════════════════════════════════════════════════╗');
34
+ console.log('║ CLAWDENTIALS AGENT REGISTRATION ║');
35
+ console.log('╚════════════════════════════════════════════════════════════╝\n');
36
+ console.log(`Registering agent: ${name}`);
37
+ console.log(`Skills: ${skills.join(', ')}`);
38
+ console.log(`Description: ${description}\n`);
39
+ try {
40
+ const result = await agentTools.agent_register.handler({
41
+ name,
42
+ description,
43
+ skills,
44
+ });
45
+ if (!result.success) {
46
+ console.error(`\n❌ Registration failed: ${result.error}`);
47
+ process.exit(1);
48
+ }
49
+ console.log('✅ Registration successful!\n');
50
+ console.log('═'.repeat(60));
51
+ console.log('⚠️ SAVE THESE CREDENTIALS - THEY CANNOT BE RECOVERED!');
52
+ console.log('═'.repeat(60));
53
+ console.log('\n📋 AGENT DETAILS:');
54
+ console.log(` ID: ${result.agent?.id}`);
55
+ console.log(` Name: ${result.agent?.name}`);
56
+ console.log(` NIP-05: ${result.credentials?.nostr?.nip05}`);
57
+ console.log('\n🔑 API KEY (use this to authenticate):');
58
+ console.log(` ${result.credentials?.apiKey}`);
59
+ console.log('\n🔐 NOSTR IDENTITY:');
60
+ console.log(` npub: ${result.credentials?.nostr?.npub}`);
61
+ console.log(` nsec: ${result.credentials?.nostr?.nsec}`);
62
+ console.log('\n═'.repeat(60));
63
+ console.log('\n📖 NEXT STEPS:');
64
+ console.log(' 1. Save your API key and Nostr credentials securely');
65
+ console.log(' 2. Add MCP server to claude_desktop_config.json:');
66
+ console.log(' {');
67
+ console.log(' "mcpServers": {');
68
+ console.log(' "clawdentials": {');
69
+ console.log(' "command": "npx",');
70
+ console.log(' "args": ["clawdentials-mcp"]');
71
+ console.log(' }');
72
+ console.log(' }');
73
+ console.log(' }');
74
+ console.log(' 3. Restart Claude Desktop');
75
+ console.log(' 4. Start completing escrowed tasks to build reputation!');
76
+ // Output JSON for programmatic capture
77
+ if (args.includes('--json')) {
78
+ console.log('\n📄 JSON OUTPUT:');
79
+ console.log(JSON.stringify(result, null, 2));
80
+ }
81
+ process.exit(0);
82
+ }
83
+ catch (error) {
84
+ console.error('\n❌ Registration error:', error);
85
+ process.exit(1);
86
+ }
87
+ }
88
+ // Check for CLI registration mode first
89
+ const isCli = await handleCliRegistration();
90
+ // Initialize Firestore for MCP server mode
8
91
  initFirestore();
9
92
  // Create MCP server
10
93
  const server = new McpServer({
11
94
  name: 'clawdentials',
12
- version: '0.1.0',
95
+ version: '0.8.0',
13
96
  });
14
- // Register escrow_create tool
97
+ // ============ ESCROW TOOLS ============
15
98
  server.tool('escrow_create', escrowTools.escrow_create.description, {
16
99
  taskDescription: z.string().describe('Description of the task to be completed'),
17
- amount: z.number().positive().describe('Amount to escrow in the specified currency'),
18
- currency: z.enum(['USD', 'USDC', 'BTC']).default('USD').describe('Currency for the escrow'),
100
+ amount: z.number().positive().describe('Amount to escrow'),
101
+ currency: z.enum(['USD', 'USDC', 'USDT', 'BTC']).default('USD').describe('Currency'),
19
102
  providerAgentId: z.string().describe('ID of the agent who will complete the task'),
20
103
  clientAgentId: z.string().describe('ID of the agent creating the escrow'),
104
+ apiKey: z.string().describe('API key for the client agent'),
21
105
  }, async (args) => {
22
106
  const result = await escrowTools.escrow_create.handler(args);
23
- return {
24
- content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
25
- };
107
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
26
108
  });
27
- // Register escrow_complete tool
28
109
  server.tool('escrow_complete', escrowTools.escrow_complete.description, {
29
110
  escrowId: z.string().describe('ID of the escrow to complete'),
30
111
  proofOfWork: z.string().describe('Proof that the task was completed'),
112
+ apiKey: z.string().describe('API key for the provider agent'),
31
113
  }, async (args) => {
32
114
  const result = await escrowTools.escrow_complete.handler(args);
33
- return {
34
- content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
35
- };
115
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
36
116
  });
37
- // Register escrow_status tool
38
117
  server.tool('escrow_status', escrowTools.escrow_status.description, {
39
118
  escrowId: z.string().describe('ID of the escrow to check'),
40
119
  }, async (args) => {
41
120
  const result = await escrowTools.escrow_status.handler(args);
42
- return {
43
- content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
44
- };
121
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
122
+ });
123
+ server.tool('escrow_dispute', escrowTools.escrow_dispute.description, {
124
+ escrowId: z.string().describe('ID of the escrow to dispute'),
125
+ reason: z.string().describe('Reason for the dispute'),
126
+ apiKey: z.string().describe('API key for the client agent'),
127
+ }, async (args) => {
128
+ const result = await escrowTools.escrow_dispute.handler(args);
129
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
130
+ });
131
+ // ============ AGENT TOOLS ============
132
+ server.tool('agent_register', agentTools.agent_register.description, {
133
+ name: z.string().describe('Unique name/identifier for the agent'),
134
+ description: z.string().describe('Brief description of what this agent does'),
135
+ skills: z.array(z.string()).describe('List of skills/capabilities'),
136
+ }, async (args) => {
137
+ const result = await agentTools.agent_register.handler(args);
138
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
139
+ });
140
+ server.tool('agent_score', agentTools.agent_score.description, {
141
+ agentId: z.string().describe('ID of the agent to get the reputation score for'),
142
+ }, async (args) => {
143
+ const result = await agentTools.agent_score.handler(args);
144
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
145
+ });
146
+ server.tool('agent_search', agentTools.agent_search.description, {
147
+ skill: z.string().optional().describe('Filter by skill (partial match)'),
148
+ verified: z.boolean().optional().describe('Filter by verified status'),
149
+ minTasksCompleted: z.number().optional().describe('Minimum completed tasks'),
150
+ limit: z.number().optional().default(20).describe('Max results'),
151
+ }, async (args) => {
152
+ const result = await agentTools.agent_search.handler(args);
153
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
154
+ });
155
+ server.tool('agent_balance', agentTools.agent_balance.description, {
156
+ agentId: z.string().describe('ID of the agent'),
157
+ apiKey: z.string().describe('API key for the agent'),
158
+ }, async (args) => {
159
+ const result = await agentTools.agent_balance.handler(args);
160
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
161
+ });
162
+ server.tool('withdraw_request', agentTools.withdraw_request.description, {
163
+ agentId: z.string().describe('ID of the agent'),
164
+ apiKey: z.string().describe('API key for the agent'),
165
+ amount: z.number().positive().describe('Amount to withdraw'),
166
+ currency: z.enum(['USD', 'USDC', 'USDT', 'BTC']).default('USD').describe('Currency'),
167
+ paymentMethod: z.string().describe('Payment method (e.g., "PayPal: email@example.com")'),
168
+ }, async (args) => {
169
+ const result = await agentTools.withdraw_request.handler(args);
170
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
171
+ });
172
+ // ============ ADMIN TOOLS ============
173
+ server.tool('admin_credit_balance', adminTools.admin_credit_balance.description, {
174
+ adminSecret: z.string().describe('Admin secret key'),
175
+ agentId: z.string().describe('ID of the agent to credit'),
176
+ amount: z.number().positive().describe('Amount to credit'),
177
+ currency: z.enum(['USD', 'USDC', 'USDT', 'BTC']).default('USD').describe('Currency'),
178
+ notes: z.string().optional().describe('Notes (e.g., "PayPal payment received")'),
179
+ }, async (args) => {
180
+ const result = await adminTools.admin_credit_balance.handler(args);
181
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
182
+ });
183
+ server.tool('admin_list_withdrawals', adminTools.admin_list_withdrawals.description, {
184
+ adminSecret: z.string().describe('Admin secret key'),
185
+ status: z.enum(['pending', 'processing', 'completed', 'rejected']).optional().describe('Filter by status'),
186
+ limit: z.number().optional().default(50).describe('Max results'),
187
+ }, async (args) => {
188
+ const result = await adminTools.admin_list_withdrawals.handler(args);
189
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
190
+ });
191
+ server.tool('admin_process_withdrawal', adminTools.admin_process_withdrawal.description, {
192
+ adminSecret: z.string().describe('Admin secret key'),
193
+ withdrawalId: z.string().describe('ID of the withdrawal'),
194
+ action: z.enum(['complete', 'reject']).describe('Action to take'),
195
+ notes: z.string().optional().describe('Notes'),
196
+ }, async (args) => {
197
+ const result = await adminTools.admin_process_withdrawal.handler(args);
198
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
199
+ });
200
+ server.tool('admin_refund_escrow', adminTools.admin_refund_escrow.description, {
201
+ adminSecret: z.string().describe('Admin secret key'),
202
+ escrowId: z.string().describe('ID of the disputed escrow to refund'),
203
+ }, async (args) => {
204
+ const result = await adminTools.admin_refund_escrow.handler(args);
205
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
206
+ });
207
+ server.tool('admin_nostr_json', adminTools.admin_nostr_json.description, {
208
+ adminSecret: z.string().describe('Admin secret key'),
209
+ }, async (args) => {
210
+ const result = await adminTools.admin_nostr_json.handler(args);
211
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
212
+ });
213
+ // ============ PAYMENT TOOLS ============
214
+ server.tool('deposit_create', paymentTools.deposit_create.description, {
215
+ agentId: z.string().describe('ID of the agent making the deposit'),
216
+ apiKey: z.string().describe('API key for the agent'),
217
+ amount: z.number().positive().describe('Amount to deposit in USD'),
218
+ currency: z.enum(['USDC', 'USDT', 'BTC']).describe('Cryptocurrency to deposit'),
219
+ }, async (args) => {
220
+ const result = await paymentTools.deposit_create.handler(args);
221
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
222
+ });
223
+ server.tool('deposit_status', paymentTools.deposit_status.description, {
224
+ depositId: z.string().describe('ID of the deposit to check'),
225
+ }, async (args) => {
226
+ const result = await paymentTools.deposit_status.handler(args);
227
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
228
+ });
229
+ server.tool('payment_config', paymentTools.payment_config.description, {}, async () => {
230
+ const result = await paymentTools.payment_config.handler();
231
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
232
+ });
233
+ server.tool('withdraw_crypto', paymentTools.withdraw_crypto.description, {
234
+ agentId: z.string().describe('ID of the agent'),
235
+ apiKey: z.string().describe('API key for the agent'),
236
+ amount: z.number().positive().describe('Amount to withdraw in USD'),
237
+ currency: z.enum(['USDC', 'USDT', 'BTC']).describe('Cryptocurrency for withdrawal'),
238
+ destination: z.string().describe('Wallet address (USDC/USDT) or Lightning invoice/address (BTC)'),
239
+ }, async (args) => {
240
+ const result = await paymentTools.withdraw_crypto.handler(args);
241
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
242
+ });
243
+ server.tool('agent_set_wallets', paymentTools.agent_set_wallets.description, {
244
+ agentId: z.string().describe('ID of the agent'),
245
+ apiKey: z.string().describe('API key for the agent'),
246
+ baseAddress: z.string().optional().describe('Base/EVM address for USDC (0x...)'),
247
+ trc20Address: z.string().optional().describe('TRC-20 address for USDT (T...)'),
248
+ lightningAddress: z.string().optional().describe('Lightning Address for BTC (user@domain)'),
249
+ }, async (args) => {
250
+ const result = await paymentTools.agent_set_wallets.handler(args);
251
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
252
+ });
253
+ // ============ BOUNTY TOOLS ============
254
+ server.tool('bounty_create', bountyTools.bounty_create.description, {
255
+ title: z.string().describe('Short title for the bounty'),
256
+ summary: z.string().describe('1-3 sentence summary of the task'),
257
+ description: z.string().describe('Full task description in markdown'),
258
+ difficulty: z.enum(['trivial', 'easy', 'medium', 'hard', 'expert']).describe('Difficulty level'),
259
+ requiredSkills: z.array(z.string()).describe('Skills needed'),
260
+ acceptanceCriteria: z.array(z.string()).describe('List of acceptance criteria'),
261
+ amount: z.number().positive().describe('Bounty reward amount'),
262
+ currency: z.enum(['USD', 'USDC', 'USDT', 'BTC']).optional().default('USDC').describe('Currency'),
263
+ expiresInDays: z.number().optional().default(7).describe('Days until expiry'),
264
+ repoUrl: z.string().optional().describe('Repository URL'),
265
+ files: z.array(z.object({ path: z.string(), description: z.string().optional() })).optional(),
266
+ submissionMethod: z.enum(['pr', 'patch', 'gist', 'proof']).optional().default('pr'),
267
+ targetBranch: z.string().optional().describe('Target branch for PRs'),
268
+ modAgentId: z.string().optional().describe('Moderator agent ID'),
269
+ tags: z.array(z.string()).optional().describe('Tags for discoverability'),
270
+ posterAgentId: z.string().describe('Your agent ID'),
271
+ apiKey: z.string().describe('Your API key'),
272
+ fundNow: z.boolean().optional().default(false).describe('Fund immediately'),
273
+ }, async (args) => {
274
+ const result = await bountyTools.bounty_create.handler(args);
275
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
276
+ });
277
+ server.tool('bounty_fund', bountyTools.bounty_fund.description, {
278
+ bountyId: z.string().describe('ID of the bounty to fund'),
279
+ agentId: z.string().describe('Your agent ID'),
280
+ apiKey: z.string().describe('Your API key'),
281
+ }, async (args) => {
282
+ const result = await bountyTools.bounty_fund.handler(args);
283
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
284
+ });
285
+ server.tool('bounty_claim', bountyTools.bounty_claim.description, {
286
+ bountyId: z.string().describe('ID of the bounty to claim'),
287
+ agentId: z.string().describe('Your agent ID'),
288
+ apiKey: z.string().describe('Your API key'),
289
+ }, async (args) => {
290
+ const result = await bountyTools.bounty_claim.handler(args);
291
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
292
+ });
293
+ server.tool('bounty_submit', bountyTools.bounty_submit.description, {
294
+ bountyId: z.string().describe('ID of the bounty'),
295
+ submissionUrl: z.string().describe('URL to your submission'),
296
+ notes: z.string().optional().describe('Description of your approach'),
297
+ agentId: z.string().describe('Your agent ID'),
298
+ apiKey: z.string().describe('Your API key'),
299
+ }, async (args) => {
300
+ const result = await bountyTools.bounty_submit.handler(args);
301
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
302
+ });
303
+ server.tool('bounty_judge', bountyTools.bounty_judge.description, {
304
+ bountyId: z.string().describe('ID of the bounty'),
305
+ winnerAgentId: z.string().describe('Agent ID of the winner'),
306
+ notes: z.string().optional().describe('Judging notes'),
307
+ judgeAgentId: z.string().describe('Your agent ID'),
308
+ apiKey: z.string().describe('Your API key'),
309
+ }, async (args) => {
310
+ const result = await bountyTools.bounty_judge.handler(args);
311
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
312
+ });
313
+ server.tool('bounty_search', bountyTools.bounty_search.description, {
314
+ skill: z.string().optional().describe('Filter by required skill'),
315
+ difficulty: z.enum(['trivial', 'easy', 'medium', 'hard', 'expert']).optional(),
316
+ status: z.enum(['open', 'claimed', 'in_review']).optional().default('open'),
317
+ minAmount: z.number().optional().describe('Minimum reward'),
318
+ maxAmount: z.number().optional().describe('Maximum reward'),
319
+ tag: z.string().optional().describe('Filter by tag'),
320
+ limit: z.number().optional().default(20).describe('Max results'),
321
+ }, async (args) => {
322
+ const result = await bountyTools.bounty_search.handler(args);
323
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
324
+ });
325
+ server.tool('bounty_get', bountyTools.bounty_get.description, {
326
+ bountyId: z.string().describe('ID of the bounty'),
327
+ }, async (args) => {
328
+ const result = await bountyTools.bounty_get.handler(args);
329
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
330
+ });
331
+ server.tool('bounty_export_markdown', bountyTools.bounty_export_markdown.description, {
332
+ bountyId: z.string().describe('ID of the bounty to export'),
333
+ }, async (args) => {
334
+ const result = await bountyTools.bounty_export_markdown.handler(args);
335
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
45
336
  });
46
337
  // Start server
47
338
  async function main() {
48
339
  const transport = new StdioServerTransport();
49
340
  await server.connect(transport);
50
- console.error('Clawdentials MCP server running on stdio');
341
+ console.error('Clawdentials MCP server v0.8.0 running on stdio');
51
342
  }
52
343
  main().catch((error) => {
53
344
  console.error('Fatal error:', error);