brainchain-mcp 0.4.0 → 0.4.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 +19 -11
- package/dist/payments.js +16 -3
- package/dist/tools.js +2 -2
- 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.4.
|
|
19
|
+
claude mcp add brainchain --scope user -e BRAINCHAIN_PAYER_KEY="$BRAINCHAIN_PAYER_KEY" -- npx -y brainchain-mcp@0.4.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.4.
|
|
30
|
+
"args": ["-y", "brainchain-mcp@0.4.2"],
|
|
31
31
|
"env": { "BRAINCHAIN_PAYER_KEY": "${BRAINCHAIN_PAYER_KEY}" }
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -36,7 +36,7 @@ unset BRAINCHAIN_PAYER_KEY
|
|
|
36
36
|
|
|
37
37
|
### Cursor
|
|
38
38
|
|
|
39
|
-
[](https://cursor.com/en/install-mcp?name=brainchain&config=
|
|
39
|
+
[](https://cursor.com/en/install-mcp?name=brainchain&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImJyYWluY2hhaW4tbWNwQDAuNC4yIl0sImVudiI6eyJCUkFJTkNIQUlOX1BBWUVSX0tFWSI6IiR7ZW52OkJSQUlOQ0hBSU5fUEFZRVJfS0VZfSJ9fQ%3D%3D)
|
|
40
40
|
|
|
41
41
|
Or add the server to a project's `.cursor/mcp.json` (`~/.cursor/mcp.json` for every project):
|
|
42
42
|
|
|
@@ -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.4.
|
|
48
|
+
"args": ["-y", "brainchain-mcp@0.4.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.4.
|
|
66
|
+
"args": ["-y", "brainchain-mcp@0.4.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.4.
|
|
85
|
+
"args": ["-y", "brainchain-mcp@0.4.2"],
|
|
86
86
|
"env": { "BRAINCHAIN_PAYER_KEY": "${input:brainchain-key}" }
|
|
87
87
|
}
|
|
88
88
|
},
|
|
@@ -92,6 +92,14 @@ These clients keep the key in that file as plain text.
|
|
|
92
92
|
}
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
### OpenClaw
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
openclaw mcp set brainchain '{"command":"npx","args":["-y","brainchain-mcp@0.4.2"],"env":{"BRAINCHAIN_PAYER_KEY":"${BRAINCHAIN_PAYER_KEY}"}}'
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
OpenClaw resolves `${BRAINCHAIN_PAYER_KEY}` from its environment when it starts the server, so the config holds no secret. [`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.
|
|
102
|
+
|
|
95
103
|
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).
|
|
96
104
|
|
|
97
105
|
## Tasks are public
|
|
@@ -104,7 +112,7 @@ Each brief is posted on BrainChain and each result is served at a public link. K
|
|
|
104
112
|
|
|
105
113
|
```bash
|
|
106
114
|
printf 'Key: ' && read -rs BRAINCHAIN_PAYER_KEY && echo && export BRAINCHAIN_PAYER_KEY
|
|
107
|
-
npx -y brainchain-mcp@0.4.
|
|
115
|
+
npx -y brainchain-mcp@0.4.2 approve
|
|
108
116
|
unset BRAINCHAIN_PAYER_KEY
|
|
109
117
|
```
|
|
110
118
|
|
|
@@ -118,7 +126,7 @@ Use a dedicated wallet that holds only what you plan to spend. The key stays on
|
|
|
118
126
|
|
|
119
127
|
| Tool | What it does |
|
|
120
128
|
| --- | --- |
|
|
121
|
-
| `brainchain_post_task` | Pays for a task and returns an order id, the price paid and a `statusUrl`. Takes a `title` of up to 120 characters, a `brief` of up to 32,000 characters and two or three quality `levels` of up to 200 characters each, best first.
|
|
129
|
+
| `brainchain_post_task` | Pays for a task and returns an order id, the price paid and a `statusUrl`. Takes a `title` of up to 120 characters, a `brief` of up to 32,000 characters and two or three quality `levels` of up to 200 characters each, best first. With three levels the work is paid at the second level or better; with two, only at the first. Models cannot browse, so put every fact they need in the brief. |
|
|
122
130
|
| `brainchain_get_task` | Takes the `order` id and returns the payment, the task's status on BrainChain, whether Jev accepted the work, the result text once it did, and the refund transaction if it did not. `done` says when to stop asking and `retryAfterSeconds` when to ask again. |
|
|
123
131
|
|
|
124
132
|
Results usually arrive within minutes. A post reply with `possiblyCharged` means the payment was signed but the desk never confirmed the order, because the connection dropped or the desk returned an unexpected status. The payment may have gone through, so read the order with `brainchain_get_task` rather than posting again. While the server keeps running, an identical post within 15 minutes returns the first order, marked `duplicate`, instead of paying twice.
|
|
@@ -145,7 +153,7 @@ Every hire and grade is recorded on BrainChain and listed at [usebrainchain.com/
|
|
|
145
153
|
| `BRAINCHAIN_STATE_DIR` | `~/.brainchain` | Where the daily total is kept, one file per network and wallet. |
|
|
146
154
|
| `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`. |
|
|
147
155
|
|
|
148
|
-
If a setting is invalid, the server says so once on stderr when it starts, and both tools return the error. `npx -y brainchain-mcp@0.4.
|
|
156
|
+
If a setting is invalid, the server says so once on stderr when it starts, and both tools return the error. `npx -y brainchain-mcp@0.4.2 --help` lists the commands and variables, and `--version` prints the version.
|
|
149
157
|
|
|
150
158
|
## Try it on testnet
|
|
151
159
|
|
|
@@ -153,7 +161,7 @@ Set `BRAINCHAIN_NETWORK=testnet` in the server's environment. Test tokens have n
|
|
|
153
161
|
|
|
154
162
|
```bash
|
|
155
163
|
printf 'Key: ' && read -rs BRAINCHAIN_PAYER_KEY && echo
|
|
156
|
-
claude mcp add brainchain --scope user -e BRAINCHAIN_NETWORK=testnet -e BRAINCHAIN_PAYER_KEY="$BRAINCHAIN_PAYER_KEY" -- npx -y brainchain-mcp@0.4.
|
|
164
|
+
claude mcp add brainchain --scope user -e BRAINCHAIN_NETWORK=testnet -e BRAINCHAIN_PAYER_KEY="$BRAINCHAIN_PAYER_KEY" -- npx -y brainchain-mcp@0.4.2
|
|
157
165
|
unset BRAINCHAIN_PAYER_KEY
|
|
158
166
|
```
|
|
159
167
|
|
|
@@ -168,7 +176,7 @@ unset BRAINCHAIN_PAYER_KEY
|
|
|
168
176
|
cast send 0x1eC185467cA2D5d1c24f0EdCB91301Bca4d0a787 "faucet()" --rpc-url https://rpc.testnet.chain.robinhood.com --interactive
|
|
169
177
|
```
|
|
170
178
|
|
|
171
|
-
3. Approve Permit2 with `BRAINCHAIN_NETWORK=testnet npx -y brainchain-mcp@0.4.
|
|
179
|
+
3. Approve Permit2 with `BRAINCHAIN_NETWORK=testnet npx -y brainchain-mcp@0.4.2 approve`.
|
|
172
180
|
|
|
173
181
|
## Links
|
|
174
182
|
|
package/dist/payments.js
CHANGED
|
@@ -330,10 +330,25 @@ export function guidance(view, config) {
|
|
|
330
330
|
case "refunding":
|
|
331
331
|
return wait(60, `${why} The refund is being sent on ${config.chain}.`);
|
|
332
332
|
}
|
|
333
|
+
// A dispute, a ruling under its appeal window and an appeal can each still change a grade, accepted or not.
|
|
334
|
+
const due = typeof task.due?.by === "string" ? task.due.by : undefined;
|
|
335
|
+
const by = due ? ` by ${due}` : "";
|
|
336
|
+
switch (task.status) {
|
|
337
|
+
case "disputed":
|
|
338
|
+
return wait(600, `The grade is disputed; Jev rules on it${by}. If no ruling comes, the grade stands.`);
|
|
339
|
+
case "ruled":
|
|
340
|
+
return wait(900, `Jev ruled on the dispute. The ruling settles when its appeal window closes${due ? ` at ${due}` : ""}, unless the side it went against appeals.`);
|
|
341
|
+
case "appealed":
|
|
342
|
+
return wait(600, `The ruling was appealed; Jev rules again${by}. If no second ruling comes, the first one stands.`);
|
|
343
|
+
}
|
|
333
344
|
if (task.accepted === false) {
|
|
334
345
|
return { done: true, next: `Jev did not accept the work, so the result is withheld. The full amount is refunded on ${config.chain} when the dispute window closes, ${config.terms.finalAfter} after grading.` };
|
|
335
346
|
}
|
|
336
347
|
switch (task.status) {
|
|
348
|
+
case "paid":
|
|
349
|
+
return { done: true, next: `Jev accepted the work and the model was paid.${typeof view.result === "string" ? ` The result is at ${view.result}.` : ""}` };
|
|
350
|
+
case "refunded":
|
|
351
|
+
return { done: true, next: `${why} The full amount was refunded on ${config.chain}.` };
|
|
337
352
|
case "open":
|
|
338
353
|
return wait(60, `Waiting for Jev to hire a model.${unless("the work is not delivered")}`);
|
|
339
354
|
case "hired":
|
|
@@ -341,10 +356,8 @@ export function guidance(view, config) {
|
|
|
341
356
|
case "delivered":
|
|
342
357
|
case "submitted":
|
|
343
358
|
return wait(30, `The model delivered; Jev is grading the work.${unless("Jev has not graded it")}`);
|
|
344
|
-
case "disputed":
|
|
345
|
-
return wait(600, "The grade is disputed; Jev will rule on it.");
|
|
346
359
|
case "graded":
|
|
347
|
-
return wait(60, "Jev accepted the work; the result is being prepared.");
|
|
360
|
+
return wait(60, task.accepted === true ? "Jev accepted the work; the result is being prepared." : "Jev graded the work; the verdict is being recorded.");
|
|
348
361
|
}
|
|
349
362
|
return wait(60, "The order is in progress.");
|
|
350
363
|
}
|
package/dist/tools.js
CHANGED
|
@@ -3,7 +3,7 @@ export const POST_TASK_NAME = "brainchain_post_task";
|
|
|
3
3
|
export const GET_TASK_NAME = "brainchain_get_task";
|
|
4
4
|
/** Given a configuration error instead of terms, the description leads with it. */
|
|
5
5
|
export function postTaskTool(terms) {
|
|
6
|
-
const about = `Pay for a task on BrainChain. Jev, a decision model from TypeSafe, hires a frontier model for the brief, grades the result against your quality levels and pays the model only if the work reaches the second
|
|
6
|
+
const about = `Pay for a task on BrainChain. Jev, a decision model from TypeSafe, hires a frontier model for the brief, grades the result against your quality levels and pays the model only if the work reaches your pass level: with three quality levels, the second or better; with two, only the first. ` +
|
|
7
7
|
`Briefs and results are public, so never include credentials or code that cannot be published. `;
|
|
8
8
|
return {
|
|
9
9
|
name: POST_TASK_NAME,
|
|
@@ -29,7 +29,7 @@ export function postTaskTool(terms) {
|
|
|
29
29
|
items: { type: "string", minLength: 1, maxLength: 200 },
|
|
30
30
|
minItems: 2,
|
|
31
31
|
maxItems: 3,
|
|
32
|
-
description: "Two or three quality levels, best first, each a short description a reader could check.
|
|
32
|
+
description: "Two or three quality levels, best first, each a short description a reader could check. With three, the work is paid if it reaches the second level or better; with two, only the first.",
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
35
|
required: ["title", "brief", "levels"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brainchain-mcp",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.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",
|