neutron-mcp 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Neutron
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,263 @@
1
+ # Neutron MCP Server
2
+
3
+ Add Lightning payments, Bitcoin, USDT, and fiat transactions to your applications using AI. This MCP (Model Context Protocol) server connects Neutron's payment infrastructure to AI coding assistants like Claude, Cursor, Windsurf, and Cline.
4
+
5
+ ## What is this?
6
+
7
+ The Neutron MCP server allows AI assistants to interact with the [Neutron API](https://docs.neutron.me) on your behalf. Simply describe what you want to build, and your AI assistant can:
8
+
9
+ - Generate Bitcoin and USDT deposit addresses
10
+ - Create Lightning payments (Bolt11, LNURL, Lightning Address)
11
+ - Process Bitcoin on-chain transactions
12
+ - Handle USDT transfers (ERC20/TRC20)
13
+ - Execute fiat payouts (bank transfers, mobile money)
14
+ - Manage webhooks for real-time notifications
15
+ - Check balances and transaction status
16
+
17
+ ## Quick Start
18
+
19
+ ### 1. Get Your API Keys
20
+
21
+ Sign up at [neutron.me](https://neutron.me) and get your API credentials from the dashboard.
22
+
23
+ ### 2. Install & Configure
24
+
25
+ Choose your AI tool below:
26
+
27
+ ---
28
+
29
+ ### Claude Desktop
30
+
31
+ Add to your config file:
32
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
33
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
34
+
35
+ ```json
36
+ {
37
+ "mcpServers": {
38
+ "neutron": {
39
+ "command": "npx",
40
+ "args": ["-y", "neutron-mcp"],
41
+ "env": {
42
+ "NEUTRON_ACCESS_KEY": "your_access_key",
43
+ "NEUTRON_SECRET_KEY": "your_secret_key"
44
+ }
45
+ }
46
+ }
47
+ }
48
+ ```
49
+
50
+ ---
51
+
52
+ ### Claude Code (CLI)
53
+
54
+ Add to `~/.claude.json` or your project's `.mcp.json`:
55
+
56
+ ```json
57
+ {
58
+ "mcpServers": {
59
+ "neutron": {
60
+ "command": "npx",
61
+ "args": ["-y", "neutron-mcp"],
62
+ "env": {
63
+ "NEUTRON_ACCESS_KEY": "your_access_key",
64
+ "NEUTRON_SECRET_KEY": "your_secret_key"
65
+ }
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ ---
72
+
73
+ ### Cursor
74
+
75
+ Add to `.cursor/mcp.json` in your project or global config:
76
+
77
+ ```json
78
+ {
79
+ "mcpServers": {
80
+ "neutron": {
81
+ "command": "npx",
82
+ "args": ["-y", "neutron-mcp"],
83
+ "env": {
84
+ "NEUTRON_ACCESS_KEY": "your_access_key",
85
+ "NEUTRON_SECRET_KEY": "your_secret_key"
86
+ }
87
+ }
88
+ }
89
+ }
90
+ ```
91
+
92
+ ---
93
+
94
+ ### Windsurf
95
+
96
+ Add to your Windsurf MCP configuration:
97
+
98
+ ```json
99
+ {
100
+ "mcpServers": {
101
+ "neutron": {
102
+ "command": "npx",
103
+ "args": ["-y", "neutron-mcp"],
104
+ "env": {
105
+ "NEUTRON_ACCESS_KEY": "your_access_key",
106
+ "NEUTRON_SECRET_KEY": "your_secret_key"
107
+ }
108
+ }
109
+ }
110
+ }
111
+ ```
112
+
113
+ ---
114
+
115
+ ### Cline (VS Code)
116
+
117
+ Add to your Cline MCP settings:
118
+
119
+ ```json
120
+ {
121
+ "mcpServers": {
122
+ "neutron": {
123
+ "command": "npx",
124
+ "args": ["-y", "neutron-mcp"],
125
+ "env": {
126
+ "NEUTRON_ACCESS_KEY": "your_access_key",
127
+ "NEUTRON_SECRET_KEY": "your_secret_key"
128
+ }
129
+ }
130
+ }
131
+ }
132
+ ```
133
+
134
+ ---
135
+
136
+ ### Global Installation (Alternative)
137
+
138
+ If you prefer a global install instead of `npx`:
139
+
140
+ ```bash
141
+ npm install -g neutron-mcp
142
+ ```
143
+
144
+ Then use `"command": "neutron-mcp"` instead of `npx` in your config.
145
+
146
+ ---
147
+
148
+ ## Usage Examples
149
+
150
+ Once configured, just ask your AI assistant naturally:
151
+
152
+ > "Create a Lightning invoice for 10,000 sats"
153
+
154
+ > "Show me my wallet balances"
155
+
156
+ > "Send 0.001 BTC to bc1q..."
157
+
158
+ > "Pay this Lightning invoice: lnbc..."
159
+
160
+ > "Generate a Bitcoin deposit address"
161
+
162
+ > "Set up a webhook for transaction notifications"
163
+
164
+ > "What banks are supported for payouts in Nigeria?"
165
+
166
+ ---
167
+
168
+ ## Available Tools
169
+
170
+ ### Account Management
171
+ | Tool | Description |
172
+ |------|-------------|
173
+ | `neutron_get_account` | Get account information |
174
+ | `neutron_get_wallets` | List all wallets with balances |
175
+ | `neutron_get_wallet` | Get specific wallet details |
176
+
177
+ ### Receive Addresses
178
+ | Tool | Description |
179
+ |------|-------------|
180
+ | `neutron_get_bitcoin_address` | Generate Bitcoin deposit address |
181
+ | `neutron_get_usdt_address` | Generate USDT address (ERC20 or TRC20) |
182
+
183
+ ### Transactions
184
+ | Tool | Description |
185
+ |------|-------------|
186
+ | `neutron_create_transaction` | Create payment (Lightning, on-chain, USDT, fiat) |
187
+ | `neutron_list_transactions` | List transactions with filters |
188
+ | `neutron_get_transaction` | Get transaction status |
189
+ | `neutron_confirm_transaction` | Confirm pending transaction |
190
+ | `neutron_cancel_transaction` | Cancel pending transaction |
191
+
192
+ ### Webhooks
193
+ | Tool | Description |
194
+ |------|-------------|
195
+ | `neutron_create_webhook` | Register webhook endpoint |
196
+ | `neutron_list_webhooks` | List all webhooks |
197
+ | `neutron_update_webhook` | Update webhook configuration |
198
+ | `neutron_delete_webhook` | Remove webhook |
199
+
200
+ ### Reference Data
201
+ | Tool | Description |
202
+ |------|-------------|
203
+ | `neutron_get_fiat_institutions` | Get banks/mobile money by country |
204
+
205
+ ---
206
+
207
+ ## Supported Payment Methods
208
+
209
+ | Type | Methods |
210
+ |------|---------|
211
+ | **Bitcoin Lightning** | Bolt11 invoices, LNURL, Lightning Address |
212
+ | **Bitcoin On-chain** | Standard BTC transactions |
213
+ | **Stablecoins** | USDT on Ethereum (ERC20) and Tron (TRC20) |
214
+ | **Fiat Payouts** | Bank transfers, Mobile money |
215
+
216
+ ---
217
+
218
+ ## Example Prompts for Common Tasks
219
+
220
+ ### E-commerce Integration
221
+ > "Help me add Bitcoin Lightning payments to my checkout. When a user clicks pay, generate an invoice for the cart total and show a QR code."
222
+
223
+ ### Subscription Service
224
+ > "Create a payment flow where users can pay $10/month in Bitcoin. Generate a Lightning invoice and set up a webhook to activate their account when paid."
225
+
226
+ ### Payout System
227
+ > "Build a function to pay out earnings to users. They can choose Lightning address, on-chain Bitcoin, or bank transfer in supported countries."
228
+
229
+ ### Treasury Management
230
+ > "Show me all my wallet balances and recent transactions. Then help me consolidate funds by transferring USDT to my main wallet."
231
+
232
+ ---
233
+
234
+ ## Environment Variables
235
+
236
+ | Variable | Required | Description |
237
+ |----------|----------|-------------|
238
+ | `NEUTRON_ACCESS_KEY` | Yes | Your Neutron API access key |
239
+ | `NEUTRON_SECRET_KEY` | Yes | Your Neutron API secret key |
240
+ | `NEUTRON_API_URL` | No | API URL (defaults to `https://api.neutron.me/v2`) |
241
+
242
+ ---
243
+
244
+ ## Security Notes
245
+
246
+ - Never commit API keys to version control
247
+ - Use environment variables or secure secret management
248
+ - API keys have full access to your Neutron account - keep them safe
249
+ - Consider using separate API keys for development and production
250
+
251
+ ---
252
+
253
+ ## Support
254
+
255
+ - **Documentation**: [docs.neutron.me](https://docs.neutron.me)
256
+ - **Issues**: [GitHub Issues](https://github.com/neutroncreative/neutron-mcp/issues)
257
+ - **Contact**: support@neutron.me
258
+
259
+ ---
260
+
261
+ ## License
262
+
263
+ MIT - see [LICENSE](LICENSE) for details.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,646 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
5
+ import { z } from "zod";
6
+ import { NeutronClient } from "./neutron-client.js";
7
+ // Validation schemas
8
+ const CreateTransactionSchema = z.object({
9
+ sourceMethod: z.enum([
10
+ "lightning",
11
+ "lightning_address",
12
+ "lnurl",
13
+ "bolt11",
14
+ "on_chain",
15
+ "eth",
16
+ "tron",
17
+ "bank",
18
+ "mobile_money",
19
+ "internal",
20
+ ]),
21
+ sourceCurrency: z.string(),
22
+ sourceAmount: z.string().optional(),
23
+ sourceWalletId: z.string().optional(),
24
+ destMethod: z.enum([
25
+ "lightning",
26
+ "lightning_address",
27
+ "lnurl",
28
+ "bolt11",
29
+ "on_chain",
30
+ "eth",
31
+ "tron",
32
+ "bank",
33
+ "mobile_money",
34
+ "internal",
35
+ ]),
36
+ destCurrency: z.string(),
37
+ destAmount: z.string().optional(),
38
+ destAddress: z.string().optional(),
39
+ destLightningAddress: z.string().optional(),
40
+ destBolt11: z.string().optional(),
41
+ destAccountNumber: z.string().optional(),
42
+ destBankCode: z.string().optional(),
43
+ destPhoneNumber: z.string().optional(),
44
+ destRecipientName: z.string().optional(),
45
+ destCountry: z.string().optional(),
46
+ reference: z.string().optional(),
47
+ });
48
+ const ListTransactionsSchema = z.object({
49
+ status: z
50
+ .enum(["pending", "processing", "completed", "failed", "cancelled"])
51
+ .optional(),
52
+ method: z
53
+ .enum([
54
+ "lightning",
55
+ "lightning_address",
56
+ "lnurl",
57
+ "bolt11",
58
+ "on_chain",
59
+ "eth",
60
+ "tron",
61
+ "bank",
62
+ "mobile_money",
63
+ "internal",
64
+ ])
65
+ .optional(),
66
+ currency: z.string().optional(),
67
+ fromDate: z.string().optional(),
68
+ toDate: z.string().optional(),
69
+ limit: z.number().optional(),
70
+ offset: z.number().optional(),
71
+ });
72
+ const CreateWebhookSchema = z.object({
73
+ url: z.string().url(),
74
+ events: z.array(z.enum([
75
+ "transaction.created",
76
+ "transaction.completed",
77
+ "transaction.failed",
78
+ "transaction.cancelled",
79
+ "deposit.received",
80
+ "withdrawal.completed",
81
+ ])),
82
+ });
83
+ const UpdateWebhookSchema = z.object({
84
+ webhookId: z.string(),
85
+ url: z.string().url().optional(),
86
+ events: z
87
+ .array(z.enum([
88
+ "transaction.created",
89
+ "transaction.completed",
90
+ "transaction.failed",
91
+ "transaction.cancelled",
92
+ "deposit.received",
93
+ "withdrawal.completed",
94
+ ]))
95
+ .optional(),
96
+ status: z.enum(["active", "inactive"]).optional(),
97
+ });
98
+ // Initialize Neutron client
99
+ function createClient() {
100
+ const apiUrl = process.env.NEUTRON_API_URL || "https://api.neutron.me/v2";
101
+ const accessKey = process.env.NEUTRON_ACCESS_KEY;
102
+ const secretKey = process.env.NEUTRON_SECRET_KEY;
103
+ if (!accessKey || !secretKey) {
104
+ throw new Error("NEUTRON_ACCESS_KEY and NEUTRON_SECRET_KEY environment variables are required");
105
+ }
106
+ return new NeutronClient({ apiUrl, accessKey, secretKey });
107
+ }
108
+ // Create MCP server
109
+ const server = new Server({
110
+ name: "neutron-mcp-server",
111
+ version: "1.0.0",
112
+ }, {
113
+ capabilities: {
114
+ tools: {},
115
+ },
116
+ });
117
+ // Tool definitions
118
+ const tools = [
119
+ {
120
+ name: "neutron_get_account",
121
+ description: "Get Neutron account information including name, email, and status",
122
+ inputSchema: {
123
+ type: "object",
124
+ properties: {},
125
+ required: [],
126
+ },
127
+ },
128
+ {
129
+ name: "neutron_get_wallets",
130
+ description: "List all wallets associated with the Neutron account with balances",
131
+ inputSchema: {
132
+ type: "object",
133
+ properties: {},
134
+ required: [],
135
+ },
136
+ },
137
+ {
138
+ name: "neutron_get_wallet",
139
+ description: "Get details of a specific wallet by ID",
140
+ inputSchema: {
141
+ type: "object",
142
+ properties: {
143
+ walletId: {
144
+ type: "string",
145
+ description: "The wallet ID to retrieve",
146
+ },
147
+ },
148
+ required: ["walletId"],
149
+ },
150
+ },
151
+ {
152
+ name: "neutron_get_bitcoin_address",
153
+ description: "Generate a Bitcoin receive address for deposits",
154
+ inputSchema: {
155
+ type: "object",
156
+ properties: {},
157
+ required: [],
158
+ },
159
+ },
160
+ {
161
+ name: "neutron_get_usdt_address",
162
+ description: "Generate a USDT receive address for deposits (ERC20 or TRC20)",
163
+ inputSchema: {
164
+ type: "object",
165
+ properties: {
166
+ network: {
167
+ type: "string",
168
+ enum: ["eth", "tron"],
169
+ description: "Network for USDT address (eth for ERC20, tron for TRC20)",
170
+ default: "tron",
171
+ },
172
+ },
173
+ required: [],
174
+ },
175
+ },
176
+ {
177
+ name: "neutron_create_transaction",
178
+ description: `Create a new transaction. Supports Lightning payments (bolt11, LNURL, Lightning Address), Bitcoin on-chain, USDT (ERC20/TRC20), and fiat payouts (bank, mobile money).
179
+
180
+ Examples:
181
+ - Lightning payment: sourceMethod="internal", destMethod="lightning_address", destLightningAddress="user@wallet.me"
182
+ - Bitcoin withdrawal: sourceMethod="internal", destMethod="on_chain", destAddress="bc1q..."
183
+ - USDT transfer: sourceMethod="internal", destMethod="tron", destAddress="T..."
184
+ - Bank payout: sourceMethod="internal", destMethod="bank", destAccountNumber="...", destBankCode="...", destRecipientName="..."`,
185
+ inputSchema: {
186
+ type: "object",
187
+ properties: {
188
+ sourceMethod: {
189
+ type: "string",
190
+ enum: [
191
+ "lightning",
192
+ "lightning_address",
193
+ "lnurl",
194
+ "bolt11",
195
+ "on_chain",
196
+ "eth",
197
+ "tron",
198
+ "bank",
199
+ "mobile_money",
200
+ "internal",
201
+ ],
202
+ description: "Source funding method",
203
+ },
204
+ sourceCurrency: {
205
+ type: "string",
206
+ description: "Source currency (BTC, USDT, USD, etc.)",
207
+ },
208
+ sourceAmount: {
209
+ type: "string",
210
+ description: "Amount to send from source (optional if destAmount specified)",
211
+ },
212
+ sourceWalletId: {
213
+ type: "string",
214
+ description: "Specific wallet ID to fund from (optional)",
215
+ },
216
+ destMethod: {
217
+ type: "string",
218
+ enum: [
219
+ "lightning",
220
+ "lightning_address",
221
+ "lnurl",
222
+ "bolt11",
223
+ "on_chain",
224
+ "eth",
225
+ "tron",
226
+ "bank",
227
+ "mobile_money",
228
+ "internal",
229
+ ],
230
+ description: "Destination payout method",
231
+ },
232
+ destCurrency: {
233
+ type: "string",
234
+ description: "Destination currency",
235
+ },
236
+ destAmount: {
237
+ type: "string",
238
+ description: "Amount to receive at destination (optional if sourceAmount specified)",
239
+ },
240
+ destAddress: {
241
+ type: "string",
242
+ description: "Destination address (for on_chain, eth, tron)",
243
+ },
244
+ destLightningAddress: {
245
+ type: "string",
246
+ description: "Lightning address (e.g., user@wallet.me)",
247
+ },
248
+ destBolt11: {
249
+ type: "string",
250
+ description: "Bolt11 Lightning invoice to pay",
251
+ },
252
+ destAccountNumber: {
253
+ type: "string",
254
+ description: "Bank account number (for bank payouts)",
255
+ },
256
+ destBankCode: {
257
+ type: "string",
258
+ description: "Bank code/routing number",
259
+ },
260
+ destPhoneNumber: {
261
+ type: "string",
262
+ description: "Phone number (for mobile money)",
263
+ },
264
+ destRecipientName: {
265
+ type: "string",
266
+ description: "Recipient name for fiat payouts",
267
+ },
268
+ destCountry: {
269
+ type: "string",
270
+ description: "Destination country code (ISO 3166-1 alpha-2)",
271
+ },
272
+ reference: {
273
+ type: "string",
274
+ description: "Custom reference ID for the transaction",
275
+ },
276
+ },
277
+ required: ["sourceMethod", "sourceCurrency", "destMethod", "destCurrency"],
278
+ },
279
+ },
280
+ {
281
+ name: "neutron_list_transactions",
282
+ description: "List transactions with optional filtering by status, method, currency, and date range",
283
+ inputSchema: {
284
+ type: "object",
285
+ properties: {
286
+ status: {
287
+ type: "string",
288
+ enum: ["pending", "processing", "completed", "failed", "cancelled"],
289
+ description: "Filter by transaction status",
290
+ },
291
+ method: {
292
+ type: "string",
293
+ enum: [
294
+ "lightning",
295
+ "lightning_address",
296
+ "lnurl",
297
+ "bolt11",
298
+ "on_chain",
299
+ "eth",
300
+ "tron",
301
+ "bank",
302
+ "mobile_money",
303
+ "internal",
304
+ ],
305
+ description: "Filter by transaction method",
306
+ },
307
+ currency: {
308
+ type: "string",
309
+ description: "Filter by currency",
310
+ },
311
+ fromDate: {
312
+ type: "string",
313
+ description: "Start date (ISO 8601 format)",
314
+ },
315
+ toDate: {
316
+ type: "string",
317
+ description: "End date (ISO 8601 format)",
318
+ },
319
+ limit: {
320
+ type: "number",
321
+ description: "Number of results to return (default 20)",
322
+ },
323
+ offset: {
324
+ type: "number",
325
+ description: "Offset for pagination",
326
+ },
327
+ },
328
+ required: [],
329
+ },
330
+ },
331
+ {
332
+ name: "neutron_get_transaction",
333
+ description: "Get the status and details of a specific transaction",
334
+ inputSchema: {
335
+ type: "object",
336
+ properties: {
337
+ transactionId: {
338
+ type: "string",
339
+ description: "The transaction ID to check",
340
+ },
341
+ },
342
+ required: ["transactionId"],
343
+ },
344
+ },
345
+ {
346
+ name: "neutron_confirm_transaction",
347
+ description: "Confirm a pending transaction to proceed with execution",
348
+ inputSchema: {
349
+ type: "object",
350
+ properties: {
351
+ transactionId: {
352
+ type: "string",
353
+ description: "The transaction ID to confirm",
354
+ },
355
+ },
356
+ required: ["transactionId"],
357
+ },
358
+ },
359
+ {
360
+ name: "neutron_cancel_transaction",
361
+ description: "Cancel a pending transaction",
362
+ inputSchema: {
363
+ type: "object",
364
+ properties: {
365
+ transactionId: {
366
+ type: "string",
367
+ description: "The transaction ID to cancel",
368
+ },
369
+ },
370
+ required: ["transactionId"],
371
+ },
372
+ },
373
+ {
374
+ name: "neutron_create_webhook",
375
+ description: "Create a webhook to receive event notifications",
376
+ inputSchema: {
377
+ type: "object",
378
+ properties: {
379
+ url: {
380
+ type: "string",
381
+ description: "The webhook endpoint URL",
382
+ },
383
+ events: {
384
+ type: "array",
385
+ items: {
386
+ type: "string",
387
+ enum: [
388
+ "transaction.created",
389
+ "transaction.completed",
390
+ "transaction.failed",
391
+ "transaction.cancelled",
392
+ "deposit.received",
393
+ "withdrawal.completed",
394
+ ],
395
+ },
396
+ description: "Events to subscribe to",
397
+ },
398
+ },
399
+ required: ["url", "events"],
400
+ },
401
+ },
402
+ {
403
+ name: "neutron_list_webhooks",
404
+ description: "List all registered webhooks",
405
+ inputSchema: {
406
+ type: "object",
407
+ properties: {},
408
+ required: [],
409
+ },
410
+ },
411
+ {
412
+ name: "neutron_update_webhook",
413
+ description: "Update a webhook configuration",
414
+ inputSchema: {
415
+ type: "object",
416
+ properties: {
417
+ webhookId: {
418
+ type: "string",
419
+ description: "The webhook ID to update",
420
+ },
421
+ url: {
422
+ type: "string",
423
+ description: "New webhook URL",
424
+ },
425
+ events: {
426
+ type: "array",
427
+ items: {
428
+ type: "string",
429
+ enum: [
430
+ "transaction.created",
431
+ "transaction.completed",
432
+ "transaction.failed",
433
+ "transaction.cancelled",
434
+ "deposit.received",
435
+ "withdrawal.completed",
436
+ ],
437
+ },
438
+ description: "New events to subscribe to",
439
+ },
440
+ status: {
441
+ type: "string",
442
+ enum: ["active", "inactive"],
443
+ description: "Webhook status",
444
+ },
445
+ },
446
+ required: ["webhookId"],
447
+ },
448
+ },
449
+ {
450
+ name: "neutron_delete_webhook",
451
+ description: "Delete a webhook",
452
+ inputSchema: {
453
+ type: "object",
454
+ properties: {
455
+ webhookId: {
456
+ type: "string",
457
+ description: "The webhook ID to delete",
458
+ },
459
+ },
460
+ required: ["webhookId"],
461
+ },
462
+ },
463
+ {
464
+ name: "neutron_get_fiat_institutions",
465
+ description: "Get list of supported fiat institutions (banks, mobile money) for a country",
466
+ inputSchema: {
467
+ type: "object",
468
+ properties: {
469
+ country: {
470
+ type: "string",
471
+ description: "Country code (ISO 3166-1 alpha-2, e.g., NG, KE, GH)",
472
+ },
473
+ },
474
+ required: ["country"],
475
+ },
476
+ },
477
+ ];
478
+ // Handle list tools request
479
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
480
+ return { tools };
481
+ });
482
+ // Handle tool execution
483
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
484
+ const { name, arguments: args } = request.params;
485
+ const client = createClient();
486
+ try {
487
+ switch (name) {
488
+ case "neutron_get_account": {
489
+ const account = await client.getAccount();
490
+ return {
491
+ content: [{ type: "text", text: JSON.stringify(account, null, 2) }],
492
+ };
493
+ }
494
+ case "neutron_get_wallets": {
495
+ const wallets = await client.getWallets();
496
+ return {
497
+ content: [{ type: "text", text: JSON.stringify(wallets, null, 2) }],
498
+ };
499
+ }
500
+ case "neutron_get_wallet": {
501
+ const { walletId } = args;
502
+ const wallet = await client.getWallet(walletId);
503
+ return {
504
+ content: [{ type: "text", text: JSON.stringify(wallet, null, 2) }],
505
+ };
506
+ }
507
+ case "neutron_get_bitcoin_address": {
508
+ const address = await client.getBitcoinAddress();
509
+ return {
510
+ content: [{ type: "text", text: JSON.stringify(address, null, 2) }],
511
+ };
512
+ }
513
+ case "neutron_get_usdt_address": {
514
+ const { network } = args;
515
+ const address = await client.getUsdtAddress(network);
516
+ return {
517
+ content: [{ type: "text", text: JSON.stringify(address, null, 2) }],
518
+ };
519
+ }
520
+ case "neutron_create_transaction": {
521
+ const validated = CreateTransactionSchema.parse(args);
522
+ const transaction = await client.createTransaction({
523
+ sourceReq: {
524
+ method: validated.sourceMethod,
525
+ currency: validated.sourceCurrency,
526
+ amount: validated.sourceAmount,
527
+ walletId: validated.sourceWalletId,
528
+ },
529
+ destReq: {
530
+ method: validated.destMethod,
531
+ currency: validated.destCurrency,
532
+ amount: validated.destAmount,
533
+ address: validated.destAddress,
534
+ lightningAddress: validated.destLightningAddress,
535
+ bolt11: validated.destBolt11,
536
+ accountNumber: validated.destAccountNumber,
537
+ bankCode: validated.destBankCode,
538
+ phoneNumber: validated.destPhoneNumber,
539
+ recipientName: validated.destRecipientName,
540
+ country: validated.destCountry,
541
+ },
542
+ reference: validated.reference,
543
+ });
544
+ return {
545
+ content: [{ type: "text", text: JSON.stringify(transaction, null, 2) }],
546
+ };
547
+ }
548
+ case "neutron_list_transactions": {
549
+ const validated = ListTransactionsSchema.parse(args);
550
+ const transactions = await client.getTransactions({
551
+ status: validated.status,
552
+ method: validated.method,
553
+ currency: validated.currency,
554
+ fromDate: validated.fromDate,
555
+ toDate: validated.toDate,
556
+ limit: validated.limit,
557
+ offset: validated.offset,
558
+ });
559
+ return {
560
+ content: [{ type: "text", text: JSON.stringify(transactions, null, 2) }],
561
+ };
562
+ }
563
+ case "neutron_get_transaction": {
564
+ const { transactionId } = args;
565
+ const transaction = await client.getTransactionStatus(transactionId);
566
+ return {
567
+ content: [{ type: "text", text: JSON.stringify(transaction, null, 2) }],
568
+ };
569
+ }
570
+ case "neutron_confirm_transaction": {
571
+ const { transactionId } = args;
572
+ const transaction = await client.confirmTransaction(transactionId);
573
+ return {
574
+ content: [{ type: "text", text: JSON.stringify(transaction, null, 2) }],
575
+ };
576
+ }
577
+ case "neutron_cancel_transaction": {
578
+ const { transactionId } = args;
579
+ const transaction = await client.cancelTransaction(transactionId);
580
+ return {
581
+ content: [{ type: "text", text: JSON.stringify(transaction, null, 2) }],
582
+ };
583
+ }
584
+ case "neutron_create_webhook": {
585
+ const validated = CreateWebhookSchema.parse(args);
586
+ const webhook = await client.createWebhook({
587
+ url: validated.url,
588
+ events: validated.events,
589
+ });
590
+ return {
591
+ content: [{ type: "text", text: JSON.stringify(webhook, null, 2) }],
592
+ };
593
+ }
594
+ case "neutron_list_webhooks": {
595
+ const webhooks = await client.getWebhooks();
596
+ return {
597
+ content: [{ type: "text", text: JSON.stringify(webhooks, null, 2) }],
598
+ };
599
+ }
600
+ case "neutron_update_webhook": {
601
+ const validated = UpdateWebhookSchema.parse(args);
602
+ const webhook = await client.updateWebhook(validated.webhookId, {
603
+ url: validated.url,
604
+ events: validated.events,
605
+ status: validated.status,
606
+ });
607
+ return {
608
+ content: [{ type: "text", text: JSON.stringify(webhook, null, 2) }],
609
+ };
610
+ }
611
+ case "neutron_delete_webhook": {
612
+ const { webhookId } = args;
613
+ await client.deleteWebhook(webhookId);
614
+ return {
615
+ content: [{ type: "text", text: `Webhook ${webhookId} deleted successfully` }],
616
+ };
617
+ }
618
+ case "neutron_get_fiat_institutions": {
619
+ const { country } = args;
620
+ const institutions = await client.getFiatInstitutions(country);
621
+ return {
622
+ content: [{ type: "text", text: JSON.stringify(institutions, null, 2) }],
623
+ };
624
+ }
625
+ default:
626
+ throw new Error(`Unknown tool: ${name}`);
627
+ }
628
+ }
629
+ catch (error) {
630
+ const errorMessage = error instanceof Error ? error.message : String(error);
631
+ return {
632
+ content: [{ type: "text", text: `Error: ${errorMessage}` }],
633
+ isError: true,
634
+ };
635
+ }
636
+ });
637
+ // Start server
638
+ async function main() {
639
+ const transport = new StdioServerTransport();
640
+ await server.connect(transport);
641
+ console.error("Neutron MCP Server running on stdio");
642
+ }
643
+ main().catch((error) => {
644
+ console.error("Fatal error:", error);
645
+ process.exit(1);
646
+ });
@@ -0,0 +1,25 @@
1
+ import type { NeutronConfig, Account, Wallet, ReceiveAddress, Transaction, CreateTransactionRequest, TransactionListParams, TransactionListResponse, Webhook, CreateWebhookRequest, UpdateWebhookRequest, FiatInstitution } from "./types.js";
2
+ export declare class NeutronClient {
3
+ private config;
4
+ private token;
5
+ private tokenExpiry;
6
+ constructor(config: NeutronConfig);
7
+ private generateSignature;
8
+ private request;
9
+ authenticate(): Promise<void>;
10
+ getAccount(): Promise<Account>;
11
+ getWallets(): Promise<Wallet[]>;
12
+ getWallet(walletId: string): Promise<Wallet>;
13
+ getBitcoinAddress(): Promise<ReceiveAddress>;
14
+ getUsdtAddress(network?: "eth" | "tron"): Promise<ReceiveAddress>;
15
+ createTransaction(request: CreateTransactionRequest): Promise<Transaction>;
16
+ getTransactions(params?: TransactionListParams): Promise<TransactionListResponse>;
17
+ getTransactionStatus(transactionId: string): Promise<Transaction>;
18
+ confirmTransaction(transactionId: string): Promise<Transaction>;
19
+ cancelTransaction(transactionId: string): Promise<Transaction>;
20
+ createWebhook(request: CreateWebhookRequest): Promise<Webhook>;
21
+ getWebhooks(): Promise<Webhook[]>;
22
+ updateWebhook(webhookId: string, request: UpdateWebhookRequest): Promise<Webhook>;
23
+ deleteWebhook(webhookId: string): Promise<void>;
24
+ getFiatInstitutions(country: string): Promise<FiatInstitution[]>;
25
+ }
@@ -0,0 +1,110 @@
1
+ import crypto from "crypto";
2
+ export class NeutronClient {
3
+ config;
4
+ token = null;
5
+ tokenExpiry = 0;
6
+ constructor(config) {
7
+ this.config = config;
8
+ }
9
+ generateSignature(method, path, timestamp, body) {
10
+ const payload = `${method}${path}${timestamp}${body || ""}`;
11
+ return crypto
12
+ .createHmac("sha256", this.config.secretKey)
13
+ .update(payload)
14
+ .digest("hex");
15
+ }
16
+ async request(method, path, body) {
17
+ const timestamp = Date.now().toString();
18
+ const bodyString = body ? JSON.stringify(body) : undefined;
19
+ const signature = this.generateSignature(method, path, timestamp, bodyString);
20
+ const headers = {
21
+ "Content-Type": "application/json",
22
+ "X-Access-Key": this.config.accessKey,
23
+ "X-Timestamp": timestamp,
24
+ "X-Signature": signature,
25
+ };
26
+ // Add bearer token if authenticated
27
+ if (this.token && Date.now() < this.tokenExpiry) {
28
+ headers["Authorization"] = `Bearer ${this.token}`;
29
+ }
30
+ const response = await fetch(`${this.config.apiUrl}${path}`, {
31
+ method,
32
+ headers,
33
+ body: bodyString,
34
+ });
35
+ if (!response.ok) {
36
+ const error = await response.json().catch(() => ({}));
37
+ throw new Error(`API Error: ${response.status} - ${error.message || response.statusText}`);
38
+ }
39
+ const result = (await response.json());
40
+ if (!result.success && result.error) {
41
+ throw new Error(`${result.error.code}: ${result.error.message}`);
42
+ }
43
+ return result.data;
44
+ }
45
+ // Authentication
46
+ async authenticate() {
47
+ const result = await this.request("POST", "/authenticate");
48
+ this.token = result.token;
49
+ this.tokenExpiry = Date.now() + result.expiresIn * 1000;
50
+ }
51
+ // Account Management
52
+ async getAccount() {
53
+ return this.request("GET", "/account");
54
+ }
55
+ async getWallets() {
56
+ return this.request("GET", "/account/wallets");
57
+ }
58
+ async getWallet(walletId) {
59
+ return this.request("GET", `/wallet/${walletId}`);
60
+ }
61
+ // Receive Addresses
62
+ async getBitcoinAddress() {
63
+ return this.request("GET", "/bitcoin/receive-address");
64
+ }
65
+ async getUsdtAddress(network = "tron") {
66
+ return this.request("GET", `/usdt/receive-address?network=${network}`);
67
+ }
68
+ // Transactions
69
+ async createTransaction(request) {
70
+ return this.request("POST", "/transaction", request);
71
+ }
72
+ async getTransactions(params) {
73
+ const queryParams = new URLSearchParams();
74
+ if (params) {
75
+ Object.entries(params).forEach(([key, value]) => {
76
+ if (value !== undefined) {
77
+ queryParams.append(key, String(value));
78
+ }
79
+ });
80
+ }
81
+ const query = queryParams.toString();
82
+ return this.request("GET", `/transactions${query ? `?${query}` : ""}`);
83
+ }
84
+ async getTransactionStatus(transactionId) {
85
+ return this.request("GET", `/transaction/${transactionId}/status`);
86
+ }
87
+ async confirmTransaction(transactionId) {
88
+ return this.request("PUT", `/transaction/${transactionId}/confirm`);
89
+ }
90
+ async cancelTransaction(transactionId) {
91
+ return this.request("PATCH", `/transaction/${transactionId}`);
92
+ }
93
+ // Webhooks
94
+ async createWebhook(request) {
95
+ return this.request("POST", "/webhook", request);
96
+ }
97
+ async getWebhooks() {
98
+ return this.request("GET", "/webhooks");
99
+ }
100
+ async updateWebhook(webhookId, request) {
101
+ return this.request("PUT", `/webhook/${webhookId}`, request);
102
+ }
103
+ async deleteWebhook(webhookId) {
104
+ await this.request("DELETE", `/webhook/${webhookId}`);
105
+ }
106
+ // Reference Data
107
+ async getFiatInstitutions(country) {
108
+ return this.request("GET", `/fiat-institutions/${country}`);
109
+ }
110
+ }
@@ -0,0 +1,126 @@
1
+ export interface NeutronConfig {
2
+ apiUrl: string;
3
+ accessKey: string;
4
+ secretKey: string;
5
+ }
6
+ export interface Account {
7
+ id: string;
8
+ name: string;
9
+ email: string;
10
+ status: string;
11
+ createdAt: string;
12
+ }
13
+ export interface Wallet {
14
+ id: string;
15
+ currency: string;
16
+ balance: string;
17
+ availableBalance: string;
18
+ status: string;
19
+ }
20
+ export interface ReceiveAddress {
21
+ address: string;
22
+ currency: string;
23
+ network?: string;
24
+ expiresAt?: string;
25
+ }
26
+ export type TransactionMethod = "lightning" | "lightning_address" | "lnurl" | "bolt11" | "on_chain" | "eth" | "tron" | "bank" | "mobile_money" | "internal";
27
+ export type TransactionStatus = "pending" | "processing" | "completed" | "failed" | "cancelled";
28
+ export interface TransactionSource {
29
+ method: TransactionMethod;
30
+ currency: string;
31
+ amount?: string;
32
+ walletId?: string;
33
+ }
34
+ export interface TransactionDestination {
35
+ method: TransactionMethod;
36
+ currency: string;
37
+ amount?: string;
38
+ address?: string;
39
+ lightningAddress?: string;
40
+ bolt11?: string;
41
+ accountNumber?: string;
42
+ bankCode?: string;
43
+ phoneNumber?: string;
44
+ recipientName?: string;
45
+ country?: string;
46
+ }
47
+ export interface CreateTransactionRequest {
48
+ sourceReq: TransactionSource;
49
+ destReq: TransactionDestination;
50
+ reference?: string;
51
+ metadata?: Record<string, unknown>;
52
+ }
53
+ export interface Transaction {
54
+ id: string;
55
+ reference: string;
56
+ status: TransactionStatus;
57
+ source: {
58
+ method: TransactionMethod;
59
+ currency: string;
60
+ amount: string;
61
+ };
62
+ destination: {
63
+ method: TransactionMethod;
64
+ currency: string;
65
+ amount: string;
66
+ address?: string;
67
+ };
68
+ fees: {
69
+ amount: string;
70
+ currency: string;
71
+ };
72
+ exchangeRate?: string;
73
+ paymentRequest?: string;
74
+ createdAt: string;
75
+ updatedAt: string;
76
+ completedAt?: string;
77
+ metadata?: Record<string, unknown>;
78
+ }
79
+ export interface TransactionListParams {
80
+ status?: TransactionStatus;
81
+ method?: TransactionMethod;
82
+ currency?: string;
83
+ fromDate?: string;
84
+ toDate?: string;
85
+ limit?: number;
86
+ offset?: number;
87
+ }
88
+ export interface TransactionListResponse {
89
+ transactions: Transaction[];
90
+ total: number;
91
+ limit: number;
92
+ offset: number;
93
+ }
94
+ export type WebhookEvent = "transaction.created" | "transaction.completed" | "transaction.failed" | "transaction.cancelled" | "deposit.received" | "withdrawal.completed";
95
+ export interface Webhook {
96
+ id: string;
97
+ url: string;
98
+ events: WebhookEvent[];
99
+ secret: string;
100
+ status: "active" | "inactive";
101
+ createdAt: string;
102
+ }
103
+ export interface CreateWebhookRequest {
104
+ url: string;
105
+ events: WebhookEvent[];
106
+ }
107
+ export interface UpdateWebhookRequest {
108
+ url?: string;
109
+ events?: WebhookEvent[];
110
+ status?: "active" | "inactive";
111
+ }
112
+ export interface FiatInstitution {
113
+ code: string;
114
+ name: string;
115
+ country: string;
116
+ type: "bank" | "mobile_money";
117
+ supportedCurrencies: string[];
118
+ }
119
+ export interface ApiResponse<T> {
120
+ success: boolean;
121
+ data?: T;
122
+ error?: {
123
+ code: string;
124
+ message: string;
125
+ };
126
+ }
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ // Neutron API Types
2
+ export {};
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "neutron-mcp",
3
+ "version": "1.0.0",
4
+ "description": "MCP server for Neutron - Lightning payments, Bitcoin, USDT, and fiat transactions for AI-powered applications",
5
+ "main": "dist/index.js",
6
+ "bin": {
7
+ "neutron-mcp": "dist/index.js"
8
+ },
9
+ "type": "module",
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "start": "node dist/index.js",
13
+ "dev": "tsx src/index.ts",
14
+ "prepublishOnly": "npm run build"
15
+ },
16
+ "keywords": [
17
+ "mcp",
18
+ "model-context-protocol",
19
+ "neutron",
20
+ "neutronpay",
21
+ "lightning",
22
+ "bitcoin",
23
+ "payments",
24
+ "usdt",
25
+ "stablecoin",
26
+ "fintech",
27
+ "ai",
28
+ "claude",
29
+ "cursor",
30
+ "windsurf",
31
+ "cline"
32
+ ],
33
+ "author": "Neutron <support@neutron.me>",
34
+ "license": "MIT",
35
+ "homepage": "https://neutron.me",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/neutroncreative/neutron-mcp.git"
39
+ },
40
+ "bugs": {
41
+ "url": "https://github.com/neutroncreative/neutron-mcp/issues"
42
+ },
43
+ "engines": {
44
+ "node": ">=18.0.0"
45
+ },
46
+ "files": [
47
+ "dist",
48
+ "README.md",
49
+ "LICENSE"
50
+ ],
51
+ "dependencies": {
52
+ "@modelcontextprotocol/sdk": "^1.0.0",
53
+ "zod": "^3.23.8"
54
+ },
55
+ "devDependencies": {
56
+ "@types/node": "^20.10.0",
57
+ "tsx": "^4.7.0",
58
+ "typescript": "^5.3.0"
59
+ }
60
+ }