@paylobster/mcp-server 1.3.0 → 1.5.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/BUILD_SUMMARY.md +294 -0
- package/CHANGELOG.md +77 -0
- package/COMPLETION_REPORT.md +284 -0
- package/INTEGRATION.md +286 -0
- package/QUICKSTART.md +226 -0
- package/README.md +232 -127
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/config.d.ts +7 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +16 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/contracts.d.ts +15 -0
- package/dist/lib/contracts.d.ts.map +1 -0
- package/dist/lib/contracts.js +148 -0
- package/dist/lib/contracts.js.map +1 -0
- package/dist/lib/types.d.ts +39 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/{types/index.js → lib/types.js} +1 -1
- package/dist/lib/types.js.map +1 -0
- package/dist/resources/agent.d.ts +3 -0
- package/dist/resources/agent.d.ts.map +1 -0
- package/dist/resources/agent.js +36 -0
- package/dist/resources/agent.js.map +1 -0
- package/dist/resources/escrow.d.ts +3 -0
- package/dist/resources/escrow.d.ts.map +1 -0
- package/dist/resources/escrow.js +33 -0
- package/dist/resources/escrow.js.map +1 -0
- package/dist/resources/services.d.ts +2 -0
- package/dist/resources/services.d.ts.map +1 -0
- package/dist/resources/services.js +55 -0
- package/dist/resources/services.js.map +1 -0
- package/dist/server.d.ts +6 -3
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +114 -834
- package/dist/server.js.map +1 -1
- package/dist/tools/agent.d.ts +17 -0
- package/dist/tools/agent.d.ts.map +1 -0
- package/dist/tools/agent.js +51 -0
- package/dist/tools/agent.js.map +1 -0
- package/dist/tools/balance.d.ts +16 -5
- package/dist/tools/balance.d.ts.map +1 -1
- package/dist/tools/balance.js +44 -26
- package/dist/tools/balance.js.map +1 -1
- package/dist/tools/escrow.d.ts +31 -90
- package/dist/tools/escrow.d.ts.map +1 -1
- package/dist/tools/escrow.js +98 -215
- package/dist/tools/escrow.js.map +1 -1
- package/dist/tools/reputation.d.ts +15 -49
- package/dist/tools/reputation.d.ts.map +1 -1
- package/dist/tools/reputation.js +45 -107
- package/dist/tools/reputation.js.map +1 -1
- package/dist/tools/search.d.ts +30 -54
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +122 -85
- package/dist/tools/search.js.map +1 -1
- package/examples/test-server.ts +36 -0
- package/examples/test-tools.ts +64 -0
- package/package.json +20 -11
- package/src/__tests__/server.test.ts +24 -0
- package/src/index.ts +24 -0
- package/src/lib/config.ts +22 -0
- package/src/lib/contracts.ts +164 -0
- package/src/lib/types.ts +44 -0
- package/src/resources/agent.ts +40 -0
- package/src/resources/escrow.ts +35 -0
- package/src/resources/services.ts +53 -0
- package/src/server.ts +190 -0
- package/src/tools/agent.ts +56 -0
- package/src/tools/balance.ts +61 -0
- package/src/tools/escrow.ts +142 -0
- package/src/tools/reputation.ts +69 -0
- package/src/tools/search.ts +148 -0
- package/tsconfig.json +20 -0
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -86
- package/dist/cli.js.map +0 -1
- package/dist/resources/index.d.ts +0 -9
- package/dist/resources/index.d.ts.map +0 -1
- package/dist/resources/index.js +0 -159
- package/dist/resources/index.js.map +0 -1
- package/dist/tools/bridge.d.ts +0 -142
- package/dist/tools/bridge.d.ts.map +0 -1
- package/dist/tools/bridge.js +0 -121
- package/dist/tools/bridge.js.map +0 -1
- package/dist/tools/cascade.d.ts +0 -59
- package/dist/tools/cascade.d.ts.map +0 -1
- package/dist/tools/cascade.js +0 -119
- package/dist/tools/cascade.js.map +0 -1
- package/dist/tools/compliance.d.ts +0 -36
- package/dist/tools/compliance.d.ts.map +0 -1
- package/dist/tools/compliance.js +0 -57
- package/dist/tools/compliance.js.map +0 -1
- package/dist/tools/credit.d.ts +0 -46
- package/dist/tools/credit.d.ts.map +0 -1
- package/dist/tools/credit.js +0 -102
- package/dist/tools/credit.js.map +0 -1
- package/dist/tools/disputes.d.ts +0 -71
- package/dist/tools/disputes.d.ts.map +0 -1
- package/dist/tools/disputes.js +0 -121
- package/dist/tools/disputes.js.map +0 -1
- package/dist/tools/intent.d.ts +0 -78
- package/dist/tools/intent.d.ts.map +0 -1
- package/dist/tools/intent.js +0 -192
- package/dist/tools/intent.js.map +0 -1
- package/dist/tools/portfolio.d.ts +0 -44
- package/dist/tools/portfolio.d.ts.map +0 -1
- package/dist/tools/portfolio.js +0 -166
- package/dist/tools/portfolio.js.map +0 -1
- package/dist/tools/revenue.d.ts +0 -42
- package/dist/tools/revenue.d.ts.map +0 -1
- package/dist/tools/revenue.js +0 -67
- package/dist/tools/revenue.js.map +0 -1
- package/dist/tools/streaming.d.ts +0 -60
- package/dist/tools/streaming.d.ts.map +0 -1
- package/dist/tools/streaming.js +0 -163
- package/dist/tools/streaming.js.map +0 -1
- package/dist/tools/swap.d.ts +0 -93
- package/dist/tools/swap.d.ts.map +0 -1
- package/dist/tools/swap.js +0 -150
- package/dist/tools/swap.js.map +0 -1
- package/dist/tools/treasury.d.ts +0 -169
- package/dist/tools/treasury.d.ts.map +0 -1
- package/dist/tools/treasury.js +0 -475
- package/dist/tools/treasury.js.map +0 -1
- package/dist/types/index.d.ts +0 -83
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/utils/contracts.d.ts +0 -552
- package/dist/utils/contracts.d.ts.map +0 -1
- package/dist/utils/contracts.js +0 -401
- package/dist/utils/contracts.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reputation.js","sourceRoot":"","sources":["../../src/tools/reputation.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"reputation.js","sourceRoot":"","sources":["../../src/tools/reputation.ts"],"names":[],"mappings":";;;AAuBA,k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AC,UAAU;aACjC;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,OAAC,CAAC,QAAQ,EAAE,CAAC;YAChC,MAAM;gBACJ,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE,0BAA0B;gBACnC,OAAO,EAAE,KAAK,CAAC,MAAM;gBACrB,SAAS,EAAE,KAAK;aACjB,CAAC;QACJ,CAAC;QAED,MAAM;YACJ,IAAI,EAAE,mBAAmB;YACzB,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,4BAA4B;YAC9E,SAAS,EAAE,IAAI;SAChB,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/tools/search.d.ts
CHANGED
|
@@ -1,55 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
filters?: {
|
|
32
|
-
currency: string;
|
|
33
|
-
capabilities?: string[] | undefined;
|
|
34
|
-
category?: string | undefined;
|
|
35
|
-
maxPrice?: string | undefined;
|
|
36
|
-
minReputation?: number | undefined;
|
|
37
|
-
} | undefined;
|
|
38
|
-
}, {
|
|
39
|
-
sort?: "price" | "reputation" | "relevance" | undefined;
|
|
40
|
-
limit?: number | undefined;
|
|
41
|
-
query?: string | undefined;
|
|
42
|
-
filters?: {
|
|
43
|
-
capabilities?: string[] | undefined;
|
|
44
|
-
category?: string | undefined;
|
|
45
|
-
maxPrice?: string | undefined;
|
|
46
|
-
minReputation?: number | undefined;
|
|
47
|
-
currency?: string | undefined;
|
|
48
|
-
} | undefined;
|
|
49
|
-
}>;
|
|
50
|
-
export declare function searchServices(params: z.infer<typeof searchServicesSchema>, client: ContractClient): Promise<{
|
|
51
|
-
services: ServiceListing[];
|
|
52
|
-
total: number;
|
|
53
|
-
hasMore: boolean;
|
|
54
|
-
}>;
|
|
1
|
+
export declare const searchServicesTool: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: string;
|
|
6
|
+
properties: {
|
|
7
|
+
query: {
|
|
8
|
+
type: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
category: {
|
|
12
|
+
type: string;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
maxPrice: {
|
|
16
|
+
type: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
minReputation: {
|
|
20
|
+
type: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
limit: {
|
|
24
|
+
type: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare function handleSearchServices(input: unknown): Promise<object>;
|
|
55
31
|
//# sourceMappingURL=search.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4B9B,CAAC;AAwDF,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAqD1E"}
|
package/dist/tools/search.js
CHANGED
|
@@ -1,103 +1,140 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.searchServicesTool = void 0;
|
|
4
|
+
exports.handleSearchServices = handleSearchServices;
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
|
-
|
|
7
|
-
query: zod_1.z.string().optional()
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
minReputation: zod_1.z.number().optional(),
|
|
13
|
-
currency: zod_1.z.string().default('USDC'),
|
|
14
|
-
}).optional(),
|
|
15
|
-
sort: zod_1.z.enum(['price', 'reputation', 'relevance']).default('relevance'),
|
|
16
|
-
limit: zod_1.z.number().default(20),
|
|
6
|
+
const SearchServicesInput = zod_1.z.object({
|
|
7
|
+
query: zod_1.z.string().optional(),
|
|
8
|
+
category: zod_1.z.string().optional(),
|
|
9
|
+
maxPrice: zod_1.z.string().optional(),
|
|
10
|
+
minReputation: zod_1.z.number().min(0).max(5).optional(),
|
|
11
|
+
limit: zod_1.z.number().min(1).max(100).optional().default(20),
|
|
17
12
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
capabilities: ['code-review', 'typescript', 'rust', 'solidity'],
|
|
28
|
-
pricing: {
|
|
29
|
-
amount: '5.00',
|
|
30
|
-
currency: 'USDC',
|
|
13
|
+
exports.searchServicesTool = {
|
|
14
|
+
name: 'paylobster_search_services',
|
|
15
|
+
description: 'Search for AI agent services on PayLobster (returns mock data - ServiceRegistry not yet deployed)',
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
query: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
description: 'Search query (optional)',
|
|
31
22
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
category: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'Service category filter (optional)',
|
|
35
26
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
provider: '0x2345678901234567890123456789012345678901',
|
|
40
|
-
name: 'Smart Contract Auditor',
|
|
41
|
-
description: 'Security audit service for Ethereum smart contracts',
|
|
42
|
-
category: 'security',
|
|
43
|
-
capabilities: ['audit', 'security', 'solidity', 'foundry'],
|
|
44
|
-
pricing: {
|
|
45
|
-
amount: '50.00',
|
|
46
|
-
currency: 'USDC',
|
|
47
|
-
},
|
|
48
|
-
reputation: {
|
|
49
|
-
score: 4.9,
|
|
50
|
-
totalJobs: 89,
|
|
27
|
+
maxPrice: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
description: 'Maximum price in USDC (optional)',
|
|
51
30
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
provider: '0x3456789012345678901234567890123456789012',
|
|
56
|
-
name: 'Documentation Writer',
|
|
57
|
-
description: 'Technical documentation and API reference generation',
|
|
58
|
-
category: 'documentation',
|
|
59
|
-
capabilities: ['docs', 'api', 'markdown', 'technical-writing'],
|
|
60
|
-
pricing: {
|
|
61
|
-
amount: '10.00',
|
|
62
|
-
currency: 'USDC',
|
|
31
|
+
minReputation: {
|
|
32
|
+
type: 'number',
|
|
33
|
+
description: 'Minimum reputation score 0-5 (optional)',
|
|
63
34
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
35
|
+
limit: {
|
|
36
|
+
type: 'number',
|
|
37
|
+
description: 'Maximum number of results (default: 20, max: 100)',
|
|
67
38
|
},
|
|
68
39
|
},
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
// Mock data until ServiceRegistry is deployed
|
|
43
|
+
const MOCK_SERVICES = [
|
|
44
|
+
{
|
|
45
|
+
id: 'service-001',
|
|
46
|
+
provider: '0x1234567890123456789012345678901234567890',
|
|
47
|
+
name: 'TypeScript Code Reviewer',
|
|
48
|
+
description: 'Expert code review for TypeScript projects with security and performance analysis',
|
|
49
|
+
category: 'code-review',
|
|
50
|
+
price: '10.00',
|
|
51
|
+
currency: 'USDC',
|
|
52
|
+
reputation: 4.8,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'service-002',
|
|
56
|
+
provider: '0x2345678901234567890123456789012345678901',
|
|
57
|
+
name: 'Rust Security Auditor',
|
|
58
|
+
description: 'Smart contract and Rust code security audits',
|
|
59
|
+
category: 'security-audit',
|
|
60
|
+
price: '50.00',
|
|
61
|
+
currency: 'USDC',
|
|
62
|
+
reputation: 4.9,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'service-003',
|
|
66
|
+
provider: '0x3456789012345678901234567890123456789012',
|
|
67
|
+
name: 'AI Model Training',
|
|
68
|
+
description: 'Fine-tune and train custom AI models on your data',
|
|
69
|
+
category: 'ai-training',
|
|
70
|
+
price: '100.00',
|
|
71
|
+
currency: 'USDC',
|
|
72
|
+
reputation: 4.5,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'service-004',
|
|
76
|
+
provider: '0x4567890123456789012345678901234567890123',
|
|
77
|
+
name: 'Data Labeling Service',
|
|
78
|
+
description: 'High-quality data labeling for ML training',
|
|
79
|
+
category: 'data-labeling',
|
|
80
|
+
price: '5.00',
|
|
81
|
+
currency: 'USDC',
|
|
82
|
+
reputation: 4.7,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: 'service-005',
|
|
86
|
+
provider: '0x5678901234567890123456789012345678901234',
|
|
87
|
+
name: 'Python Code Generator',
|
|
88
|
+
description: 'Generate production-ready Python code from specifications',
|
|
89
|
+
category: 'code-generation',
|
|
90
|
+
price: '15.00',
|
|
91
|
+
currency: 'USDC',
|
|
92
|
+
reputation: 4.6,
|
|
93
|
+
},
|
|
94
|
+
];
|
|
95
|
+
async function handleSearchServices(input) {
|
|
96
|
+
try {
|
|
97
|
+
const params = SearchServicesInput.parse(input);
|
|
98
|
+
// Filter mock services based on criteria
|
|
99
|
+
let filtered = [...MOCK_SERVICES];
|
|
100
|
+
if (params.category) {
|
|
101
|
+
filtered = filtered.filter(s => s.category === params.category);
|
|
75
102
|
}
|
|
76
|
-
if (params.
|
|
77
|
-
const maxPrice = parseFloat(params.
|
|
78
|
-
filtered = filtered.filter(s => parseFloat(s.
|
|
103
|
+
if (params.maxPrice) {
|
|
104
|
+
const maxPrice = parseFloat(params.maxPrice);
|
|
105
|
+
filtered = filtered.filter(s => parseFloat(s.price) <= maxPrice);
|
|
79
106
|
}
|
|
80
|
-
if (params.
|
|
81
|
-
filtered = filtered.filter(s => s.reputation
|
|
107
|
+
if (params.minReputation !== undefined) {
|
|
108
|
+
filtered = filtered.filter(s => s.reputation >= params.minReputation);
|
|
82
109
|
}
|
|
83
|
-
if (params.
|
|
84
|
-
|
|
110
|
+
if (params.query) {
|
|
111
|
+
const queryLower = params.query.toLowerCase();
|
|
112
|
+
filtered = filtered.filter(s => s.name.toLowerCase().includes(queryLower) ||
|
|
113
|
+
s.description.toLowerCase().includes(queryLower));
|
|
85
114
|
}
|
|
115
|
+
// Apply limit
|
|
116
|
+
const results = filtered.slice(0, params.limit);
|
|
117
|
+
return {
|
|
118
|
+
services: results,
|
|
119
|
+
total: results.length,
|
|
120
|
+
hasMore: filtered.length > results.length,
|
|
121
|
+
note: 'Mock data - ServiceRegistry contract not yet deployed on mainnet',
|
|
122
|
+
};
|
|
86
123
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
124
|
+
catch (error) {
|
|
125
|
+
if (error instanceof zod_1.z.ZodError) {
|
|
126
|
+
throw {
|
|
127
|
+
code: 'ERR_INVALID_INPUT',
|
|
128
|
+
message: 'Invalid input parameters',
|
|
129
|
+
details: error.errors,
|
|
130
|
+
retryable: false,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
throw {
|
|
134
|
+
code: 'ERR_UNKNOWN',
|
|
135
|
+
message: error instanceof Error ? error.message : 'Failed to search services',
|
|
136
|
+
retryable: false,
|
|
137
|
+
};
|
|
93
138
|
}
|
|
94
|
-
// Apply limit
|
|
95
|
-
const limit = params.limit || 20;
|
|
96
|
-
const limited = filtered.slice(0, limit);
|
|
97
|
-
return {
|
|
98
|
-
services: limited,
|
|
99
|
-
total: filtered.length,
|
|
100
|
-
hasMore: filtered.length > limit,
|
|
101
|
-
};
|
|
102
139
|
}
|
|
103
140
|
//# sourceMappingURL=search.js.map
|
package/dist/tools/search.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":";;;AA8FA,oDAqDC;AAnJD,6BAAwB;AAExB,MAAM,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAClD,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;CACzD,CAAC,CAAC;AAEU,QAAA,kBAAkB,GAAG;IAChC,IAAI,EAAE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MCPServer } from '../src/server.js';
|
|
9
|
+
|
|
10
|
+
async function test() {
|
|
11
|
+
console.log('🧪 Testing PayLobster MCP Server initialization...\n');
|
|
12
|
+
|
|
13
|
+
// Test 1: Initialize with Sepolia config
|
|
14
|
+
console.log('✓ Creating server instance (Sepolia testnet)');
|
|
15
|
+
const server = new PayLobsterMCPServer({
|
|
16
|
+
network: 'sepolia',
|
|
17
|
+
rpcUrl: 'https://sepolia.base.org',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
console.log('✓ Server created successfully');
|
|
21
|
+
|
|
22
|
+
// Test 2: Get MCP Server instance
|
|
23
|
+
const mcpServer = server.getServer();
|
|
24
|
+
console.log('✓ MCP Server instance accessible');
|
|
25
|
+
|
|
26
|
+
console.log('\n✅ All tests passed!');
|
|
27
|
+
console.log('\nServer is ready to use. Configuration:');
|
|
28
|
+
console.log(' - Network: Sepolia (testnet)');
|
|
29
|
+
console.log(' - RPC: https://sepolia.base.org');
|
|
30
|
+
console.log('\nTo start the server with MCP protocol:');
|
|
31
|
+
console.log(' npm start');
|
|
32
|
+
console.log(' # or with env vars:');
|
|
33
|
+
console.log(' PAYLOBSTER_NETWORK=mainnet npm start');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
test().catch(console.error);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Example script showing how to test individual MCP tools
|
|
5
|
+
* This demonstrates the tool call structure for manual testing
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { handleGetReputation } from '../src/tools/reputation.js';
|
|
9
|
+
import { handleGetBalance } from '../src/tools/balance.js';
|
|
10
|
+
import { handleGetAgent } from '../src/tools/agent.js';
|
|
11
|
+
import { handleSearchServices } from '../src/tools/search.js';
|
|
12
|
+
import { ContractsClient } from '../src/lib/contracts.js';
|
|
13
|
+
|
|
14
|
+
async function testTools() {
|
|
15
|
+
console.log('🧪 Testing PayLobster MCP Tools\n');
|
|
16
|
+
|
|
17
|
+
// Initialize contracts client
|
|
18
|
+
const contracts = new ContractsClient({
|
|
19
|
+
network: 'sepolia',
|
|
20
|
+
rpcUrl: 'https://sepolia.base.org',
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Test address (replace with a valid address on Sepolia)
|
|
24
|
+
const testAddress = '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb';
|
|
25
|
+
|
|
26
|
+
console.log('--- Test 1: Search Services (Mock Data) ---');
|
|
27
|
+
try {
|
|
28
|
+
const result = await handleSearchServices({
|
|
29
|
+
query: 'code review',
|
|
30
|
+
limit: 3,
|
|
31
|
+
});
|
|
32
|
+
console.log(JSON.stringify(result, null, 2));
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error('Error:', error);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
console.log('\n--- Test 2: Get Agent Info ---');
|
|
38
|
+
try {
|
|
39
|
+
const result = await handleGetAgent({ address: testAddress }, contracts);
|
|
40
|
+
console.log(JSON.stringify(result, null, 2));
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.error('Error:', error);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
console.log('\n--- Test 3: Get Reputation ---');
|
|
46
|
+
try {
|
|
47
|
+
const result = await handleGetReputation({ address: testAddress }, contracts);
|
|
48
|
+
console.log(JSON.stringify(result, null, 2));
|
|
49
|
+
} catch (error) {
|
|
50
|
+
console.error('Error:', error);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
console.log('\n--- Test 4: Get Balance ---');
|
|
54
|
+
try {
|
|
55
|
+
const result = await handleGetBalance({ address: testAddress }, contracts);
|
|
56
|
+
console.log(JSON.stringify(result, null, 2));
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.error('Error:', error);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
console.log('\n✅ Tool testing complete!');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
testTools().catch(console.error);
|
package/package.json
CHANGED
|
@@ -1,36 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paylobster/mcp-server",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.5.0",
|
|
4
|
+
"description": "Model Context Protocol server for PayLobster agent payment infrastructure",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"bin": {
|
|
8
|
-
"paylobster-mcp
|
|
8
|
+
"paylobster-mcp": "dist/index.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsc",
|
|
12
|
-
"dev": "
|
|
13
|
-
"start": "node dist/
|
|
14
|
-
"test": "
|
|
12
|
+
"dev": "tsx watch src/index.ts",
|
|
13
|
+
"start": "node dist/index.js",
|
|
14
|
+
"test": "jest",
|
|
15
|
+
"test:watch": "jest --watch",
|
|
16
|
+
"lint": "eslint src --ext .ts",
|
|
17
|
+
"clean": "rm -rf dist"
|
|
15
18
|
},
|
|
16
19
|
"keywords": [
|
|
17
20
|
"mcp",
|
|
18
21
|
"model-context-protocol",
|
|
19
22
|
"paylobster",
|
|
20
|
-
"
|
|
23
|
+
"ai-agents",
|
|
24
|
+
"payments",
|
|
21
25
|
"blockchain",
|
|
22
|
-
"
|
|
26
|
+
"base"
|
|
23
27
|
],
|
|
24
28
|
"author": "PayLobster",
|
|
25
29
|
"license": "MIT",
|
|
26
30
|
"dependencies": {
|
|
27
31
|
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
28
32
|
"viem": "^2.21.54",
|
|
29
|
-
"zod": "^3.24.1"
|
|
30
|
-
"dotenv": "^16.4.7"
|
|
33
|
+
"zod": "^3.24.1"
|
|
31
34
|
},
|
|
32
35
|
"devDependencies": {
|
|
33
|
-
"@types/node": "^
|
|
36
|
+
"@types/node": "^20.17.10",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^8.21.0",
|
|
38
|
+
"@typescript-eslint/parser": "^8.21.0",
|
|
39
|
+
"eslint": "^9.19.0",
|
|
40
|
+
"jest": "^29.7.0",
|
|
41
|
+
"ts-jest": "^29.2.6",
|
|
42
|
+
"tsx": "^4.19.2",
|
|
34
43
|
"typescript": "^5.7.3"
|
|
35
44
|
},
|
|
36
45
|
"engines": {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PayLobsterMCPServer } from '../server';
|
|
2
|
+
|
|
3
|
+
describe('PayLobsterMCPServer', () => {
|
|
4
|
+
let server: PayLobsterMCPServer;
|
|
5
|
+
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
server = new PayLobsterMCPServer({
|
|
8
|
+
network: 'sepolia',
|
|
9
|
+
rpcUrl: 'https://sepolia.base.org',
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('should initialize with config', () => {
|
|
14
|
+
expect(server).toBeInstanceOf(PayLobsterMCPServer);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('should have MCP server instance', () => {
|
|
18
|
+
const mcpServer = server.getServer();
|
|
19
|
+
expect(mcpServer).toBeDefined();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Add more tests as needed
|
|
23
|
+
// Note: Full integration tests require a test RPC node
|
|
24
|
+
});
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { PayLobsterMCPServer } from './server.js';
|
|
4
|
+
|
|
5
|
+
async function main() {
|
|
6
|
+
const server = new PayLobsterMCPServer();
|
|
7
|
+
await server.start();
|
|
8
|
+
|
|
9
|
+
// Handle graceful shutdown
|
|
10
|
+
process.on('SIGINT', () => {
|
|
11
|
+
console.error('Shutting down...');
|
|
12
|
+
process.exit(0);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
process.on('SIGTERM', () => {
|
|
16
|
+
console.error('Shutting down...');
|
|
17
|
+
process.exit(0);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
main().catch((error) => {
|
|
22
|
+
console.error('Fatal error:', error);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
|
+
|
|
3
|
+
export interface MCPServerConfig {
|
|
4
|
+
network: 'mainnet' | 'sepolia';
|
|
5
|
+
rpcUrl?: string;
|
|
6
|
+
apiUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function getConfig(): MCPServerConfig {
|
|
10
|
+
const network = (process.env.PAYLOBSTER_NETWORK || 'mainnet') as 'mainnet' | 'sepolia';
|
|
11
|
+
|
|
12
|
+
const defaultRpcUrls = {
|
|
13
|
+
mainnet: 'https://mainnet.base.org',
|
|
14
|
+
sepolia: 'https://sepolia.base.org',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
network,
|
|
19
|
+
rpcUrl: process.env.PAYLOBSTER_RPC_URL || defaultRpcUrls[network],
|
|
20
|
+
apiUrl: process.env.PAYLOBSTER_API_URL || 'https://paylobster.com',
|
|
21
|
+
};
|
|
22
|
+
}
|