@fluxa-pay/fluxa-connect-mcp 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -0
- package/dist/payment-client.d.ts +49 -0
- package/dist/payment-client.d.ts.map +1 -0
- package/dist/payment-client.js +162 -0
- package/dist/payment-client.js.map +1 -0
- package/dist/stdio-server.d.ts +7 -0
- package/dist/stdio-server.d.ts.map +1 -0
- package/dist/stdio-server.js +164 -0
- package/dist/stdio-server.js.map +1 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# FluxA Connect MCP
|
|
2
|
+
|
|
3
|
+
Automatic X402 payment handling for MCP servers in Claude Code.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @fluxa-pay/fluxa-connect-mcp@latest --url <mcp-server-url>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage with Claude Code
|
|
12
|
+
|
|
13
|
+
Add to your `.mcp.json`:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"mcpServers": {
|
|
18
|
+
"my-server": {
|
|
19
|
+
"command": "npx",
|
|
20
|
+
"args": [
|
|
21
|
+
"-y",
|
|
22
|
+
"@fluxa-pay/fluxa-connect-mcp@latest",
|
|
23
|
+
"--url",
|
|
24
|
+
"https://api.fluxapay.xyz/mcp/<your-config-id>"
|
|
25
|
+
],
|
|
26
|
+
"env": {
|
|
27
|
+
"AGENT_EMAIL": "your@email.com",
|
|
28
|
+
"AGENT_NAME": "Claude Code - agentwallet.fluxapay.xyz",
|
|
29
|
+
"CLIENT_INFO": "Claude Code on macOS",
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
To use it directly
|
|
37
|
+
```bash
|
|
38
|
+
claude mcp add-json <your-config-id> '{"command":"npx","args":["-y","@fluxa-pay/fluxa-connect-mcp","--url","https://fluxa-servers-connection.up.railway.app/mcp/<config-id>"],"env":{"AGENT_EMAIL":"your@email.com","AGENT_NAME":"Claude Code - agentwallet.fluxapay.xyz","CLIENT_INFO":"Claude Code on macOS"}}'
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Required Environment Variables
|
|
42
|
+
|
|
43
|
+
- `AGENT_EMAIL` - Your email address
|
|
44
|
+
- `AGENT_NAME` - A name for your agent (e.g., "Claude Code - John's Laptop")
|
|
45
|
+
|
|
46
|
+
## Optional Environment Variables
|
|
47
|
+
|
|
48
|
+
- `EVM_NETWORK` - Payment network (default: `base`)
|
|
49
|
+
- Supported: `base`, `base-sepolia`, `avalanche`, `avalanche-fuji`, `iotex`, `sei`, `sei-testnet`, `polygon-amoy`, `solana`, `solana-devnet`
|
|
50
|
+
|
|
51
|
+
## Troubleshooting
|
|
52
|
+
|
|
53
|
+
**Agent not authorized?**
|
|
54
|
+
Open the authorization link provided in the error message.
|
|
55
|
+
|
|
56
|
+
**Payment needs approval?**
|
|
57
|
+
Open the approval link provided in the error message.
|
|
58
|
+
|
|
59
|
+
## Our website
|
|
60
|
+
|
|
61
|
+
Visit us at [FluxA](https://www.fluxapay.xyz/)
|
|
62
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom X402 Payment Client Wrapper
|
|
3
|
+
* Uses FluxA Wallet Service for payment signing
|
|
4
|
+
*/
|
|
5
|
+
import type { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
6
|
+
interface PaymentOption {
|
|
7
|
+
scheme: string;
|
|
8
|
+
network: string;
|
|
9
|
+
maxAmountRequired: string;
|
|
10
|
+
payTo: string;
|
|
11
|
+
asset: string;
|
|
12
|
+
maxTimeoutSeconds: number;
|
|
13
|
+
resource: string;
|
|
14
|
+
mimeType: string;
|
|
15
|
+
description: string;
|
|
16
|
+
extra?: any;
|
|
17
|
+
}
|
|
18
|
+
interface PaymentClientConfig {
|
|
19
|
+
fluxaWalletServiceUrl: string;
|
|
20
|
+
agentJwt: string;
|
|
21
|
+
agentName: string;
|
|
22
|
+
network: string;
|
|
23
|
+
confirmationCallback?: (options: PaymentOption[]) => Promise<boolean>;
|
|
24
|
+
}
|
|
25
|
+
export declare function createPaymentClient(client: Client, config: PaymentClientConfig): Client<{
|
|
26
|
+
method: string;
|
|
27
|
+
params?: {
|
|
28
|
+
[x: string]: unknown;
|
|
29
|
+
_meta?: {
|
|
30
|
+
[x: string]: unknown;
|
|
31
|
+
progressToken?: string | number | undefined;
|
|
32
|
+
} | undefined;
|
|
33
|
+
} | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
method: string;
|
|
36
|
+
params?: {
|
|
37
|
+
[x: string]: unknown;
|
|
38
|
+
_meta?: {
|
|
39
|
+
[x: string]: unknown;
|
|
40
|
+
} | undefined;
|
|
41
|
+
} | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
[x: string]: unknown;
|
|
44
|
+
_meta?: {
|
|
45
|
+
[x: string]: unknown;
|
|
46
|
+
} | undefined;
|
|
47
|
+
}>;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=payment-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-client.d.ts","sourceRoot":"","sources":["../payment-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAGxE,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb;AAED,UAAU,mBAAmB;IAC3B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACvE;AAQD,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;;;;;GAuL5B"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom X402 Payment Client Wrapper
|
|
3
|
+
* Uses FluxA Wallet Service for payment signing
|
|
4
|
+
*/
|
|
5
|
+
import axios from 'axios';
|
|
6
|
+
export function createPaymentClient(client, config) {
|
|
7
|
+
const { fluxaWalletServiceUrl, agentJwt, agentName, network, confirmationCallback } = config;
|
|
8
|
+
// Store the original callTool method
|
|
9
|
+
const originalCallTool = client.callTool.bind(client);
|
|
10
|
+
// Override callTool with payment logic
|
|
11
|
+
client.callTool = async (params, resultSchema, options) => {
|
|
12
|
+
console.error('[CUSTOM-PAYMENT-CLIENT] Calling tool:', params.name);
|
|
13
|
+
// First attempt - call without payment
|
|
14
|
+
let result = await originalCallTool(params, resultSchema, options);
|
|
15
|
+
// Check if payment is required
|
|
16
|
+
const paymentError = result._meta?.['x402/error'];
|
|
17
|
+
if (result.isError && paymentError?.accepts) {
|
|
18
|
+
console.error('[CUSTOM-PAYMENT-CLIENT] Payment required');
|
|
19
|
+
const paymentOptions = paymentError.accepts;
|
|
20
|
+
// Show payment options to user (if callback provided)
|
|
21
|
+
if (confirmationCallback) {
|
|
22
|
+
const approved = await confirmationCallback(paymentOptions);
|
|
23
|
+
if (!approved) {
|
|
24
|
+
console.error('[CUSTOM-PAYMENT-CLIENT] Payment declined by user');
|
|
25
|
+
return {
|
|
26
|
+
isError: true,
|
|
27
|
+
content: [{ type: 'text', text: 'Payment declined' }]
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// Find payment option for our network
|
|
32
|
+
const selectedOption = paymentOptions.find(opt => opt.network === network);
|
|
33
|
+
if (!selectedOption) {
|
|
34
|
+
console.error(`[CUSTOM-PAYMENT-CLIENT] No payment option for network: ${network}`);
|
|
35
|
+
return {
|
|
36
|
+
isError: true,
|
|
37
|
+
content: [{ type: 'text', text: `Payment network ${network} not supported` }]
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
console.error('[CUSTOM-PAYMENT-CLIENT] Creating payment via FluxA Wallet Service...');
|
|
41
|
+
// Extract host from resource URL
|
|
42
|
+
let host;
|
|
43
|
+
try {
|
|
44
|
+
const resourceUrl = new URL(selectedOption.resource);
|
|
45
|
+
host = resourceUrl.hostname;
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
// If resource is not a full URL, try to extract from scheme
|
|
49
|
+
host = selectedOption.resource.replace('mcp://', '').split('/')[0];
|
|
50
|
+
}
|
|
51
|
+
// Call FluxA Wallet Service to create payment
|
|
52
|
+
let paymentResponse;
|
|
53
|
+
try {
|
|
54
|
+
const requestData = {
|
|
55
|
+
scheme: selectedOption.scheme,
|
|
56
|
+
network: selectedOption.network,
|
|
57
|
+
amount: selectedOption.maxAmountRequired,
|
|
58
|
+
currency: 'USDC',
|
|
59
|
+
assetAddress: selectedOption.asset,
|
|
60
|
+
payTo: selectedOption.payTo,
|
|
61
|
+
host: host,
|
|
62
|
+
resource: selectedOption.resource,
|
|
63
|
+
description: selectedOption.description,
|
|
64
|
+
tokenName: selectedOption.extra?.name || 'USDC',
|
|
65
|
+
tokenVersion: selectedOption.extra?.version || '2',
|
|
66
|
+
validityWindowSeconds: selectedOption.maxTimeoutSeconds || 60
|
|
67
|
+
};
|
|
68
|
+
// Sanitize URL - ensure no double slashes
|
|
69
|
+
const baseUrl = fluxaWalletServiceUrl.endsWith('/')
|
|
70
|
+
? fluxaWalletServiceUrl.slice(0, -1)
|
|
71
|
+
: fluxaWalletServiceUrl;
|
|
72
|
+
const paymentUrl = `${baseUrl}/api/payment/x402V1Payment`;
|
|
73
|
+
console.error('[CUSTOM-PAYMENT-CLIENT] Request URL:', paymentUrl);
|
|
74
|
+
console.error('[CUSTOM-PAYMENT-CLIENT] JWT length:', agentJwt.length);
|
|
75
|
+
console.error('[CUSTOM-PAYMENT-CLIENT] JWT (first 50 chars):', agentJwt.substring(0, 50));
|
|
76
|
+
console.error('[CUSTOM-PAYMENT-CLIENT] Request data:', JSON.stringify(requestData, null, 2));
|
|
77
|
+
const response = await axios.post(paymentUrl, requestData, {
|
|
78
|
+
headers: {
|
|
79
|
+
'Authorization': `Bearer ${agentJwt}`,
|
|
80
|
+
'Content-Type': 'application/json'
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
paymentResponse = response.data;
|
|
84
|
+
console.error('[CUSTOM-PAYMENT-CLIENT] Payment response status:', paymentResponse.status);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
console.error('[CUSTOM-PAYMENT-CLIENT] FluxA Wallet Service error:', error.message);
|
|
88
|
+
if (error.response) {
|
|
89
|
+
console.error('[CUSTOM-PAYMENT-CLIENT] Response status:', error.response.status);
|
|
90
|
+
console.error('[CUSTOM-PAYMENT-CLIENT] Response data:', JSON.stringify(error.response.data, null, 2));
|
|
91
|
+
const errorData = error.response.data;
|
|
92
|
+
// If there's a payment_model_context with agent_not_found, build authorization link
|
|
93
|
+
if (errorData.payment_model_context && errorData.code === 'agent_not_found') {
|
|
94
|
+
const instructions = errorData.payment_model_context.instructions || '';
|
|
95
|
+
// Extract agent_id from instructions (it's in the error message)
|
|
96
|
+
const agentIdMatch = instructions.match(/ID:\s*([a-f0-9-]+)/i);
|
|
97
|
+
const agentId = agentIdMatch ? agentIdMatch[1] : '';
|
|
98
|
+
let message = `Payment failed: ${errorData.message || error.message}\n\n`;
|
|
99
|
+
if (agentId) {
|
|
100
|
+
const encodedName = encodeURIComponent(agentName);
|
|
101
|
+
const authUrl = `https://agentwallet.fluxapay.xyz/add-agent?agentId=${agentId}&name=${encodedName}`;
|
|
102
|
+
message += `Your agent needs to be authorized in FluxA wallet.\n\n`;
|
|
103
|
+
message += `Please open this link to authorize:\n${authUrl}\n\n`;
|
|
104
|
+
message += `After authorization, please retry this request.`;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
message += instructions;
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
isError: true,
|
|
111
|
+
content: [{
|
|
112
|
+
type: 'text',
|
|
113
|
+
text: message
|
|
114
|
+
}]
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
// For other payment_model_context errors, pass through instructions
|
|
118
|
+
if (errorData.payment_model_context) {
|
|
119
|
+
const instructions = errorData.payment_model_context.instructions || '';
|
|
120
|
+
return {
|
|
121
|
+
isError: true,
|
|
122
|
+
content: [{
|
|
123
|
+
type: 'text',
|
|
124
|
+
text: `Payment failed: ${errorData.message || error.message}\n\n${instructions}`
|
|
125
|
+
}]
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
isError: true,
|
|
131
|
+
content: [{ type: 'text', text: `Payment creation failed: ${error.message}` }]
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
// Check if payment needs user approval
|
|
135
|
+
if (paymentResponse.status === 'need_approval') {
|
|
136
|
+
console.error('[CUSTOM-PAYMENT-CLIENT] Payment requires user approval:', paymentResponse.approvalUrl);
|
|
137
|
+
return {
|
|
138
|
+
isError: true,
|
|
139
|
+
content: [{
|
|
140
|
+
type: 'text',
|
|
141
|
+
text: `Payment requires approval. Please visit: ${paymentResponse.approvalUrl}\nThen retry this operation.`
|
|
142
|
+
}]
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
// Encode payment as base64
|
|
146
|
+
const paymentToken = Buffer.from(JSON.stringify(paymentResponse.xPayment || paymentResponse)).toString('base64');
|
|
147
|
+
console.error('[CUSTOM-PAYMENT-CLIENT] Payment token created, retrying with payment...');
|
|
148
|
+
// Retry with payment token
|
|
149
|
+
result = await originalCallTool({
|
|
150
|
+
...params,
|
|
151
|
+
_meta: {
|
|
152
|
+
...(params._meta || {}),
|
|
153
|
+
'x402/payment': paymentToken
|
|
154
|
+
}
|
|
155
|
+
}, resultSchema, options);
|
|
156
|
+
console.error('[CUSTOM-PAYMENT-CLIENT] Tool call with payment completed');
|
|
157
|
+
}
|
|
158
|
+
return result;
|
|
159
|
+
};
|
|
160
|
+
return client;
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=payment-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-client.js","sourceRoot":"","sources":["../payment-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AA6B1B,MAAM,UAAU,mBAAmB,CACjC,MAAc,EACd,MAA2B;IAE3B,MAAM,EAAE,qBAAqB,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC;IAE7F,qCAAqC;IACrC,MAAM,gBAAgB,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEtD,uCAAuC;IACvC,MAAM,CAAC,QAAQ,GAAG,KAAK,EAAE,MAAW,EAAE,YAAkB,EAAE,OAAa,EAAE,EAAE;QACzE,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAEpE,uCAAuC;QACvC,IAAI,MAAM,GAAG,MAAM,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;QAEnE,+BAA+B;QAC/B,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC,YAAY,CAA0B,CA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C,WAAW,CAAC,CAAC;gBACtG,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,CAAC;4BACR,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,4CAA4C,eAAe,CAAC,WAAW,8BAA8B;yBAC5G,CAAC;iBACH,CAAC;YACJ,CAAC;YAED,2BAA2B;YAC3B,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,QAAQ,IAAI,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAEjH,OAAO,CAAC,KAAK,CAAC,yEAAyE,CAAC,CAAC;YAEzF,2BAA2B;YAC3B,MAAM,GAAG,MAAM,gBAAgB,CAAC;gBAC9B,GAAG,MAAM;gBACT,KAAK,EAAE;oBACL,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;oBACvB,cAAc,EAAE,YAAY;iBAC7B;aACF,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;YAE1B,OAAO,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;QAC5E,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio-server.d.ts","sourceRoot":"","sources":["../stdio-server.ts"],"names":[],"mappings":";AACA;;;GAGG"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* MCP Stdio Server that wraps an X402 payment-enabled client
|
|
4
|
+
* This allows Claude Code to connect via stdio while the server handles payments internally
|
|
5
|
+
*/
|
|
6
|
+
import { webcrypto } from 'node:crypto';
|
|
7
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
8
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
9
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
10
|
+
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
11
|
+
import { createPaymentClient } from './payment-client.js';
|
|
12
|
+
import { config as loadEnv } from 'dotenv';
|
|
13
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
14
|
+
// Polyfill crypto for Node.js environment
|
|
15
|
+
if (!globalThis.crypto) {
|
|
16
|
+
globalThis.crypto = webcrypto;
|
|
17
|
+
}
|
|
18
|
+
loadEnv();
|
|
19
|
+
async function main() {
|
|
20
|
+
// Parse command line arguments
|
|
21
|
+
const args = process.argv.slice(2);
|
|
22
|
+
const urlIndex = args.indexOf('--url');
|
|
23
|
+
if (urlIndex === -1 || !args[urlIndex + 1]) {
|
|
24
|
+
console.error('Error: --url argument is required');
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
const serverUrl = args[urlIndex + 1];
|
|
28
|
+
console.error('Creating MCP client with FluxA Wallet Service payment support...');
|
|
29
|
+
console.error('URL:', serverUrl);
|
|
30
|
+
// FluxA configuration
|
|
31
|
+
const fluxaWalletServiceUrl = process.env.FLUXA_WALLET_SERVICE_URL || "https://walletapi.fluxapay.xyz";
|
|
32
|
+
const evmNetwork = process.env.EVM_NETWORK || "base";
|
|
33
|
+
// Check for agent registration credentials
|
|
34
|
+
const agentEmail = process.env.AGENT_EMAIL;
|
|
35
|
+
const agentName = process.env.AGENT_NAME || "Claude Code - My Agent";
|
|
36
|
+
const clientInfo = process.env.CLIENT_INFO || "FluxA Connect MCP Client";
|
|
37
|
+
if (!agentEmail || !agentName) {
|
|
38
|
+
console.error('Error: AGENT_EMAIL and AGENT_NAME environment variables are required');
|
|
39
|
+
console.error('');
|
|
40
|
+
console.error('Example:');
|
|
41
|
+
console.error(' AGENT_EMAIL=your@email.com');
|
|
42
|
+
console.error(' AGENT_NAME="Claude Code - agentwallet.fluxapay.xyz"');
|
|
43
|
+
console.error(' CLIENT_INFO="Claude Code on macOS" (optional)');
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
// Register agent with FluxA and get JWT
|
|
47
|
+
console.error('Registering agent with FluxA...');
|
|
48
|
+
console.error('Email:', agentEmail);
|
|
49
|
+
console.error('Agent Name:', agentName);
|
|
50
|
+
let agentJwt;
|
|
51
|
+
let agentId;
|
|
52
|
+
try {
|
|
53
|
+
const response = await fetch("https://agentid.fluxapay.xyz/register", {
|
|
54
|
+
method: "POST",
|
|
55
|
+
headers: { "Content-Type": "application/json" },
|
|
56
|
+
body: JSON.stringify({
|
|
57
|
+
email: agentEmail,
|
|
58
|
+
agent_name: agentName,
|
|
59
|
+
client_info: clientInfo,
|
|
60
|
+
}),
|
|
61
|
+
});
|
|
62
|
+
const data = await response.json();
|
|
63
|
+
if (!response.ok) {
|
|
64
|
+
throw new Error(data.message || "Registration failed");
|
|
65
|
+
}
|
|
66
|
+
agentJwt = data.jwt;
|
|
67
|
+
agentId = data.agent_id;
|
|
68
|
+
console.error('✓ Agent registered successfully');
|
|
69
|
+
console.error('Agent ID:', agentId);
|
|
70
|
+
console.error('JWT obtained');
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
console.error('✗ Agent registration failed:', error.message);
|
|
74
|
+
console.error('');
|
|
75
|
+
console.error('Please check:');
|
|
76
|
+
console.error(' - Your email and agent name are correct');
|
|
77
|
+
console.error(' - You have internet connectivity');
|
|
78
|
+
console.error(' - FluxA registration service is available');
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
const url = new URL(serverUrl);
|
|
82
|
+
// Create transport
|
|
83
|
+
const transport = new StreamableHTTPClientTransport(url);
|
|
84
|
+
// Initialize MCP client
|
|
85
|
+
const client = new Client({ name: 'x402-proxy-client', version: '1.0.0' }, { capabilities: {} });
|
|
86
|
+
await client.connect(transport);
|
|
87
|
+
console.error('MCP client connected');
|
|
88
|
+
// Get preferred network from environment
|
|
89
|
+
// Wrap client with FluxA X402 payment capabilities
|
|
90
|
+
const paymentClient = createPaymentClient(client, {
|
|
91
|
+
fluxaWalletServiceUrl,
|
|
92
|
+
agentJwt,
|
|
93
|
+
agentName,
|
|
94
|
+
network: evmNetwork,
|
|
95
|
+
confirmationCallback: async (paymentOptions) => {
|
|
96
|
+
console.error("Payment requested on the following networks:");
|
|
97
|
+
paymentOptions.forEach(p => {
|
|
98
|
+
console.error(`- ${p.network}: ${p.maxAmountRequired} (${p.description})`);
|
|
99
|
+
});
|
|
100
|
+
console.error(`Using network: ${evmNetwork}`);
|
|
101
|
+
return true; // Auto-approve (user approves via FluxA UI)
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
console.error('Payment client configured with FluxA Wallet Service');
|
|
105
|
+
// List available tools from upstream
|
|
106
|
+
const upstreamTools = await paymentClient.listTools();
|
|
107
|
+
console.error('Available upstream tools:', upstreamTools.tools.map(t => t.name));
|
|
108
|
+
console.error('Full tool metadata:', JSON.stringify(upstreamTools.tools, null, 2));
|
|
109
|
+
// Verify inputSchema is present
|
|
110
|
+
upstreamTools.tools.forEach(tool => {
|
|
111
|
+
if (tool.inputSchema) {
|
|
112
|
+
console.error(`Tool ${tool.name} has inputSchema:`, JSON.stringify(tool.inputSchema, null, 2));
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
console.error(`WARNING: Tool ${tool.name} is missing inputSchema!`);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
// Create MCP stdio server
|
|
119
|
+
const server = new Server({
|
|
120
|
+
name: 'fluxa-connect-mcp',
|
|
121
|
+
version: '1.0.0',
|
|
122
|
+
}, {
|
|
123
|
+
capabilities: {
|
|
124
|
+
tools: {},
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
// Register handlers using the correct MCP SDK API
|
|
128
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
129
|
+
// Forward tool list from upstream, ensuring all fields are preserved
|
|
130
|
+
console.error('[STDIO-SERVER] ListTools called, returning tools:', upstreamTools.tools.map(t => ({
|
|
131
|
+
name: t.name,
|
|
132
|
+
hasInputSchema: !!t.inputSchema
|
|
133
|
+
})));
|
|
134
|
+
return upstreamTools;
|
|
135
|
+
});
|
|
136
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
137
|
+
const { name, arguments: args } = request.params;
|
|
138
|
+
console.error(`[STDIO-SERVER] Calling tool: ${name}`);
|
|
139
|
+
console.error(`[STDIO-SERVER] Tool arguments:`, JSON.stringify(args, null, 2));
|
|
140
|
+
try {
|
|
141
|
+
// Forward tool call to payment-enabled client
|
|
142
|
+
console.error(`[STDIO-SERVER] Forwarding to paymentClient.callTool...`);
|
|
143
|
+
const result = await paymentClient.callTool({
|
|
144
|
+
name,
|
|
145
|
+
arguments: args
|
|
146
|
+
});
|
|
147
|
+
console.error(`[STDIO-SERVER] Tool ${name} succeeded`);
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
console.error(`[STDIO-SERVER] Tool ${name} failed:`, error);
|
|
152
|
+
throw error;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
// Connect server to stdio
|
|
156
|
+
const stdioTransport = new StdioServerTransport();
|
|
157
|
+
await server.connect(stdioTransport);
|
|
158
|
+
console.error('X402 Proxy MCP Server running on stdio');
|
|
159
|
+
}
|
|
160
|
+
main().catch((error) => {
|
|
161
|
+
console.error('Fatal error:', error);
|
|
162
|
+
process.exit(1);
|
|
163
|
+
});
|
|
164
|
+
//# sourceMappingURL=stdio-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio-server.js","sourceRoot":"","sources":["../stdio-server.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAA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,CAAC,CAAC;YACvD,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,uBAAuB,IAAI,UAAU,EAAE,KAAK,CAAC,CAAC;YAC5D,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,0BAA0B;IAC1B,MAAM,cAAc,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAClD,MAAM,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAErC,OAAO,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;AAC1D,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"}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fluxa-pay/fluxa-connect-mcp",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "MCP server with FluxA Wallet Service integration for X402 payments",
|
|
6
|
+
"bin": {
|
|
7
|
+
"fluxa-connect-mcp": "dist/stdio-server.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"keywords": [
|
|
14
|
+
"mcp",
|
|
15
|
+
"fluxa",
|
|
16
|
+
"x402",
|
|
17
|
+
"payments",
|
|
18
|
+
"claude",
|
|
19
|
+
"wallet"
|
|
20
|
+
],
|
|
21
|
+
"author": "FluxA",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/FluxA-Agent-Payment/payment-proxy-servers.git",
|
|
26
|
+
"directory": "cli-ts"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsc",
|
|
30
|
+
"prepublishOnly": "npm run build"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@modelcontextprotocol/sdk": "1.18.2",
|
|
34
|
+
"x402-fetch": "^0.7.0",
|
|
35
|
+
"dotenv": "^16.0.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^20.0.0",
|
|
39
|
+
"typescript": "^5.6.0"
|
|
40
|
+
}
|
|
41
|
+
}
|