@blindmarket/mcp-server 0.3.3 → 0.3.5
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 +46 -4
- package/dist/crypto.d.ts +16 -0
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +41 -0
- package/dist/crypto.js.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/rent.d.ts +4 -1
- package/dist/rent.d.ts.map +1 -1
- package/dist/rent.js +809 -50
- package/dist/rent.js.map +1 -1
- package/dist/settlement.d.ts +98 -0
- package/dist/settlement.d.ts.map +1 -0
- package/dist/settlement.js +145 -0
- package/dist/settlement.js.map +1 -0
- package/dist/state.d.ts +27 -5
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js.map +1 -1
- package/dist/tools.js +2 -2
- package/dist/tools.js.map +1 -1
- package/dist/wallet.d.ts +6 -11
- package/dist/wallet.d.ts.map +1 -1
- package/dist/wallet.js +48 -14
- package/dist/wallet.js.map +1 -1
- package/package.json +2 -2
package/dist/wallet.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { Wallet, JsonRpcProvider, formatEther } from 'ethers';
|
|
2
|
+
/**
|
|
3
|
+
* Local signing wallet for the trust-preserving (Tier 2) flows: rent_service /
|
|
4
|
+
* post_task fund escrow from THIS wallet, and briefs are encrypted locally —
|
|
5
|
+
* the platform never sees plaintext or keys.
|
|
6
|
+
*
|
|
7
|
+
* The private key never appears in any tool output or log. Configure via:
|
|
8
|
+
* BLINDMARKET_PRIVATE_KEY hex private key of the funding wallet
|
|
9
|
+
* BLINDMARKET_RPC_URL optional; defaults to 0G Mainnet
|
|
10
|
+
* BLINDMARKET_CHAIN_ID optional; defaults to 16661 (0G Mainnet)
|
|
11
|
+
*/
|
|
12
|
+
import { derivePublicKeyHex } from './crypto.js';
|
|
2
13
|
export const DEFAULT_RPC_URL = 'https://evmrpc.0g.ai';
|
|
3
14
|
export const DEFAULT_CHAIN_ID = 16661;
|
|
4
15
|
export function loadWallet() {
|
|
@@ -11,30 +22,53 @@ export function loadWallet() {
|
|
|
11
22
|
const wallet = new Wallet(pk.startsWith('0x') ? pk : `0x${pk}`, provider);
|
|
12
23
|
return { wallet, provider, rpcUrl, chainId };
|
|
13
24
|
}
|
|
14
|
-
|
|
25
|
+
/** `settlement` is the resolver rent.ts builds — how spends are paid for. It
|
|
26
|
+
* is reported here because "is a private key set" stopped being the whole
|
|
27
|
+
* answer once Base landed: on Base nothing signs locally, so a missing key
|
|
28
|
+
* is fine and the thing to show is the relay wallet instead. */
|
|
29
|
+
export function registerWalletTools(server, ctx, settlement) {
|
|
15
30
|
server.registerTool('wallet_status', {
|
|
16
31
|
title: 'Wallet Status',
|
|
17
|
-
description: '
|
|
32
|
+
description: 'How rent_service/post_task/cancel_task/claim_timeout pay: the settlement chain the backend is in (Base USDC via the gas-sponsored relay, or native 0G from the local wallet), the wallet that pays, and its balance. The local wallet section is not_configured if BLINDMARKET_PRIVATE_KEY is unset — that only matters for 0G.',
|
|
18
33
|
inputSchema: {},
|
|
19
34
|
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
20
35
|
}, async () => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
36
|
+
const localWallet = ctx
|
|
37
|
+
? {
|
|
38
|
+
configured: true, address: ctx.wallet.address, chainId: ctx.chainId, rpcUrl: ctx.rpcUrl,
|
|
39
|
+
// What to pass as `publicKey` to register_as_executor. Posters ECIES-wrap
|
|
40
|
+
// the brief key to it, and fetch_brief decrypts with the matching
|
|
41
|
+
// private key — so an executor that registers any OTHER pubkey can
|
|
42
|
+
// accept a private task and never open it.
|
|
43
|
+
executorPublicKey: derivePublicKeyHex(ctx.wallet.privateKey),
|
|
44
|
+
}
|
|
45
|
+
: { configured: false, hint: 'Set BLINDMARKET_PRIVATE_KEY (and optionally BLINDMARKET_RPC_URL) to spend on 0G. Not needed when the backend settles on Base.' };
|
|
46
|
+
if (ctx) {
|
|
47
|
+
try {
|
|
48
|
+
localWallet.balance0G = formatEther(await ctx.provider.getBalance(ctx.wallet.address));
|
|
49
|
+
}
|
|
50
|
+
catch { /* RPC unreachable — report address anyway */ }
|
|
28
51
|
}
|
|
29
|
-
let
|
|
30
|
-
|
|
31
|
-
|
|
52
|
+
let settlementReport;
|
|
53
|
+
if (!settlement) {
|
|
54
|
+
settlementReport = { mode: 'unknown' };
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
try {
|
|
58
|
+
const s = await settlement();
|
|
59
|
+
settlementReport = s.mode === 'base'
|
|
60
|
+
? { mode: 'base', chainId: s.chainId, escrowAddress: s.escrowAddress, usdcAddress: s.usdcAddress, relayChain: s.relayChain, payFrom: s.payFrom, signs: 'backend relay (Privy) — no local key involved. Gas: sponsored in USDC where Privy sponsorship is enabled for this chain, otherwise from payFrom\'s own native balance' }
|
|
61
|
+
: { mode: '0g', payFrom: ctx?.wallet.address ?? null, signs: ctx ? 'local wallet' : 'NOTHING — set BLINDMARKET_PRIVATE_KEY' };
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
settlementReport = { mode: 'unknown', error: err.message };
|
|
65
|
+
}
|
|
32
66
|
}
|
|
33
|
-
catch { /* RPC unreachable — report address anyway */ }
|
|
34
67
|
return {
|
|
35
68
|
content: [{
|
|
36
69
|
type: 'text',
|
|
37
|
-
|
|
70
|
+
// `configured` kept at top level for existing readers of this tool.
|
|
71
|
+
text: JSON.stringify({ configured: !!ctx, ...localWallet, settlement: settlementReport }, null, 2),
|
|
38
72
|
}],
|
|
39
73
|
};
|
|
40
74
|
});
|
package/dist/wallet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,M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K,EAAE,uKAAuK,EAAE;oBAChU,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,OAAO,IAAI,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,uCAAuC,EAAE,CAAC;YAClI,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,gBAAgB,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAG,GAAa,CAAC,OAAO,EAAE,CAAC;YACxE,CAAC;QACH,CAAC;QAED,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAe;oBACrB,oEAAoE;oBACpE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,WAAW,EAAE,UAAU,EAAE,gBAAgB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;iBACnG,CAAC;SACH,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blindmarket/mcp-server",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "MCP server exposing BlindMarket tools — task marketplace, agent management, A2A, and persistent executor loop",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"test": "npm run build && node --test test/*.test.mjs"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@blindmarket/sdk": "^0.
|
|
20
|
+
"@blindmarket/sdk": "^0.6.1",
|
|
21
21
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
22
22
|
"ethers": "^6.13.1",
|
|
23
23
|
"zod": "^3.24.0"
|