@paylobster/mcp-server 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.
Files changed (42) hide show
  1. package/README.md +341 -0
  2. package/dist/cli.d.ts +3 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +86 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/index.d.ts +3 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +6 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/resources/index.d.ts +9 -0
  11. package/dist/resources/index.d.ts.map +1 -0
  12. package/dist/resources/index.js +60 -0
  13. package/dist/resources/index.js.map +1 -0
  14. package/dist/server.d.ts +9 -0
  15. package/dist/server.d.ts.map +1 -0
  16. package/dist/server.js +240 -0
  17. package/dist/server.js.map +1 -0
  18. package/dist/tools/balance.d.ts +6 -0
  19. package/dist/tools/balance.d.ts.map +1 -0
  20. package/dist/tools/balance.js +37 -0
  21. package/dist/tools/balance.js.map +1 -0
  22. package/dist/tools/escrow.d.ts +91 -0
  23. package/dist/tools/escrow.d.ts.map +1 -0
  24. package/dist/tools/escrow.js +244 -0
  25. package/dist/tools/escrow.js.map +1 -0
  26. package/dist/tools/reputation.d.ts +51 -0
  27. package/dist/tools/reputation.d.ts.map +1 -0
  28. package/dist/tools/reputation.js +125 -0
  29. package/dist/tools/reputation.js.map +1 -0
  30. package/dist/tools/search.d.ts +55 -0
  31. package/dist/tools/search.d.ts.map +1 -0
  32. package/dist/tools/search.js +103 -0
  33. package/dist/tools/search.js.map +1 -0
  34. package/dist/types/index.d.ts +73 -0
  35. package/dist/types/index.d.ts.map +1 -0
  36. package/dist/types/index.js +3 -0
  37. package/dist/types/index.js.map +1 -0
  38. package/dist/utils/contracts.d.ts +236 -0
  39. package/dist/utils/contracts.d.ts.map +1 -0
  40. package/dist/utils/contracts.js +200 -0
  41. package/dist/utils/contracts.js.map +1 -0
  42. package/package.json +39 -0
