brainchain-mcp 0.7.0 → 0.7.2
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 +11 -11
- package/dist/bonds.js +22 -2
- package/dist/config.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Read the key without echoing it or leaving it in your shell history, then add th
|
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
printf 'Key: ' && read -rs BRAINCHAIN_PAYER_KEY && echo
|
|
19
|
-
claude mcp add brainchain --scope user -e BRAINCHAIN_PAYER_KEY="$BRAINCHAIN_PAYER_KEY" -- npx -y brainchain-mcp@0.7.
|
|
19
|
+
claude mcp add brainchain --scope user -e BRAINCHAIN_PAYER_KEY="$BRAINCHAIN_PAYER_KEY" -- npx -y brainchain-mcp@0.7.2
|
|
20
20
|
unset BRAINCHAIN_PAYER_KEY
|
|
21
21
|
```
|
|
22
22
|
|
|
@@ -27,7 +27,7 @@ unset BRAINCHAIN_PAYER_KEY
|
|
|
27
27
|
"mcpServers": {
|
|
28
28
|
"brainchain": {
|
|
29
29
|
"command": "npx",
|
|
30
|
-
"args": ["-y", "brainchain-mcp@0.7.
|
|
30
|
+
"args": ["-y", "brainchain-mcp@0.7.2"],
|
|
31
31
|
"env": { "BRAINCHAIN_PAYER_KEY": "${BRAINCHAIN_PAYER_KEY}" }
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -45,7 +45,7 @@ Or add the server to a project's `.cursor/mcp.json` (`~/.cursor/mcp.json` for ev
|
|
|
45
45
|
"mcpServers": {
|
|
46
46
|
"brainchain": {
|
|
47
47
|
"command": "npx",
|
|
48
|
-
"args": ["-y", "brainchain-mcp@0.7.
|
|
48
|
+
"args": ["-y", "brainchain-mcp@0.7.2"],
|
|
49
49
|
"env": { "BRAINCHAIN_PAYER_KEY": "${env:BRAINCHAIN_PAYER_KEY}" }
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -63,7 +63,7 @@ Add the server to the client's `mcpServers` configuration. For Claude Desktop th
|
|
|
63
63
|
"mcpServers": {
|
|
64
64
|
"brainchain": {
|
|
65
65
|
"command": "npx",
|
|
66
|
-
"args": ["-y", "brainchain-mcp@0.7.
|
|
66
|
+
"args": ["-y", "brainchain-mcp@0.7.2"],
|
|
67
67
|
"env": { "BRAINCHAIN_PAYER_KEY": "0xYOUR_KEY" }
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -82,7 +82,7 @@ These clients keep the key in that file as plain text.
|
|
|
82
82
|
"brainchain": {
|
|
83
83
|
"type": "stdio",
|
|
84
84
|
"command": "npx",
|
|
85
|
-
"args": ["-y", "brainchain-mcp@0.7.
|
|
85
|
+
"args": ["-y", "brainchain-mcp@0.7.2"],
|
|
86
86
|
"env": { "BRAINCHAIN_PAYER_KEY": "${input:brainchain-key}" }
|
|
87
87
|
}
|
|
88
88
|
},
|
|
@@ -100,10 +100,10 @@ Save the key in a file only your account can read, then point the server at it:
|
|
|
100
100
|
mkdir -p ~/.brainchain
|
|
101
101
|
(umask 077; printf 'Key: ' && read -rs key && echo && printf '%s\n' "$key" > ~/.brainchain/payer.key)
|
|
102
102
|
chmod 600 ~/.brainchain/payer.key
|
|
103
|
-
openclaw mcp set brainchain '{"command":"npx","args":["-y","brainchain-mcp@0.7.
|
|
103
|
+
openclaw mcp set brainchain '{"command":"npx","args":["-y","brainchain-mcp@0.7.2"],"env":{"BRAINCHAIN_PAYER_KEY_FILE":"~/.brainchain/payer.key"}}'
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
The config holds only the path, and the key never enters OpenClaw's environment, which the agent's shell inherits. A key saved in `skills.entries.brainchain.apiKey` does not reach the server. `BRAINCHAIN_PAYER_KEY_FILE=~/.brainchain/payer.key npx -y brainchain-mcp@0.7.
|
|
106
|
+
The config holds only the path, and the key never enters OpenClaw's environment, which the agent's shell inherits. A key saved in `skills.entries.brainchain.apiKey` does not reach the server. `BRAINCHAIN_PAYER_KEY_FILE=~/.brainchain/payer.key npx -y brainchain-mcp@0.7.2 wallet` checks the file and prints the wallet it holds and its balance. [`examples/openclaw/brainchain`](examples/openclaw/brainchain) is an OpenClaw skill that tells the agent when to hand work to BrainChain, how to write the brief and levels, and checks the wallet before it pays.
|
|
107
107
|
|
|
108
108
|
Each setup above pays in USDG on Robinhood Chain. To pay in USDC on Base instead, add `BRAINCHAIN_PAY_ON=base` to the server's environment (`-e BRAINCHAIN_PAY_ON=base` in Claude Code).
|
|
109
109
|
|
|
@@ -117,7 +117,7 @@ Each brief is posted on BrainChain and each result is served at a public link. K
|
|
|
117
117
|
|
|
118
118
|
```bash
|
|
119
119
|
printf 'Key: ' && read -rs BRAINCHAIN_PAYER_KEY && echo && export BRAINCHAIN_PAYER_KEY
|
|
120
|
-
npx -y brainchain-mcp@0.7.
|
|
120
|
+
npx -y brainchain-mcp@0.7.2 approve
|
|
121
121
|
unset BRAINCHAIN_PAYER_KEY
|
|
122
122
|
```
|
|
123
123
|
|
|
@@ -166,7 +166,7 @@ Every hire and grade is recorded on BrainChain and listed at [usebrainchain.com/
|
|
|
166
166
|
| `BRAINCHAIN_STATE_DIR` | `~/.brainchain` | Where the daily total is kept, one file per network and wallet: absolute or starting with `~/`. |
|
|
167
167
|
| `BRAINCHAIN_DESK_URL`, `BRAINCHAIN_PAY_TO`, `BRAINCHAIN_PAYMENT_NETWORK`, `BRAINCHAIN_PAYMENT_ASSET`, `BRAINCHAIN_PAYMENT_RPC` | network preset | Override a single setting. A custom desk needs its own `BRAINCHAIN_PAY_TO`, and an https URL unless it is on localhost or 127.0.0.1. |
|
|
168
168
|
|
|
169
|
-
If a setting is invalid, the server says so once on stderr when it starts, and both tools return the error. A key it cannot use is reported the same way, except that `brainchain_get_task` needs no key and keeps working, and so is a `BRAINCHAIN_STATE_DIR` that cannot hold the daily limit's record when `BRAINCHAIN_DAILY_UNITS` is set. `npx -y brainchain-mcp@0.7.
|
|
169
|
+
If a setting is invalid, the server says so once on stderr when it starts, and both tools return the error. A key it cannot use is reported the same way, except that `brainchain_get_task` needs no key and keeps working, and so is a `BRAINCHAIN_STATE_DIR` that cannot hold the daily limit's record when `BRAINCHAIN_DAILY_UNITS` is set. `npx -y brainchain-mcp@0.7.2 wallet` checks the settings and the key, and prints the wallet that pays, what it holds and, for USDG, what Permit2 may spend. `--help` lists the commands and variables, and `--version` prints the version.
|
|
170
170
|
|
|
171
171
|
## Try it on testnet
|
|
172
172
|
|
|
@@ -174,7 +174,7 @@ Set `BRAINCHAIN_NETWORK=testnet` in the server's environment. Test tokens have n
|
|
|
174
174
|
|
|
175
175
|
```bash
|
|
176
176
|
printf 'Key: ' && read -rs BRAINCHAIN_PAYER_KEY && echo
|
|
177
|
-
claude mcp add brainchain --scope user -e BRAINCHAIN_NETWORK=testnet -e BRAINCHAIN_PAYER_KEY="$BRAINCHAIN_PAYER_KEY" -- npx -y brainchain-mcp@0.7.
|
|
177
|
+
claude mcp add brainchain --scope user -e BRAINCHAIN_NETWORK=testnet -e BRAINCHAIN_PAYER_KEY="$BRAINCHAIN_PAYER_KEY" -- npx -y brainchain-mcp@0.7.2
|
|
178
178
|
unset BRAINCHAIN_PAYER_KEY
|
|
179
179
|
```
|
|
180
180
|
|
|
@@ -193,7 +193,7 @@ unset BRAINCHAIN_PAYER_KEY
|
|
|
193
193
|
|
|
194
194
|
```bash
|
|
195
195
|
printf 'Key: ' && read -rs BRAINCHAIN_PAYER_KEY && echo && export BRAINCHAIN_PAYER_KEY
|
|
196
|
-
BRAINCHAIN_NETWORK=testnet npx -y brainchain-mcp@0.7.
|
|
196
|
+
BRAINCHAIN_NETWORK=testnet npx -y brainchain-mcp@0.7.2 approve
|
|
197
197
|
unset BRAINCHAIN_PAYER_KEY
|
|
198
198
|
```
|
|
199
199
|
|
package/dist/bonds.js
CHANGED
|
@@ -114,6 +114,21 @@ export function bondsClosed(config) {
|
|
|
114
114
|
return "Delivery bonds are not open yet: BrainChain's ProofIndex on Robinhood Chain, which a bond's check reads, is not deployed. A later release of brainchain-mcp names it.";
|
|
115
115
|
return undefined;
|
|
116
116
|
}
|
|
117
|
+
/** Shipped's own number and page for a deed; absent for a test bond or when the API cannot be reached. */
|
|
118
|
+
export const SHIPPED_API = "https://api.shipped.bond";
|
|
119
|
+
export async function deedPage(deed, fetchImpl = fetch) {
|
|
120
|
+
try {
|
|
121
|
+
const response = await fetchImpl(`${SHIPPED_API}/v1/deeds/${deed}`, { signal: AbortSignal.timeout(5_000) });
|
|
122
|
+
if (!response.ok)
|
|
123
|
+
return undefined;
|
|
124
|
+
const body = (await response.json());
|
|
125
|
+
const { number, url } = body.deed ?? {};
|
|
126
|
+
return typeof number === "string" && typeof url === "string" ? { number, url } : undefined;
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
117
132
|
export function createBonds(options) {
|
|
118
133
|
const { config, limits } = options;
|
|
119
134
|
let chain;
|
|
@@ -178,8 +193,10 @@ export function createBonds(options) {
|
|
|
178
193
|
if (approves)
|
|
179
194
|
await c.approve(amount);
|
|
180
195
|
const { deed, tx } = await c.create(terms, amount);
|
|
196
|
+
const page = await deedPage(deed, options.fetch);
|
|
181
197
|
return {
|
|
182
198
|
bond: deed.toString(),
|
|
199
|
+
...(page ? { number: page.number, url: page.url } : {}),
|
|
183
200
|
tx,
|
|
184
201
|
task: task.toString(),
|
|
185
202
|
amount: `${formatUnits(amount)} USDG`,
|
|
@@ -199,12 +216,15 @@ export function createBonds(options) {
|
|
|
199
216
|
const bonds = await c.bondsOn(task);
|
|
200
217
|
if (bonds.length === 0)
|
|
201
218
|
return { task: task.toString(), wallet: c.account, bonds: [] };
|
|
202
|
-
const [now, indexed] = await Promise.all([c.now(), c.proofOf(task)]);
|
|
219
|
+
const [now, indexed, pages] = await Promise.all([c.now(), c.proofOf(task), Promise.all(bonds.map((b) => deedPage(b.deed, options.fetch)))]);
|
|
203
220
|
return {
|
|
204
221
|
task: task.toString(),
|
|
205
222
|
wallet: c.account,
|
|
206
223
|
proofIndexed: indexed > 0n,
|
|
207
|
-
bonds: bonds.map((b) =>
|
|
224
|
+
bonds: bonds.map((b, i) => {
|
|
225
|
+
const page = pages[i];
|
|
226
|
+
return { bond: b.deed.toString(), ...(page ? { number: page.number, url: page.url } : {}), amount: `${formatUnits(b.amount)} USDG`, deadline: iso(b.deadline), ...state(b, indexed > 0n, now) };
|
|
227
|
+
}),
|
|
208
228
|
};
|
|
209
229
|
},
|
|
210
230
|
};
|
package/dist/config.js
CHANGED
|
@@ -49,6 +49,7 @@ const BONDS = {
|
|
|
49
49
|
registry: "0xD5Da523ee49CB7Fe855B0C6fa38707190A9D531F",
|
|
50
50
|
check: "0x2e7C4F0F2e6079C3B5F7Cd2440308234CBDc537D",
|
|
51
51
|
usdg: "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
|
|
52
|
+
proofIndex: "0x0fb02559e704549794EdF3FBBBe91DB88bB849ee",
|
|
52
53
|
rpc: "https://rpc.mainnet.chain.robinhood.com",
|
|
53
54
|
chain: "Robinhood Chain",
|
|
54
55
|
brainchain: { rpc: "https://rpc.usebrainchain.com", chainId: 274663, board: "0x8385bb4b8990411CcdD8e851B2676da1A4C1f3C4" },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brainchain-mcp",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "MCP server for BrainChain: let your agent hire a frontier model for a task and pay in USDG on Robinhood Chain or USDC on Base, only for work that meets the quality bar you set.",
|
|
5
5
|
"mcpName": "com.usebrainchain/brainchain",
|
|
6
6
|
"license": "MIT",
|