lightning-faucet-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/README.md +168 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +317 -0
- package/dist/index.js.map +1 -0
- package/dist/lightning-faucet.d.ts +148 -0
- package/dist/lightning-faucet.d.ts.map +1 -0
- package/dist/lightning-faucet.js +174 -0
- package/dist/lightning-faucet.js.map +1 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Lightning Faucet MCP Server
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server that gives AI agents the ability to send and receive Bitcoin via the Lightning Network.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **check_balance** - Check your agent's current Lightning balance
|
|
8
|
+
- **pay_l402_api** - Pay for L402-protected API access automatically
|
|
9
|
+
- **pay_invoice** - Pay any BOLT11 Lightning invoice
|
|
10
|
+
- **create_invoice** - Generate invoices to receive payments
|
|
11
|
+
- **get_invoice_status** - Check if an invoice has been paid
|
|
12
|
+
- **get_transactions** - View transaction history
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
### 1. Get an API Key
|
|
17
|
+
|
|
18
|
+
Sign up at [https://lightningfaucet.com/ai-agents/](https://lightningfaucet.com/ai-agents/) to create an agent wallet and get your API key.
|
|
19
|
+
|
|
20
|
+
### 2. Install
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install -g lightning-faucet-mcp
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 3. Configure Claude Code
|
|
27
|
+
|
|
28
|
+
Add to your `~/.claude/settings.json`:
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"mcpServers": {
|
|
33
|
+
"lightning-faucet": {
|
|
34
|
+
"command": "npx",
|
|
35
|
+
"args": ["lightning-faucet-mcp"],
|
|
36
|
+
"env": {
|
|
37
|
+
"LIGHTNING_FAUCET_API_KEY": "your-api-key-here"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Or for project-specific configuration, add to `.claude/settings.json` in your project:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"mcpServers": {
|
|
49
|
+
"lightning-faucet": {
|
|
50
|
+
"command": "npx",
|
|
51
|
+
"args": ["lightning-faucet-mcp"],
|
|
52
|
+
"env": {
|
|
53
|
+
"LIGHTNING_FAUCET_API_KEY": "your-api-key-here"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Tools
|
|
61
|
+
|
|
62
|
+
### check_balance
|
|
63
|
+
|
|
64
|
+
Check your agent's current Lightning balance in satoshis.
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
No parameters required
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### pay_l402_api
|
|
71
|
+
|
|
72
|
+
Make a request to an L402-protected API. If the API requires payment (HTTP 402), the Lightning invoice is automatically paid and the request completed.
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
Parameters:
|
|
76
|
+
- url (required): The URL to request
|
|
77
|
+
- method: HTTP method (GET, POST, PUT, DELETE) - default: GET
|
|
78
|
+
- body: Request body for POST/PUT requests
|
|
79
|
+
- max_payment_sats: Maximum amount to pay - default: 1000 sats
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Example: Access a paid API that returns a fortune
|
|
83
|
+
```
|
|
84
|
+
pay_l402_api(url: "https://lightningfaucet.com/api/l402/fortune")
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### pay_invoice
|
|
88
|
+
|
|
89
|
+
Pay a BOLT11 Lightning invoice from your agent's balance.
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Parameters:
|
|
93
|
+
- bolt11 (required): The BOLT11 invoice string (starts with lnbc...)
|
|
94
|
+
- max_fee_sats: Maximum routing fee in satoshis
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Returns the preimage as proof of payment.
|
|
98
|
+
|
|
99
|
+
### create_invoice
|
|
100
|
+
|
|
101
|
+
Create a Lightning invoice to receive payment.
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
Parameters:
|
|
105
|
+
- amount_sats (required): Amount in satoshis to request (minimum: 1)
|
|
106
|
+
- memo: Description/memo for the invoice (max 640 chars)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Use `get_invoice_status` with the returned `payment_hash` to check if it's been paid.
|
|
110
|
+
|
|
111
|
+
### get_invoice_status
|
|
112
|
+
|
|
113
|
+
Check if a created invoice has been paid.
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
Parameters:
|
|
117
|
+
- payment_hash (required): The payment hash from create_invoice
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### get_transactions
|
|
121
|
+
|
|
122
|
+
Get your agent's transaction history.
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
Parameters:
|
|
126
|
+
- limit: Max transactions to return (1-200, default: 50)
|
|
127
|
+
- offset: Number to skip for pagination (default: 0)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Example Usage
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
// Check balance
|
|
134
|
+
await check_balance()
|
|
135
|
+
// Returns: { balance_sats: 5000, message: "Current balance: 5000 sats" }
|
|
136
|
+
|
|
137
|
+
// Create an invoice to receive 100 sats
|
|
138
|
+
await create_invoice({ amount_sats: 100, memo: "Payment for code review" })
|
|
139
|
+
// Returns: { bolt11: "lnbc1...", payment_hash: "abc123...", expires_at: "..." }
|
|
140
|
+
|
|
141
|
+
// Check if the invoice was paid
|
|
142
|
+
await get_invoice_status({ payment_hash: "abc123..." })
|
|
143
|
+
// Returns: { paid: true, amount_sats: 100, settled_at: "...", preimage: "..." }
|
|
144
|
+
|
|
145
|
+
// Pay someone else's invoice
|
|
146
|
+
await pay_invoice({ bolt11: "lnbc500n1..." })
|
|
147
|
+
// Returns: { preimage: "...", amount_sats: 500, fee_sats: 1, payment_hash: "..." }
|
|
148
|
+
|
|
149
|
+
// Access a paid API
|
|
150
|
+
await pay_l402_api({ url: "https://api.example.com/premium-data" })
|
|
151
|
+
// Returns: { data: {...}, amount_paid: 21, payment_hash: "..." }
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Security
|
|
155
|
+
|
|
156
|
+
- Your API key should be kept secret
|
|
157
|
+
- Use environment variables, not hardcoded values
|
|
158
|
+
- Each agent has its own isolated wallet
|
|
159
|
+
- Operators can set spending limits per agent
|
|
160
|
+
|
|
161
|
+
## Support
|
|
162
|
+
|
|
163
|
+
- Documentation: https://lightningfaucet.com/ai-agents/docs/
|
|
164
|
+
- Issues: https://github.com/lightningfaucet/mcp-server/issues
|
|
165
|
+
|
|
166
|
+
## License
|
|
167
|
+
|
|
168
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Lightning Faucet MCP Server
|
|
4
|
+
*
|
|
5
|
+
* Provides AI agents with Lightning Network payment capabilities via MCP.
|
|
6
|
+
*
|
|
7
|
+
* Configuration:
|
|
8
|
+
* Set LIGHTNING_FAUCET_API_KEY environment variable with your agent API key.
|
|
9
|
+
* Get an API key at: https://lightningfaucet.com/ai-agents/
|
|
10
|
+
*
|
|
11
|
+
* Usage with Claude Code:
|
|
12
|
+
* Add to .claude/settings.json:
|
|
13
|
+
* {
|
|
14
|
+
* "mcpServers": {
|
|
15
|
+
* "lightning-faucet": {
|
|
16
|
+
* "command": "npx",
|
|
17
|
+
* "args": ["@anthropic/lightning-faucet-mcp"],
|
|
18
|
+
* "env": {
|
|
19
|
+
* "LIGHTNING_FAUCET_API_KEY": "your-api-key-here"
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
*/
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* Lightning Faucet MCP Server
|
|
5
|
+
*
|
|
6
|
+
* Provides AI agents with Lightning Network payment capabilities via MCP.
|
|
7
|
+
*
|
|
8
|
+
* Configuration:
|
|
9
|
+
* Set LIGHTNING_FAUCET_API_KEY environment variable with your agent API key.
|
|
10
|
+
* Get an API key at: https://lightningfaucet.com/ai-agents/
|
|
11
|
+
*
|
|
12
|
+
* Usage with Claude Code:
|
|
13
|
+
* Add to .claude/settings.json:
|
|
14
|
+
* {
|
|
15
|
+
* "mcpServers": {
|
|
16
|
+
* "lightning-faucet": {
|
|
17
|
+
* "command": "npx",
|
|
18
|
+
* "args": ["@anthropic/lightning-faucet-mcp"],
|
|
19
|
+
* "env": {
|
|
20
|
+
* "LIGHTNING_FAUCET_API_KEY": "your-api-key-here"
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
|
28
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
29
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
30
|
+
const zod_1 = require("zod");
|
|
31
|
+
const lightning_faucet_js_1 = require("./lightning-faucet.js");
|
|
32
|
+
// Get API key from environment
|
|
33
|
+
const API_KEY = process.env.LIGHTNING_FAUCET_API_KEY;
|
|
34
|
+
if (!API_KEY) {
|
|
35
|
+
console.error('Error: LIGHTNING_FAUCET_API_KEY environment variable is required');
|
|
36
|
+
console.error('Get your API key at: https://lightningfaucet.com/ai-agents/');
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
const client = new lightning_faucet_js_1.LightningFaucetClient(API_KEY);
|
|
40
|
+
// Create MCP server
|
|
41
|
+
const server = new index_js_1.Server({
|
|
42
|
+
name: 'lightning-faucet',
|
|
43
|
+
version: '1.0.0',
|
|
44
|
+
}, {
|
|
45
|
+
capabilities: {
|
|
46
|
+
tools: {},
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
// Tool schemas
|
|
50
|
+
const CheckBalanceSchema = zod_1.z.object({});
|
|
51
|
+
const PayL402ApiSchema = zod_1.z.object({
|
|
52
|
+
url: zod_1.z.string().describe('The URL to request'),
|
|
53
|
+
method: zod_1.z.enum(['GET', 'POST', 'PUT', 'DELETE']).default('GET').describe('HTTP method'),
|
|
54
|
+
body: zod_1.z.string().optional().describe('Request body for POST/PUT requests'),
|
|
55
|
+
max_payment_sats: zod_1.z.number().min(1).max(100000).default(1000)
|
|
56
|
+
.describe('Maximum amount in satoshis to pay for this request'),
|
|
57
|
+
});
|
|
58
|
+
const PayInvoiceSchema = zod_1.z.object({
|
|
59
|
+
bolt11: zod_1.z.string().describe('BOLT11 invoice string to pay (starts with lnbc...)'),
|
|
60
|
+
max_fee_sats: zod_1.z.number().min(0).optional()
|
|
61
|
+
.describe('Maximum routing fee in satoshis (default: 10% of invoice amount)'),
|
|
62
|
+
});
|
|
63
|
+
const CreateInvoiceSchema = zod_1.z.object({
|
|
64
|
+
amount_sats: zod_1.z.number().min(1).describe('Amount in satoshis to request'),
|
|
65
|
+
memo: zod_1.z.string().max(640).optional().describe('Description/memo for the invoice'),
|
|
66
|
+
});
|
|
67
|
+
const GetInvoiceStatusSchema = zod_1.z.object({
|
|
68
|
+
payment_hash: zod_1.z.string().describe('Payment hash of the invoice to check'),
|
|
69
|
+
});
|
|
70
|
+
const GetTransactionsSchema = zod_1.z.object({
|
|
71
|
+
limit: zod_1.z.number().min(1).max(200).default(50).describe('Max transactions to return'),
|
|
72
|
+
offset: zod_1.z.number().min(0).default(0).describe('Number to skip for pagination'),
|
|
73
|
+
});
|
|
74
|
+
// List available tools
|
|
75
|
+
server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
|
|
76
|
+
tools: [
|
|
77
|
+
{
|
|
78
|
+
name: 'check_balance',
|
|
79
|
+
description: "Check your agent's current Lightning balance in satoshis",
|
|
80
|
+
inputSchema: {
|
|
81
|
+
type: 'object',
|
|
82
|
+
properties: {},
|
|
83
|
+
required: [],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: 'pay_l402_api',
|
|
88
|
+
description: 'Make a request to an L402-protected API. If payment is required (HTTP 402), automatically pay the Lightning invoice and complete the request.',
|
|
89
|
+
inputSchema: {
|
|
90
|
+
type: 'object',
|
|
91
|
+
properties: {
|
|
92
|
+
url: { type: 'string', description: 'The URL to request' },
|
|
93
|
+
method: {
|
|
94
|
+
type: 'string',
|
|
95
|
+
enum: ['GET', 'POST', 'PUT', 'DELETE'],
|
|
96
|
+
default: 'GET',
|
|
97
|
+
description: 'HTTP method',
|
|
98
|
+
},
|
|
99
|
+
body: { type: 'string', description: 'Request body for POST/PUT requests' },
|
|
100
|
+
max_payment_sats: {
|
|
101
|
+
type: 'integer',
|
|
102
|
+
minimum: 1,
|
|
103
|
+
maximum: 100000,
|
|
104
|
+
default: 1000,
|
|
105
|
+
description: 'Maximum amount in satoshis to pay for this request',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
required: ['url'],
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'pay_invoice',
|
|
113
|
+
description: 'Pay a BOLT11 Lightning invoice from the agent balance. Returns preimage as proof of payment.',
|
|
114
|
+
inputSchema: {
|
|
115
|
+
type: 'object',
|
|
116
|
+
properties: {
|
|
117
|
+
bolt11: { type: 'string', description: 'BOLT11 invoice string to pay (starts with lnbc...)' },
|
|
118
|
+
max_fee_sats: {
|
|
119
|
+
type: 'integer',
|
|
120
|
+
minimum: 0,
|
|
121
|
+
description: 'Maximum routing fee in satoshis',
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
required: ['bolt11'],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: 'create_invoice',
|
|
129
|
+
description: 'Create a Lightning invoice to receive payment. Use get_invoice_status to check if paid.',
|
|
130
|
+
inputSchema: {
|
|
131
|
+
type: 'object',
|
|
132
|
+
properties: {
|
|
133
|
+
amount_sats: { type: 'integer', minimum: 1, description: 'Amount in satoshis to request' },
|
|
134
|
+
memo: { type: 'string', maxLength: 640, description: 'Description/memo for the invoice' },
|
|
135
|
+
},
|
|
136
|
+
required: ['amount_sats'],
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: 'get_invoice_status',
|
|
141
|
+
description: 'Check if a created invoice has been paid. Use the payment_hash from create_invoice.',
|
|
142
|
+
inputSchema: {
|
|
143
|
+
type: 'object',
|
|
144
|
+
properties: {
|
|
145
|
+
payment_hash: { type: 'string', description: 'Payment hash of the invoice to check' },
|
|
146
|
+
},
|
|
147
|
+
required: ['payment_hash'],
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: 'get_transactions',
|
|
152
|
+
description: 'Get the agent transaction history. Returns both incoming and outgoing payments.',
|
|
153
|
+
inputSchema: {
|
|
154
|
+
type: 'object',
|
|
155
|
+
properties: {
|
|
156
|
+
limit: { type: 'integer', minimum: 1, maximum: 200, default: 50, description: 'Max transactions to return' },
|
|
157
|
+
offset: { type: 'integer', minimum: 0, default: 0, description: 'Number to skip for pagination' },
|
|
158
|
+
},
|
|
159
|
+
required: [],
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
}));
|
|
164
|
+
// Handle tool calls
|
|
165
|
+
server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
166
|
+
const { name, arguments: args } = request.params;
|
|
167
|
+
try {
|
|
168
|
+
switch (name) {
|
|
169
|
+
case 'check_balance': {
|
|
170
|
+
CheckBalanceSchema.parse(args);
|
|
171
|
+
const result = await client.checkBalance();
|
|
172
|
+
return {
|
|
173
|
+
content: [
|
|
174
|
+
{
|
|
175
|
+
type: 'text',
|
|
176
|
+
text: JSON.stringify({
|
|
177
|
+
success: true,
|
|
178
|
+
balance_sats: result.balanceSats,
|
|
179
|
+
message: `Current balance: ${result.balanceSats} sats`,
|
|
180
|
+
}, null, 2),
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
case 'pay_l402_api': {
|
|
186
|
+
const parsed = PayL402ApiSchema.parse(args);
|
|
187
|
+
const result = await client.l402Pay(parsed.url, parsed.method, parsed.body, parsed.max_payment_sats);
|
|
188
|
+
return {
|
|
189
|
+
content: [
|
|
190
|
+
{
|
|
191
|
+
type: 'text',
|
|
192
|
+
text: JSON.stringify({
|
|
193
|
+
success: true,
|
|
194
|
+
status_code: result.statusCode,
|
|
195
|
+
data: result.data,
|
|
196
|
+
payment_hash: result.paymentHash,
|
|
197
|
+
amount_paid: result.amountPaid,
|
|
198
|
+
fee: result.fee,
|
|
199
|
+
}, null, 2),
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
case 'pay_invoice': {
|
|
205
|
+
const parsed = PayInvoiceSchema.parse(args);
|
|
206
|
+
const result = await client.payInvoice(parsed.bolt11, parsed.max_fee_sats);
|
|
207
|
+
return {
|
|
208
|
+
content: [
|
|
209
|
+
{
|
|
210
|
+
type: 'text',
|
|
211
|
+
text: JSON.stringify({
|
|
212
|
+
success: true,
|
|
213
|
+
message: 'Invoice paid successfully',
|
|
214
|
+
preimage: result.preimage,
|
|
215
|
+
amount_sats: result.amountSats,
|
|
216
|
+
fee_sats: result.feeSats,
|
|
217
|
+
payment_hash: result.paymentHash,
|
|
218
|
+
new_balance: result.newBalance,
|
|
219
|
+
}, null, 2),
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
case 'create_invoice': {
|
|
225
|
+
const parsed = CreateInvoiceSchema.parse(args);
|
|
226
|
+
const result = await client.createInvoice(parsed.amount_sats, parsed.memo);
|
|
227
|
+
return {
|
|
228
|
+
content: [
|
|
229
|
+
{
|
|
230
|
+
type: 'text',
|
|
231
|
+
text: JSON.stringify({
|
|
232
|
+
success: true,
|
|
233
|
+
message: `Invoice created for ${parsed.amount_sats} sats`,
|
|
234
|
+
bolt11: result.bolt11,
|
|
235
|
+
payment_hash: result.paymentHash,
|
|
236
|
+
expires_at: result.expiresAt,
|
|
237
|
+
}, null, 2),
|
|
238
|
+
},
|
|
239
|
+
],
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
case 'get_invoice_status': {
|
|
243
|
+
const parsed = GetInvoiceStatusSchema.parse(args);
|
|
244
|
+
const result = await client.getInvoiceStatus(parsed.payment_hash);
|
|
245
|
+
return {
|
|
246
|
+
content: [
|
|
247
|
+
{
|
|
248
|
+
type: 'text',
|
|
249
|
+
text: JSON.stringify({
|
|
250
|
+
success: true,
|
|
251
|
+
paid: result.paid,
|
|
252
|
+
amount_sats: result.amountSats,
|
|
253
|
+
settled_at: result.settledAt,
|
|
254
|
+
preimage: result.preimage,
|
|
255
|
+
expired: result.expired,
|
|
256
|
+
new_balance: result.newBalance,
|
|
257
|
+
}, null, 2),
|
|
258
|
+
},
|
|
259
|
+
],
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
case 'get_transactions': {
|
|
263
|
+
const parsed = GetTransactionsSchema.parse(args);
|
|
264
|
+
const result = await client.getTransactions(parsed.limit, parsed.offset);
|
|
265
|
+
return {
|
|
266
|
+
content: [
|
|
267
|
+
{
|
|
268
|
+
type: 'text',
|
|
269
|
+
text: JSON.stringify({
|
|
270
|
+
success: true,
|
|
271
|
+
transactions: result.transactions,
|
|
272
|
+
total: result.total,
|
|
273
|
+
has_more: result.hasMore,
|
|
274
|
+
}, null, 2),
|
|
275
|
+
},
|
|
276
|
+
],
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
default:
|
|
280
|
+
return {
|
|
281
|
+
content: [
|
|
282
|
+
{
|
|
283
|
+
type: 'text',
|
|
284
|
+
text: JSON.stringify({ success: false, error: `Unknown tool: ${name}` }),
|
|
285
|
+
},
|
|
286
|
+
],
|
|
287
|
+
isError: true,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
293
|
+
return {
|
|
294
|
+
content: [
|
|
295
|
+
{
|
|
296
|
+
type: 'text',
|
|
297
|
+
text: JSON.stringify({
|
|
298
|
+
success: false,
|
|
299
|
+
error: errorMessage,
|
|
300
|
+
}, null, 2),
|
|
301
|
+
},
|
|
302
|
+
],
|
|
303
|
+
isError: true,
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
// Start the server
|
|
308
|
+
async function main() {
|
|
309
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
310
|
+
await server.connect(transport);
|
|
311
|
+
console.error('Lightning Faucet MCP server running on stdio');
|
|
312
|
+
}
|
|
313
|
+
main().catch((error) => {
|
|
314
|
+
console.error('Fatal error:', error);
|
|
315
|
+
process.exit(1);
|
|
316
|
+
});
|
|
317
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[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,EAAE,CAAC;yBACzE;qBACF;oBACD,OAAO,EAAE,IAAI;iBACd,CAAC;QACN,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QAC9E,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,YAAY;qBACpB,EAAE,IAAI,EAAE,CAAC,CAAC;iBACZ;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,mBAAmB;AACnB,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;AAChE,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightning Faucet API Client
|
|
3
|
+
*
|
|
4
|
+
* Handles communication with the Lightning Faucet AI Agent Wallet API.
|
|
5
|
+
*/
|
|
6
|
+
interface ApiResponse {
|
|
7
|
+
success: boolean;
|
|
8
|
+
error?: string;
|
|
9
|
+
}
|
|
10
|
+
interface BalanceResponse extends ApiResponse {
|
|
11
|
+
balance_sats?: number;
|
|
12
|
+
balance?: number;
|
|
13
|
+
}
|
|
14
|
+
interface L402PayResponse extends ApiResponse {
|
|
15
|
+
data?: unknown;
|
|
16
|
+
body?: string;
|
|
17
|
+
status_code?: number;
|
|
18
|
+
payment_hash?: string;
|
|
19
|
+
amount_paid?: number;
|
|
20
|
+
fee?: number;
|
|
21
|
+
}
|
|
22
|
+
interface PayInvoiceResponse extends ApiResponse {
|
|
23
|
+
preimage?: string;
|
|
24
|
+
payment_preimage?: string;
|
|
25
|
+
amount_sats?: number;
|
|
26
|
+
amount_paid?: number;
|
|
27
|
+
fee_sats?: number;
|
|
28
|
+
fee?: number;
|
|
29
|
+
payment_hash?: string;
|
|
30
|
+
total_cost?: number;
|
|
31
|
+
new_balance?: number;
|
|
32
|
+
}
|
|
33
|
+
interface CreateInvoiceResponse extends ApiResponse {
|
|
34
|
+
bolt11?: string;
|
|
35
|
+
invoice?: string;
|
|
36
|
+
payment_request?: string;
|
|
37
|
+
payment_hash?: string;
|
|
38
|
+
amount_sats?: number;
|
|
39
|
+
memo?: string;
|
|
40
|
+
expires_at?: string;
|
|
41
|
+
}
|
|
42
|
+
interface InvoiceStatusResponse extends ApiResponse {
|
|
43
|
+
status?: string;
|
|
44
|
+
paid?: boolean;
|
|
45
|
+
settled?: boolean;
|
|
46
|
+
amount_sats?: number;
|
|
47
|
+
memo?: string;
|
|
48
|
+
expires_at?: string;
|
|
49
|
+
settled_at?: string;
|
|
50
|
+
preimage?: string;
|
|
51
|
+
expired?: boolean;
|
|
52
|
+
new_balance?: number;
|
|
53
|
+
}
|
|
54
|
+
interface Transaction {
|
|
55
|
+
type: string;
|
|
56
|
+
amount_sats: number;
|
|
57
|
+
fee_sats?: number;
|
|
58
|
+
memo?: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
payment_hash?: string;
|
|
61
|
+
timestamp?: string;
|
|
62
|
+
created_at?: string;
|
|
63
|
+
settled_at?: string;
|
|
64
|
+
destination?: string;
|
|
65
|
+
balance_after?: number;
|
|
66
|
+
}
|
|
67
|
+
interface GetTransactionsResponse extends ApiResponse {
|
|
68
|
+
transactions?: Transaction[];
|
|
69
|
+
total?: number;
|
|
70
|
+
has_more?: boolean;
|
|
71
|
+
}
|
|
72
|
+
export declare class LightningFaucetClient {
|
|
73
|
+
private apiKey;
|
|
74
|
+
constructor(apiKey: string);
|
|
75
|
+
/**
|
|
76
|
+
* Make an API request to Lightning Faucet
|
|
77
|
+
*/
|
|
78
|
+
private request;
|
|
79
|
+
/**
|
|
80
|
+
* Check the agent's current balance
|
|
81
|
+
*/
|
|
82
|
+
checkBalance(): Promise<{
|
|
83
|
+
balanceSats: number;
|
|
84
|
+
rawResponse: BalanceResponse;
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* Pay an L402-protected API endpoint
|
|
88
|
+
*/
|
|
89
|
+
l402Pay(url: string, method?: string, body?: string, maxPaymentSats?: number): Promise<{
|
|
90
|
+
data: unknown;
|
|
91
|
+
statusCode: number;
|
|
92
|
+
paymentHash?: string;
|
|
93
|
+
amountPaid?: number;
|
|
94
|
+
fee?: number;
|
|
95
|
+
rawResponse: L402PayResponse;
|
|
96
|
+
}>;
|
|
97
|
+
/**
|
|
98
|
+
* Pay a BOLT11 Lightning invoice
|
|
99
|
+
*/
|
|
100
|
+
payInvoice(bolt11: string, maxFeeSats?: number): Promise<{
|
|
101
|
+
preimage: string;
|
|
102
|
+
amountSats: number;
|
|
103
|
+
feeSats: number;
|
|
104
|
+
paymentHash: string;
|
|
105
|
+
newBalance: number;
|
|
106
|
+
rawResponse: PayInvoiceResponse;
|
|
107
|
+
}>;
|
|
108
|
+
/**
|
|
109
|
+
* Create a Lightning invoice to receive payment
|
|
110
|
+
*/
|
|
111
|
+
createInvoice(amountSats: number, memo?: string): Promise<{
|
|
112
|
+
bolt11: string;
|
|
113
|
+
paymentHash: string;
|
|
114
|
+
expiresAt: string;
|
|
115
|
+
rawResponse: CreateInvoiceResponse;
|
|
116
|
+
}>;
|
|
117
|
+
/**
|
|
118
|
+
* Check if an invoice has been paid
|
|
119
|
+
*/
|
|
120
|
+
getInvoiceStatus(paymentHash: string): Promise<{
|
|
121
|
+
paid: boolean;
|
|
122
|
+
amountSats: number;
|
|
123
|
+
settledAt?: string;
|
|
124
|
+
preimage?: string;
|
|
125
|
+
expired: boolean;
|
|
126
|
+
newBalance?: number;
|
|
127
|
+
rawResponse: InvoiceStatusResponse;
|
|
128
|
+
}>;
|
|
129
|
+
/**
|
|
130
|
+
* Get transaction history
|
|
131
|
+
*/
|
|
132
|
+
getTransactions(limit?: number, offset?: number): Promise<{
|
|
133
|
+
transactions: Array<{
|
|
134
|
+
type: 'incoming' | 'outgoing';
|
|
135
|
+
amountSats: number;
|
|
136
|
+
feeSats?: number;
|
|
137
|
+
memo?: string;
|
|
138
|
+
paymentHash?: string;
|
|
139
|
+
timestamp?: string;
|
|
140
|
+
balanceAfter?: number;
|
|
141
|
+
}>;
|
|
142
|
+
total: number;
|
|
143
|
+
hasMore: boolean;
|
|
144
|
+
rawResponse: GetTransactionsResponse;
|
|
145
|
+
}>;
|
|
146
|
+
}
|
|
147
|
+
export {};
|
|
148
|
+
//# sourceMappingURL=lightning-faucet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lightning-faucet.d.ts","sourceRoot":"","sources":["../src/lightning-faucet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,UAAU,WAAW;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,eAAgB,SAAQ,WAAW;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,eAAgB,SAAQ,WAAW;IAC3C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GA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ent Wallet API.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.LightningFaucetClient = void 0;
|
|
9
|
+
const API_BASE_URL = 'https://lightningfaucet.com/ai-agents/api.php';
|
|
10
|
+
class LightningFaucetClient {
|
|
11
|
+
apiKey;
|
|
12
|
+
constructor(apiKey) {
|
|
13
|
+
if (!apiKey) {
|
|
14
|
+
throw new Error('API key is required');
|
|
15
|
+
}
|
|
16
|
+
this.apiKey = apiKey;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Make an API request to Lightning Faucet
|
|
20
|
+
*/
|
|
21
|
+
async request(action, data = {}) {
|
|
22
|
+
const payload = {
|
|
23
|
+
action,
|
|
24
|
+
api_key: this.apiKey,
|
|
25
|
+
...data,
|
|
26
|
+
};
|
|
27
|
+
const response = await fetch(API_BASE_URL, {
|
|
28
|
+
method: 'POST',
|
|
29
|
+
headers: {
|
|
30
|
+
'Content-Type': 'application/json',
|
|
31
|
+
},
|
|
32
|
+
body: JSON.stringify(payload),
|
|
33
|
+
});
|
|
34
|
+
if (!response.ok) {
|
|
35
|
+
throw new Error(`HTTP error: ${response.status} ${response.statusText}`);
|
|
36
|
+
}
|
|
37
|
+
const result = await response.json();
|
|
38
|
+
if (!result.success) {
|
|
39
|
+
throw new Error(result.error || 'Unknown API error');
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Check the agent's current balance
|
|
45
|
+
*/
|
|
46
|
+
async checkBalance() {
|
|
47
|
+
const result = await this.request('get_balance');
|
|
48
|
+
return {
|
|
49
|
+
balanceSats: result.balance_sats || result.balance || 0,
|
|
50
|
+
rawResponse: result,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Pay an L402-protected API endpoint
|
|
55
|
+
*/
|
|
56
|
+
async l402Pay(url, method = 'GET', body, maxPaymentSats = 1000) {
|
|
57
|
+
const requestData = {
|
|
58
|
+
url,
|
|
59
|
+
method: method.toUpperCase(),
|
|
60
|
+
max_payment_sats: maxPaymentSats,
|
|
61
|
+
};
|
|
62
|
+
if (body) {
|
|
63
|
+
requestData.body = body;
|
|
64
|
+
}
|
|
65
|
+
const result = await this.request('l402_pay', requestData);
|
|
66
|
+
let responseData;
|
|
67
|
+
if (result.body) {
|
|
68
|
+
try {
|
|
69
|
+
responseData = JSON.parse(result.body);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
responseData = result.body;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
responseData = result.data;
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
data: responseData,
|
|
80
|
+
statusCode: result.status_code || 200,
|
|
81
|
+
paymentHash: result.payment_hash,
|
|
82
|
+
amountPaid: result.amount_paid,
|
|
83
|
+
fee: result.fee,
|
|
84
|
+
rawResponse: result,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Pay a BOLT11 Lightning invoice
|
|
89
|
+
*/
|
|
90
|
+
async payInvoice(bolt11, maxFeeSats) {
|
|
91
|
+
const data = {
|
|
92
|
+
invoice: bolt11,
|
|
93
|
+
};
|
|
94
|
+
if (maxFeeSats !== undefined) {
|
|
95
|
+
data.max_fee_sats = maxFeeSats;
|
|
96
|
+
}
|
|
97
|
+
const result = await this.request('pay_invoice', data);
|
|
98
|
+
return {
|
|
99
|
+
preimage: result.preimage || result.payment_preimage || '',
|
|
100
|
+
amountSats: result.amount_sats || result.amount_paid || 0,
|
|
101
|
+
feeSats: result.fee_sats || result.fee || 0,
|
|
102
|
+
paymentHash: result.payment_hash || '',
|
|
103
|
+
newBalance: result.new_balance || 0,
|
|
104
|
+
rawResponse: result,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Create a Lightning invoice to receive payment
|
|
109
|
+
*/
|
|
110
|
+
async createInvoice(amountSats, memo) {
|
|
111
|
+
const data = {
|
|
112
|
+
amount_sats: amountSats,
|
|
113
|
+
};
|
|
114
|
+
if (memo) {
|
|
115
|
+
data.memo = memo;
|
|
116
|
+
}
|
|
117
|
+
const result = await this.request('create_invoice', data);
|
|
118
|
+
const bolt11 = result.bolt11 || result.invoice || result.payment_request;
|
|
119
|
+
if (!bolt11) {
|
|
120
|
+
throw new Error('No invoice returned from API');
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
bolt11,
|
|
124
|
+
paymentHash: result.payment_hash || '',
|
|
125
|
+
expiresAt: result.expires_at || '',
|
|
126
|
+
rawResponse: result,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Check if an invoice has been paid
|
|
131
|
+
*/
|
|
132
|
+
async getInvoiceStatus(paymentHash) {
|
|
133
|
+
const result = await this.request('get_invoice_status', {
|
|
134
|
+
payment_hash: paymentHash,
|
|
135
|
+
});
|
|
136
|
+
const paid = result.paid || result.settled || result.status === 'settled';
|
|
137
|
+
return {
|
|
138
|
+
paid,
|
|
139
|
+
amountSats: result.amount_sats || 0,
|
|
140
|
+
settledAt: result.settled_at,
|
|
141
|
+
preimage: result.preimage,
|
|
142
|
+
expired: result.expired || false,
|
|
143
|
+
newBalance: result.new_balance,
|
|
144
|
+
rawResponse: result,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Get transaction history
|
|
149
|
+
*/
|
|
150
|
+
async getTransactions(limit = 50, offset = 0) {
|
|
151
|
+
const result = await this.request('get_transactions', {
|
|
152
|
+
limit,
|
|
153
|
+
offset,
|
|
154
|
+
});
|
|
155
|
+
const transactions = (result.transactions || []).map(tx => ({
|
|
156
|
+
type: (tx.type === 'deposit' || tx.type === 'incoming' || tx.amount_sats > 0
|
|
157
|
+
? 'incoming' : 'outgoing'),
|
|
158
|
+
amountSats: Math.abs(tx.amount_sats),
|
|
159
|
+
feeSats: tx.fee_sats,
|
|
160
|
+
memo: tx.memo || tx.description,
|
|
161
|
+
paymentHash: tx.payment_hash,
|
|
162
|
+
timestamp: tx.timestamp || tx.created_at || tx.settled_at,
|
|
163
|
+
balanceAfter: tx.balance_after,
|
|
164
|
+
}));
|
|
165
|
+
return {
|
|
166
|
+
transactions,
|
|
167
|
+
total: result.total || transactions.length,
|
|
168
|
+
hasMore: result.has_more || false,
|
|
169
|
+
rawResponse: result,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
exports.LightningFaucetClient = LightningFaucetClient;
|
|
174
|
+
//# sourceMappingURL=lightning-faucet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lightning-faucet.js","sourceRoot":"","sources":["../src/lightning-faucet.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,MAAM,YAAY,GAAG,+CAA+C,CAAC;AA6ErE,MAAa,qBAAqB;IACxB,MAAM,CAAS;IAEvB,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACzC,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,OAAO,CACnB,MAAc,EACd,OAAgC,EAAE;QAElC,MAAM,OAAO,GAAG;YACd,MAAM;YACN,OAAO,EAAE,IAAI,CAAC,MAAM;YACpB,GAAG,IAAI;SACR,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,YAAY,EAAE;YACzC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;SAC9B,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,eAAe,QAAQ,CAAC,MAAM,IAAI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I,KAAK,SAAS,IAAI,EAAE,CAAC,IAAI,KAAK,UAAU,IAAI,EAAE,CAAC,WAAW,GAAG,CAAC;gBAC1E,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAA4B;YACvD,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC;YACpC,OAAO,EAAE,EAAE,CAAC,QAAQ;YACpB,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW;YAC/B,WAAW,EAAE,EAAE,CAAC,YAAY;YAC5B,SAAS,EAAE,EAAE,CAAC,SAAS,IAAI,EAAE,CAAC,UAAU,IAAI,EAAE,CAAC,UAAU;YACzD,YAAY,EAAE,EAAE,CAAC,aAAa;SAC/B,CAAC,CAAC,CAAC;QAEJ,OAAO;YACL,YAAY;YACZ,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,YAAY,CAAC,MAAM;YAC1C,OAAO,EAAE,MAAM,CAAC,QAAQ,IAAI,KAAK;YACjC,WAAW,EAAE,MAAM;SACpB,CAAC;IACJ,CAAC;CACF;AAxPD,sDAwPC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lightning-faucet-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MCP server for Lightning Faucet AI Agent Wallet - enables AI agents to send and receive Bitcoin via Lightning Network",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"lightning-faucet-mcp": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"watch": "tsc --watch",
|
|
13
|
+
"start": "node dist/index.js",
|
|
14
|
+
"prepublishOnly": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"mcp",
|
|
18
|
+
"lightning",
|
|
19
|
+
"bitcoin",
|
|
20
|
+
"ai-agent",
|
|
21
|
+
"l402",
|
|
22
|
+
"payments"
|
|
23
|
+
],
|
|
24
|
+
"author": "Lightning Faucet",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/lightningfaucet/mcp-server"
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18.0.0"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
35
|
+
"zod": "^3.22.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^20.10.0",
|
|
39
|
+
"typescript": "^5.3.0"
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"dist",
|
|
43
|
+
"README.md"
|
|
44
|
+
]
|
|
45
|
+
}
|