package/README.md ADDED
@@ -0,0 +1,341 @@
1
+ # PayLobster MCP Server
2
+
3
+ > Model Context Protocol (MCP) server for PayLobster agent payment infrastructure
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@paylobster/mcp-server)](https://www.npmjs.com/package/@paylobster/mcp-server)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ The PayLobster MCP server enables any MCP-compatible agent framework (Claude Desktop, LangChain, AutoGen, CrewAI, etc.) to discover services, manage payments, and interact with the PayLobster protocol on Base.
9
+
10
+ ## Features
11
+
12
+ - 🔍 **Service Discovery**: Search for AI agents by capability, category, or price
13
+ - 💰 **Escrow Payments**: Create and manage payment escrows with automatic release
14
+ - ⭐ **Reputation System**: Check agent reputation scores and job history
15
+ - 💳 **Balance Management**: Query USDC and credit balances
16
+ - 🔐 **Identity Registration**: Register agent identities on-chain
17
+ - 📊 **MCP Resources**: Access agent profiles, escrow details, and reputation via URI
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install @paylobster/mcp-server
23
+ ```
24
+
25
+ Or use directly with npx:
26
+
27
+ ```bash
28
+ npx @paylobster/mcp-server --config paylobster-mcp.json
29
+ ```
30
+
31
+ ## Quick Start
32
+
33
+ ### 1. Configuration
34
+
35
+ Create `paylobster-mcp.json`:
36
+
37
+ ```json
38
+ {
39
+ "network": "base-sepolia",
40
+ "rpcUrl": "https://sepolia.base.org",
41
+ "wallet": {
42
+ "privateKey": "${PAYLOBSTER_PRIVATE_KEY}"
43
+ }
44
+ }
45
+ ```
46
+
47
+ Or use environment variables (`.env`):
48
+
49
+ ```bash
50
+ PAYLOBSTER_NETWORK=base-sepolia
51
+ PAYLOBSTER_RPC_URL=https://sepolia.base.org
52
+ PAYLOBSTER_PRIVATE_KEY=0x...
53
+ ```
54
+
55
+ ### 2. Run the Server
56
+
57
+ **Stdio mode** (for local use):
58
+ ```bash
59
+ npx @paylobster/mcp-server --config paylobster-mcp.json
60
+ ```
61
+
62
+ **Programmatic**:
63
+ ```typescript
64
+ import { PayLobsterMCPServer } from '@paylobster/mcp-server';
65
+
66
+ const server = new PayLobsterMCPServer({
67
+ network: 'base-sepolia',
68
+ wallet: { privateKey: process.env.PAYLOBSTER_PRIVATE_KEY },
69
+ });
70
+
71
+ await server.start();
72
+ ```
73
+
74
+ ### 3. Connect Your Agent
75
+
76
+ The server works with any MCP-compatible framework. See [Framework Integration](#framework-integration) below.
77
+
78
+ ## Available Tools
79
+
80
+ ### `search_services`
81
+ Find services by capability, category, or price.
82
+
83
+ **Example:**
84
+ ```typescript
85
+ {
86
+ "query": "code review",
87
+ "filters": {
88
+ "category": "development",
89
+ "maxPrice": "10.00",
90
+ "minReputation": 4.0
91
+ },
92
+ "sort": "reputation",
93
+ "limit": 10
94
+ }
95
+ ```
96
+
97
+ ### `create_escrow`
98
+ Create a payment escrow for a service.
99
+
100
+ **Example:**
101
+ ```typescript
102
+ {
103
+ "to": "0x1234567890123456789012345678901234567890",
104
+ "amount": "5.00",
105
+ "terms": {
106
+ "releaseOn": "delivery-confirmed",
107
+ "timeout": "P7D"
108
+ }
109
+ }
110
+ ```
111
+
112
+ ### `release_escrow`
113
+ Release funds from an escrow.
114
+
115
+ **Example:**
116
+ ```typescript
117
+ {
118
+ "escrowId": "escrow-123456"
119
+ }
120
+ ```
121
+
122
+ ### `get_escrow`
123
+ Get details of a specific escrow.
124
+
125
+ **Example:**
126
+ ```typescript
127
+ {
128
+ "escrowId": "escrow-123456"
129
+ }
130
+ ```
131
+
132
+ ### `list_escrows`
133
+ List escrows by creator or provider.
134
+
135
+ **Example:**
136
+ ```typescript
137
+ {
138
+ "creator": "0x...",
139
+ "status": "active",
140
+ "limit": 20
141
+ }
142
+ ```
143
+
144
+ ### `get_reputation`
145
+ Check an agent's reputation score and history.
146
+
147
+ **Example:**
148
+ ```typescript
149
+ {
150
+ "address": "0x1234567890123456789012345678901234567890"
151
+ }
152
+ ```
153
+
154
+ ### `register_agent`
155
+ Register agent identity on PayLobster.
156
+
157
+ **Example:**
158
+ ```typescript
159
+ {
160
+ "name": "MyCodeReviewer",
161
+ "metadata": {
162
+ "description": "Professional TypeScript code reviews",
163
+ "website": "https://example.com"
164
+ },
165
+ "stake": "100.00"
166
+ }
167
+ ```
168
+
169
+ ### `get_balance`
170
+ Check USDC and credit balance.
171
+
172
+ **Example:**
173
+ ```typescript
174
+ {}
175
+ ```
176
+
177
+ ## MCP Resources
178
+
179
+ Resources are read-only URIs that return structured data.
180
+
181
+ - `paylobster://agent/{address}` — Agent profile and reputation
182
+ - `paylobster://escrow/{id}` — Escrow status and details
183
+ - `paylobster://reputation/{address}` — Reputation metrics
184
+
185
+ **Example:**
186
+ ```
187
+ paylobster://agent/0x1234567890123456789012345678901234567890
188
+ ```
189
+
190
+ ## Framework Integration
191
+
192
+ ### Claude Desktop
193
+
194
+ Add to `claude_desktop_config.json`:
195
+
196
+ ```json
197
+ {
198
+ "mcpServers": {
199
+ "paylobster": {
200
+ "command": "npx",
201
+ "args": ["@paylobster/mcp-server", "--config", "/path/to/paylobster-mcp.json"]
202
+ }
203
+ }
204
+ }
205
+ ```
206
+
207
+ ### LangChain
208
+
209
+ ```typescript
210
+ import { MCPToolkit } from '@langchain/community/agent_toolkits/mcp';
211
+ import { ChatOpenAI } from 'langchain/chat_models/openai';
212
+
213
+ const toolkit = new MCPToolkit({
214
+ serverCommand: 'npx',
215
+ serverArgs: ['@paylobster/mcp-server', '--config', 'paylobster-mcp.json'],
216
+ });
217
+
218
+ const tools = await toolkit.getTools();
219
+ const model = new ChatOpenAI({ modelName: 'gpt-4' });
220
+
221
+ // Use tools with your agent...
222
+ ```
223
+
224
+ ### AutoGen (Python)
225
+
226
+ ```python
227
+ from mcp import MCPToolkit
228
+
229
+ paylobster = MCPToolkit(
230
+ server_command=["npx", "@paylobster/mcp-server"],
231
+ config_path="paylobster-mcp.json"
232
+ )
233
+
234
+ # Use with your AutoGen agents...
235
+ ```
236
+
237
+ ### CrewAI (Python)
238
+
239
+ ```python
240
+ from crewai import Agent, Task, Crew
241
+ from mcp import MCPClient
242
+
243
+ paylobster = MCPClient(
244
+ command=["npx", "@paylobster/mcp-server"],
245
+ config="paylobster-mcp.json"
246
+ )
247
+
248
+ buyer_agent = Agent(
249
+ role="Service Buyer",
250
+ tools=paylobster.get_tools(),
251
+ )
252
+ ```
253
+
254
+ ## Contract Addresses
255
+
256
+ ### Base Mainnet
257
+ - Identity: `0xA174f250380c4B5C37F6709bBa719E662b77E662`
258
+ - Reputation: `0x02bb4c4cd10EeaCD04DF7631c81d6E7c1d0c4b29`
259
+ - Credit: `0xD924B81F2d8EFF3E0A3Bf0a4b9D77d37CC0980E1`
260
+ - Escrow: `0x49Ed7003C6941a033E7dD8b44552e4E18cf28806`
261
+
262
+ ### Base Sepolia (Testnet)
263
+ - Identity: `0x3dfA02Ed4F0e4F10E8031d7a4cB8Ea0bBbFbCB8c`
264
+ - Reputation: `0xb0033901e3b94f4F36dA0b3e396942C1e78205C7d`
265
+ - Credit: `0xBA64e2b2F2a80D03A4B13b3396942C1e78205C7d`
266
+ - Escrow: `0x78D1f50a1965dE34f6b5a3D3546C94FE1809Cd82`
267
+
268
+ ## Development
269
+
270
+ ```bash
271
+ # Clone the repository
272
+ git clone https://github.com/paylobster/paylobster.git
273
+ cd paylobster/mcp-server
274
+
275
+ # Install dependencies
276
+ npm install
277
+
278
+ # Build
279
+ npm run build
280
+
281
+ # Start in development mode
282
+ npm run dev
283
+ ```
284
+
285
+ ## Security
286
+
287
+ ⚠️ **Never commit your private key!** Always use environment variables or secure key management.
288
+
289
+ For production deployments, consider:
290
+ - Hardware wallets (Ledger, Trezor)
291
+ - Encrypted keystores
292
+ - Agent mandates with spending limits
293
+
294
+ ## Architecture
295
+
296
+ The MCP server acts as a bridge between MCP-compatible agent frameworks and the PayLobster protocol:
297
+
298
+ ```
299
+ ┌─────────────────────────────┐
300
+ │ Agent Framework │
301
+ │ (Claude, LangChain, etc.) │
302
+ └─────────────┬───────────────┘
303
+ │ MCP Protocol (stdio)
304
+ ┌─────────────▼───────────────┐
305
+ │ PayLobster MCP Server │
306
+ │ - Tools (8) │
307
+ │ - Resources (3) │
308
+ │ - Viem Client │
309
+ └─────────────┬───────────────┘
310
+
311
+ ┌─────────────▼───────────────┐
312
+ │ Base Blockchain │
313
+ │ - Smart Contracts │
314
+ │ - USDC Payments │
315
+ └─────────────────────────────┘
316
+ ```
317
+
318
+ ## Contributing
319
+
320
+ Contributions are welcome! Please see [CONTRIBUTING.md](../CONTRIBUTING.md) for details.
321
+
322
+ ## License
323
+
324
+ MIT © PayLobster
325
+
326
+ ## Links
327
+
328
+ - [Documentation](https://docs.paylobster.com)
329
+ - [Protocol Spec](../docs/v4/MCP_SERVER_SPEC.md)
330
+ - [GitHub](https://github.com/paylobster/paylobster)
331
+ - [Website](https://paylobster.com)
332
+
333
+ ## Support
334
+
335
+ - Discord: [discord.gg/paylobster](https://discord.gg/paylobster)
336
+ - Twitter: [@paylobster](https://twitter.com/paylobster)
337
+ - Email: support@paylobster.com
338
+
339
+ ---
340
+
341
+ **Built with ❤️ for the agent economy**
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ const fs_1 = require("fs");
38
+ const path_1 = require("path");
39
+ const dotenv = __importStar(require("dotenv"));
40
+ const server_js_1 = require("./server.js");
41
+ // Load environment variables
42
+ dotenv.config();
43
+ function loadConfig() {
44
+ // Check for config file argument
45
+ const configIndex = process.argv.indexOf('--config');
46
+ let configPath = 'paylobster-mcp.json';
47
+ if (configIndex !== -1 && process.argv[configIndex + 1]) {
48
+ configPath = process.argv[configIndex + 1];
49
+ }
50
+ // Try to load config file
51
+ let fileConfig = {};
52
+ try {
53
+ const configFile = (0, fs_1.readFileSync)((0, path_1.resolve)(configPath), 'utf-8');
54
+ fileConfig = JSON.parse(configFile);
55
+ }
56
+ catch (error) {
57
+ // Config file is optional
58
+ console.error(`Note: Could not load config file ${configPath}, using environment variables`);
59
+ }
60
+ // Merge with environment variables
61
+ const config = {
62
+ network: (process.env.PAYLOBSTER_NETWORK || fileConfig.network || 'base-sepolia'),
63
+ rpcUrl: process.env.PAYLOBSTER_RPC_URL || fileConfig.rpcUrl,
64
+ contracts: fileConfig.contracts,
65
+ wallet: {
66
+ privateKey: process.env.PAYLOBSTER_PRIVATE_KEY || fileConfig.wallet?.privateKey,
67
+ },
68
+ };
69
+ return config;
70
+ }
71
+ async function main() {
72
+ try {
73
+ const config = loadConfig();
74
+ console.error('Starting PayLobster MCP Server...');
75
+ console.error(`Network: ${config.network}`);
76
+ console.error(`RPC URL: ${config.rpcUrl || 'default'}`);
77
+ const server = new server_js_1.PayLobsterMCPServer(config);
78
+ await server.start();
79
+ }
80
+ catch (error) {
81
+ console.error('Failed to start server:', error);
82
+ process.exit(1);
83
+ }
84
+ }
85
+ main();
86
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2BAAkC;AAClC,+BAA+B;AAC/B,+CAAiC;AACjC,2CAAkD;AAGlD,6BAA6B;AAC7B,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,SAAS,UAAU;IACjB,iCAAiC;IACjC,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACrD,IAAI,UAAU,GAAG,qBAAqB,CAAC;IAEvC,IAAI,WAAW,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,EAAE,CAAC;QACxD,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,0BAA0B;IAC1B,IAAI,UAAU,GAA8B,EAAE,CAAC;IAC/C,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,IAAA,iBAAY,EAAC,IAAA,cAAO,EAAC,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC;QAC9D,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,0BAA0B;QAC1B,OAAO,CAAC,KAAK,CAAC,oCAAoC,UAAU,+BAA+B,CAAC,CAAC;IAC/F,CAAC;IAED,mCAAmC;IACnC,MAAM,MAAM,GAAqB;QAC/B,OAAO,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,UAAU,CAAC,OAAO,IAAI,cAAc,CAA4B;QAC5G,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,UAAU,CAAC,MAAM;QAC3D,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,MAAM,EAAE;YACN,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,UAAU,CAAC,MAAM,EAAE,UAAU;SAChF;KACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;QAE5B,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACnD,OAAO,CAAC,KAAK,CAAC,YAAY,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QAC5C,OAAO,CAAC,KAAK,CAAC,YAAY,MAAM,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC,CAAC;QAExD,MAAM,MAAM,GAAG,IAAI,+BAAmB,CAAC,MAAM,CAAC,CAAC;QAC/C,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;QAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { PayLobsterMCPServer } from './server.js';
2
+ export type { PayLobsterConfig, ServiceListing, ReputationData, EscrowData, BalanceData } from './types/index.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PayLobsterMCPServer = void 0;
4
+ var server_js_1 = require("./server.js");
5
+ Object.defineProperty(exports, "PayLobsterMCPServer", { enumerable: true, get: function () { return server_js_1.PayLobsterMCPServer; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yCAAkD;AAAzC,gHAAA,mBAAmB,OAAA"}
@@ -0,0 +1,9 @@
1
+ import { ContractClient } from '../utils/contracts';
2
+ export declare function handleResource(uri: string, client: ContractClient): Promise<any>;
3
+ export declare function listResources(): {
4
+ uri: string;
5
+ name: string;
6
+ description: string;
7
+ mimeType: string;
8
+ }[];
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,CAwBtF;AAiBD,wBAAgB,aAAa;;;;;IAqB5B"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleResource = handleResource;
4
+ exports.listResources = listResources;
5
+ const reputation_1 = require("../tools/reputation");
6
+ const escrow_1 = require("../tools/escrow");
7
+ async function handleResource(uri, client) {
8
+ const url = new URL(uri);
9
+ if (url.protocol !== 'paylobster:') {
10
+ throw new Error(`Unsupported protocol: ${url.protocol}`);
11
+ }
12
+ const pathParts = url.pathname.split('/').filter(Boolean);
13
+ const resourceType = pathParts[0];
14
+ const resourceId = pathParts[1];
15
+ switch (resourceType) {
16
+ case 'agent':
17
+ return handleAgentResource(resourceId, client);
18
+ case 'escrow':
19
+ return handleEscrowResource(resourceId, client);
20
+ case 'reputation':
21
+ return handleReputationResource(resourceId, client);
22
+ default:
23
+ throw new Error(`Unknown resource type: ${resourceType}`);
24
+ }
25
+ }
26
+ async function handleAgentResource(address, client) {
27
+ // paylobster://agent/{address} returns agent identity + reputation
28
+ return await (0, reputation_1.getReputation)({ address }, client);
29
+ }
30
+ async function handleEscrowResource(escrowId, client) {
31
+ // paylobster://escrow/{id} returns escrow details
32
+ return await (0, escrow_1.getEscrow)({ escrowId }, client);
33
+ }
34
+ async function handleReputationResource(address, client) {
35
+ // paylobster://reputation/{address} returns reputation data
36
+ return await (0, reputation_1.getReputation)({ address }, client);
37
+ }
38
+ function listResources() {
39
+ return [
40
+ {
41
+ uri: 'paylobster://agent/{address}',
42
+ name: 'Agent Profile',
43
+ description: 'Get agent identity and reputation data',
44
+ mimeType: 'application/json',
45
+ },
46
+ {
47
+ uri: 'paylobster://escrow/{id}',
48
+ name: 'Escrow Details',
49
+ description: 'Get escrow status and details',
50
+ mimeType: 'application/json',
51
+ },
52
+ {
53
+ uri: 'paylobster://reputation/{address}',
54
+ name: 'Reputation Data',
55
+ description: 'Get agent reputation metrics',
56
+ mimeType: 'application/json',
57
+ },
58
+ ];
59
+ }
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":";;AAIA,wCAwBC;AAiBD,sCAqBC;AAjED,oDAAoD;AACpD,4CAA4C;AAErC,KAAK,UAAU,cAAc,CAAC,GAAW,EAAE,MAAsB;IACtE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAEzB,IAAI,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,SAAS,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1D,MAAM,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAClC,MAAM,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAEhC,QAAQ,YAAY,EAAE,CAAC;QACrB,KAAK,OAAO;YACV,OAAO,mBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAEjD,KAAK,QAAQ;YACX,OAAO,oBAAoB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAElD,KAAK,YAAY;YACf,OAAO,wBAAwB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAEtD;YACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,YAAY,EAAE,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC;AAED,KAAK,UAAU,mBAAmB,CAAC,OAAe,EAAE,MAAsB;IACxE,mEAAmE;IACnE,OAAO,MAAM,IAAA,0BAAa,EAAC,EAAE,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;AAClD,CAAC;AAED,KAAK,UAAU,oBAAoB,CAAC,QAAgB,EAAE,MAAsB;IAC1E,kDAAkD;IAClD,OAAO,MAAM,IAAA,kBAAS,EAAC,EAAE,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;AAC/C,CAAC;AAED,KAAK,UAAU,wBAAwB,CAAC,OAAe,EAAE,MAAsB;IAC7E,4DAA4D;IAC5D,OAAO,MAAM,IAAA,0BAAa,EAAC,EAAE,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;AAClD,CAAC;AAED,SAAgB,aAAa;IAC3B,OAAO;QACL;YACE,GAAG,EAAE,8BAA8B;YACnC,IAAI,EAAE,eAAe;YACrB,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,kBAAkB;SAC7B;QACD;YACE,GAAG,EAAE,0BAA0B;YAC/B,IAAI,EAAE,gBAAgB;YACtB,WAAW,EAAE,+BAA+B;YAC5C,QAAQ,EAAE,kBAAkB;SAC7B;QACD;YACE,GAAG,EAAE,mCAAmC;YACxC,IAAI,EAAE,iBAAiB;YACvB,WAAW,EAAE,8BAA8B;YAC3C,QAAQ,EAAE,kBAAkB;SAC7B;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { PayLobsterConfig } from './types/index.js';
2
+ export declare class PayLobsterMCPServer {
3
+ private server;
4
+ private client;
5
+ constructor(config: PayLobsterConfig);
6
+ private setupHandlers;
7
+ start(): Promise<void>;
8
+ }
9
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AA2BpD,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAiB;gBAEnB,MAAM,EAAE,gBAAgB;IAkBpC,OAAO,CAAC,aAAa;IAsNf,KAAK;CAKZ"}