everyblock-mcp 0.2.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/LICENSE.md +75 -0
- package/README.md +92 -0
- package/dist/abi.js +1720 -0
- package/dist/chain.js +202 -0
- package/dist/main.js +18 -0
- package/dist/orders.js +178 -0
- package/dist/server.js +638 -0
- package/package.json +49 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
Required Notice: Copyright (c) 2026 Samuel Aleonomoh (https://github.com/Osiyomeoh)
|
|
2
|
+
|
|
3
|
+
# PolyForm Noncommercial License 1.0.0
|
|
4
|
+
|
|
5
|
+
<https://polyformproject.org/licenses/noncommercial/1.0.0>
|
|
6
|
+
|
|
7
|
+
## Acceptance
|
|
8
|
+
|
|
9
|
+
In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
|
|
10
|
+
|
|
11
|
+
## Copyright License
|
|
12
|
+
|
|
13
|
+
The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
|
|
14
|
+
|
|
15
|
+
## Distribution License
|
|
16
|
+
|
|
17
|
+
The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
|
|
18
|
+
|
|
19
|
+
## Notices
|
|
20
|
+
|
|
21
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
|
|
22
|
+
|
|
23
|
+
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
|
|
24
|
+
|
|
25
|
+
## Changes and New Works License
|
|
26
|
+
|
|
27
|
+
The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
|
|
28
|
+
|
|
29
|
+
## Patent License
|
|
30
|
+
|
|
31
|
+
The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
|
|
32
|
+
|
|
33
|
+
## Noncommercial Purposes
|
|
34
|
+
|
|
35
|
+
Any noncommercial purpose is a permitted purpose.
|
|
36
|
+
|
|
37
|
+
## Personal Uses
|
|
38
|
+
|
|
39
|
+
Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
|
|
40
|
+
|
|
41
|
+
## Noncommercial Organizations
|
|
42
|
+
|
|
43
|
+
Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
|
|
44
|
+
|
|
45
|
+
## Fair Use
|
|
46
|
+
|
|
47
|
+
You may have "fair use" rights for the software under the law. These terms do not limit them.
|
|
48
|
+
|
|
49
|
+
## No Other Rights
|
|
50
|
+
|
|
51
|
+
These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
|
|
52
|
+
|
|
53
|
+
## Patent Defense
|
|
54
|
+
|
|
55
|
+
If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
56
|
+
|
|
57
|
+
## Violations
|
|
58
|
+
|
|
59
|
+
The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
|
|
60
|
+
|
|
61
|
+
## No Liability
|
|
62
|
+
|
|
63
|
+
***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
|
|
64
|
+
|
|
65
|
+
## Definitions
|
|
66
|
+
|
|
67
|
+
The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
|
|
68
|
+
|
|
69
|
+
**You** refers to the individual or entity agreeing to these terms.
|
|
70
|
+
|
|
71
|
+
**Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
72
|
+
|
|
73
|
+
**Your licenses** are all the licenses granted to you for the software under these terms.
|
|
74
|
+
|
|
75
|
+
**Use** means anything you do with the software requiring one of your licenses.
|
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# everyblock-mcp
|
|
2
|
+
|
|
3
|
+
An MCP server (stdio) that lets any AI agent read, quote and trade Everyblock's 5-minute UP/DOWN markets on Monad.
|
|
4
|
+
It is built on `@modelcontextprotocol/sdk` and viem, and runs on Node 22.18+ with native TypeScript (no build step).
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
npx -y everyblock-mcp # Monad testnet deployment, read-only
|
|
8
|
+
MCP_PRIVATE_KEY=0x... npx -y everyblock-mcp # trading, with a fresh testnet-only key
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
With neither `RPC_URL` nor `EVERYBLOCK` set it talks to the live Monad testnet deployment. From the repo:
|
|
12
|
+
`cd mcp && npm ci && npm start`. The app's own guide: https://everyblock-gray.vercel.app/agents
|
|
13
|
+
|
|
14
|
+
## Tools
|
|
15
|
+
|
|
16
|
+
| Tool | Writes | What it does |
|
|
17
|
+
| --- | --- | --- |
|
|
18
|
+
| `list_markets` | no | The current and next market for each listed feed: open/close times, status, strike, outcome, last clearing price, fee (bps; 0 when the contract has no `marketFeeBps`). |
|
|
19
|
+
| `get_market` | no | One market by id, with the same fields. |
|
|
20
|
+
| `get_batch` | no | One batch (block): its bid/ask levels per tick and the uniform clearing price and volume. |
|
|
21
|
+
| `get_positions` | no | An account's UP/DOWN balances and its recent orders, each with `previewClaim` (fills, refund, price improvement). |
|
|
22
|
+
| `preview_order` | no | Quotes an order without sending it: the tick it maps to, the escrow (a buy escrows its fee too; the unused part comes back on claim), the fee, and the worst and best case net of the fee. |
|
|
23
|
+
| `place_order` | yes | Places a `side` (buy/sell), `outcome` (up/down), `price` (cents, 1 to 99) and `size` order. It approves collateral if needed and returns the nonce and batch. |
|
|
24
|
+
| `claim` | yes | Claims one or many order nonces and returns the fills, refund and price improvement for each. |
|
|
25
|
+
| `redeem` | yes | Pays out winning shares after a market is resolved. |
|
|
26
|
+
| `split` / `merge` | yes | Mints complete sets (1 UP + 1 DOWN for $1.00), or burns them back into collateral. |
|
|
27
|
+
| `faucet` | yes | Mints TestUSD collateral (testnet and local only). |
|
|
28
|
+
| `open_market` | yes | Opens the current (or next) market for a feed when no keeper has; returns the existing id if it is open. |
|
|
29
|
+
| `settle` | yes | Proves a market's price to beat and/or its result with signed Pyth prices from the app's `/api/proof` (no Pyth key needed), paying Pyth's update fee. |
|
|
30
|
+
|
|
31
|
+
Every write returns the transaction hash and the decoded result (events and amounts). Writes run one at a time.
|
|
32
|
+
|
|
33
|
+
## Configuration (environment)
|
|
34
|
+
|
|
35
|
+
| Variable | Default | Meaning |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| `RPC_URL` | Monad testnet | Chain RPC. Set it and `EVERYBLOCK` together for another deployment. |
|
|
38
|
+
| `EVERYBLOCK` | testnet deployment | Everyblock contract address. |
|
|
39
|
+
| `EVERYBLOCK_PROOF_URL` | the hosted app on testnet | The app's `/api/proof`, where `settle` gets signed prices. `""` disables `settle`. |
|
|
40
|
+
| `FEEDS` | BTC, ETH, SOL, MON | Comma-separated Pyth feed ids that `list_markets` covers. |
|
|
41
|
+
| `MCP_PRIVATE_KEY` | unset | The trading wallet's key, for writes. The server reads it and never prints or logs it. Without a key or an unlocked account, the server is read-only. |
|
|
42
|
+
| `MCP_UNLOCKED_ACCOUNT` | unset | Instead of a key, an unlocked node account. This only works with a localhost RPC (anvil). |
|
|
43
|
+
| `MCP_ALLOWED_CHAINS` | `10143,31337` | Chain ids where writes may run. Writes on any other chain are refused. To trade mainnet, add `143` deliberately. |
|
|
44
|
+
| `MCP_MAX_ORDER_SIZE` | `100` | Maximum shares per order. |
|
|
45
|
+
| `MCP_MAX_SPEND_USD` | `50` | Maximum collateral one write call may commit. The server also approves no more than this. |
|
|
46
|
+
| `MCP_LOG_RANGE` / `MCP_LOG_LOOKBACK` | `100` / `2000` | Blocks per `eth_getLogs` call, and how far back `get_positions` looks. |
|
|
47
|
+
|
|
48
|
+
## Claude Desktop / Claude Code
|
|
49
|
+
|
|
50
|
+
In `claude_desktop_config.json` (or `.mcp.json` for Claude Code), the key comes from your environment. Never paste
|
|
51
|
+
it into the file:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"mcpServers": {
|
|
56
|
+
"everyblock": {
|
|
57
|
+
"command": "node",
|
|
58
|
+
"args": ["/absolute/path/to/everyblock/mcp/src/main.ts"],
|
|
59
|
+
"env": {
|
|
60
|
+
"RPC_URL": "https://testnet-rpc.monad.xyz",
|
|
61
|
+
"EVERYBLOCK": "0xYourEveryblockAddress",
|
|
62
|
+
"MCP_ALLOWED_CHAINS": "10143",
|
|
63
|
+
"MCP_MAX_ORDER_SIZE": "100",
|
|
64
|
+
"MCP_MAX_SPEND_USD": "50"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
In Claude Code, you can add it with the key taken from your shell:
|
|
72
|
+
`claude mcp add everyblock -e RPC_URL=... -e EVERYBLOCK=... -e MCP_PRIVATE_KEY="$MCP_PRIVATE_KEY" -- node /abs/path/mcp/src/main.ts`.
|
|
73
|
+
|
|
74
|
+
## Tests
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
npm run typecheck
|
|
78
|
+
npm run test:unit # order math and batch clearing (no chain)
|
|
79
|
+
npm test # + e2e: anvil on :8554, DeployLocal, the keeper with mock prices, two agents
|
|
80
|
+
# and e2e-nokeeper: anvil on :8556, open_market + settle with no keeper
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The e2e test needs `anvil` and `forge` on PATH, and `npm ci` in `keeper/`. It takes about 1.5 minutes because it waits
|
|
84
|
+
for a market to close and resolve. It covers listing, preview, the safety rails, split, two agents' orders clearing
|
|
85
|
+
in one block at one price, claim, merge, redeem after the keeper resolves, and the stdio entry point.
|
|
86
|
+
|
|
87
|
+
`npm run build` compiles `src/` to `dist/` for the npm package (`prepublishOnly` runs typecheck, build and the unit
|
|
88
|
+
tests). `npm run abi` regenerates `src/abi.ts` from the Foundry build (run `forge build` in `contracts/` first).
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
[PolyForm Noncommercial 1.0.0](LICENSE.md): free to use, copy and modify for any noncommercial purpose (personal use, research, education, hobby projects, nonprofits). Selling it or using it commercially needs written permission from the author. Copyright (c) 2026 Samuel Aleonomoh.
|