Finance Toolkit
500+ transparent financial methods calculated from raw statements, not third-party endpoints.
คำอธิบายจากผู้ทำ (ภาษาอังกฤษตามต้นฉบับ)
Risk limits and an audit log for AI agents trading Hyperliquid, enforced outside the model.
สามเรื่องนี้ไม่รวมเป็นคะแนนเดียว เพราะความเห็น การวัด และความนิยม เป็นคนละเรื่องกัน
ตัวนี้ยังไม่ได้เรียบเรียงเป็นภาษาไทย ด้านล่างคือข้อเท็จจริงที่เราอ่านจาก registry
เลือกโปรแกรม AI ที่คุณใช้ แล้วคัดลอกค่าตั้งไปวาง
REINS_SYMBOLS, REINS_MAX_POSITION_USD, REINS_DAILY_LOSS_USD, REINS_MAX_LEVERAGE, REINS_MODE, REINS_NETWORK, REINS_REQUIRE_STOP_LOSS, REINS_LOG_FILE, REINS_PAPER_FILE, REINS_ACCOUNT_ADDRESS, REINS_PRIVATE_KEYค่าที่ติดป้ายความลับคือกุญแจของบัญชีคุณ อย่าส่งให้ใคร และอย่าวางในแชต
ต้องเตรียมก่อน
คุณใช้แอปไหน
เลือกแอปด้านบน เราจำไว้ให้ ครั้งหน้าปุ่มจะขึ้นว่า “ติดตั้งลง …”
เปิด Claude Desktop → Settings → Developer → Edit Config แล้ววางค่านี้ในไฟล์ claude_desktop_config.json
{
"mcpServers": {
"hyperliquid-reins": {
"command": "npx",
"args": [
"-y",
"@r2rlabs/reins"
],
"env": {
"REINS_SYMBOLS": "ใส่ค่าของคุณ",
"REINS_MAX_POSITION_USD": "ใส่ค่าของคุณ",
"REINS_DAILY_LOSS_USD": "ใส่ค่าของคุณ",
"REINS_MAX_LEVERAGE": "ใส่ค่าของคุณ",
"REINS_MODE": "ใส่ค่าของคุณ",
"REINS_NETWORK": "ใส่ค่าของคุณ",
"REINS_REQUIRE_STOP_LOSS": "ใส่ค่าของคุณ",
"REINS_LOG_FILE": "ใส่ค่าของคุณ",
"REINS_PAPER_FILE": "ใส่ค่าของคุณ",
"REINS_ACCOUNT_ADDRESS": "ใส่ค่าของคุณ",
"REINS_PRIVATE_KEY": "ใส่ค่าของคุณ"
}
}
}
}พิมพ์คำสั่งนี้ใน Terminal
claude mcp add hyperliquid-reins --env REINS_SYMBOLS='ใส่ค่าของคุณ' --env REINS_MAX_POSITION_USD='ใส่ค่าของคุณ' --env REINS_DAILY_LOSS_USD='ใส่ค่าของคุณ' --env REINS_MAX_LEVERAGE='ใส่ค่าของคุณ' --env REINS_MODE='ใส่ค่าของคุณ' --env REINS_NETWORK='ใส่ค่าของคุณ' --env REINS_REQUIRE_STOP_LOSS='ใส่ค่าของคุณ' --env REINS_LOG_FILE='ใส่ค่าของคุณ' --env REINS_PAPER_FILE='ใส่ค่าของคุณ' --env REINS_ACCOUNT_ADDRESS='ใส่ค่าของคุณ' --env REINS_PRIVATE_KEY='ใส่ค่าของคุณ' -- npx -y @r2rlabs/reinsเติมค่าที่เว้นว่างไว้ก่อนรัน
วางในไฟล์ .cursor/mcp.json ของโปรเจกต์ หรือ ~/.cursor/mcp.json
{
"mcpServers": {
"hyperliquid-reins": {
"command": "npx",
"args": [
"-y",
"@r2rlabs/reins"
],
"env": {
"REINS_SYMBOLS": "ใส่ค่าของคุณ",
"REINS_MAX_POSITION_USD": "ใส่ค่าของคุณ",
"REINS_DAILY_LOSS_USD": "ใส่ค่าของคุณ",
"REINS_MAX_LEVERAGE": "ใส่ค่าของคุณ",
"REINS_MODE": "ใส่ค่าของคุณ",
"REINS_NETWORK": "ใส่ค่าของคุณ",
"REINS_REQUIRE_STOP_LOSS": "ใส่ค่าของคุณ",
"REINS_LOG_FILE": "ใส่ค่าของคุณ",
"REINS_PAPER_FILE": "ใส่ค่าของคุณ",
"REINS_ACCOUNT_ADDRESS": "ใส่ค่าของคุณ",
"REINS_PRIVATE_KEY": "ใส่ค่าของคุณ"
}
}
}
}เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง
วางในไฟล์ .vscode/mcp.json ของโปรเจกต์
{
"servers": {
"hyperliquid-reins": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@r2rlabs/reins"
],
"env": {
"REINS_SYMBOLS": "ใส่ค่าของคุณ",
"REINS_MAX_POSITION_USD": "ใส่ค่าของคุณ",
"REINS_DAILY_LOSS_USD": "ใส่ค่าของคุณ",
"REINS_MAX_LEVERAGE": "ใส่ค่าของคุณ",
"REINS_MODE": "ใส่ค่าของคุณ",
"REINS_NETWORK": "ใส่ค่าของคุณ",
"REINS_REQUIRE_STOP_LOSS": "ใส่ค่าของคุณ",
"REINS_LOG_FILE": "ใส่ค่าของคุณ",
"REINS_PAPER_FILE": "ใส่ค่าของคุณ",
"REINS_ACCOUNT_ADDRESS": "ใส่ค่าของคุณ",
"REINS_PRIVATE_KEY": "ใส่ค่าของคุณ"
}
}
}
}เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง
ตัวนี้รันในเครื่องคุณ แต่ ChatGPT ต่อได้เฉพาะ server บนอินเทอร์เน็ต ลองเลือกแอปอื่น
ตัวเลือกเก็บในคุกกี้บนเครื่องนี้ ไม่ต้องมีบัญชี
REINS_MAX_LEVERAGE envREINS_MODE envREINS_NETWORK envREINS_REQUIRE_STOP_LOSS envREINS_LOG_FILE envREINS_PAPER_FILE envREINS_ACCOUNT_ADDRESS envค่าตั้งนี้สร้างจากข้อมูลใน registry ของผู้ทำ ถ้าไม่ตรงกับ README ให้เชื่อ README
รันในเครื่องคุณ รายการเครื่องมือจะขึ้นในแอป AI หลังติดตั้ง
เราตรวจจากข้อมูลที่ใครก็เปิดดูได้ ยังไม่ได้อ่านโค้ด ข้อที่ไม่เกี่ยวกับตัวนี้ไม่นับในตัวหาร · ตรวจเมื่อ 7 พ.ย. 2569
ชื่อใน registry ยืนยันด้วยบัญชี GitHub R2Rlabs ซึ่งเป็นเจ้าของ repo
ยังไม่ได้อ่านข้อมูล repo จาก GitHub
ยังไม่ได้อ่านข้อมูล repo จาก GitHub
ตัวนี้รันบนเครื่องคุณ ไม่มี endpoint บนอินเทอร์เน็ต
ตัวนี้รันบนเครื่อง ใช้ค่าที่ตั้งในเครื่องแทน
รันในเครื่องคุณ เราอ่านรายการเครื่องมือได้เฉพาะตัวที่มี endpoint บนอินเทอร์เน็ต
เทียบกับทุก server ที่ยังใช้งานในหมวดนี้ทั้งทะเบียน ดาวนับเฉพาะเมื่อผู้ลงทะเบียนเป็นเจ้าของ repo
จากการตรวจเบื้องต้นของเรา ผ่าน 1 จาก 1 ข้อที่ตรวจได้ เรายังไม่ได้อ่านโค้ด ก่อนใส่กุญแจหรือ token ให้ดูว่า server ขอสิทธิ์อะไร และเลือกกุญแจที่ทำได้เท่าที่จำเป็น
ต้องใส่ค่าเหล่านี้: REINS_SYMBOLS, REINS_MAX_POSITION_USD, REINS_DAILY_LOSS_USD, REINS_PRIVATE_KEY
รันบนเครื่องของคุณ โปรแกรม AI จะเปิด server ขึ้นมาเองเมื่อใช้ ข้อมูลไม่ต้องผ่านเซิร์ฟเวอร์ของผู้ทำ (ยกเว้นตัวที่ไปเรียกบริการออนไลน์ต่อ)
repo บน GitHub มีการแก้โค้ดล่าสุด – และส่งรุ่นล่าสุด (0.1.8) เข้า registry 34 วันที่ผ่านมา
โปรแกรมที่รองรับ MCP เช่น Claude Desktop, Claude Code, Cursor และ VS Code ตัวนี้ต้องมี Node.js ในเครื่องด้วย
ในหมวดเดียวกันมี Finance Toolkit, SolidInvoice, Korea Tax Calculator
server หมวดเดียวกันจากผู้ทำคนอื่น เรียงตามดาว
อ่านการ์ด:★ ดาว GitHubiสามเสา: รีวิว · ผลตรวจ · การใช้งานiอัปเดต = วันที่ส่งรุ่นล่าสุดเข้า registryi
500+ transparent financial methods calculated from raw statements, not third-party endpoints.
Create and send invoices and quotes, manage clients, and track payments in SolidInvoice.
Korean tax calculation and tax-audit judgment MCP: 96 tools with statutory citations.
ส่วนนี้คัดจาก repo ของผู้ทำตามต้นฉบับ PopNx MCP ไม่ได้ตรวจหรือรับรองเนื้อหา ตัด HTML รูปภาพ และสคริปต์ออกแล้ว ลิงก์จะพาออกนอกเว็บ
Let an AI agent trade without giving it the power to lose everything.
npx @r2rlabs/reins init # adds a paper-trading Reins server to .mcp.json
See it at work: an AI agent trading Hyperliquid on paper, run 2.
The source is on GitHub: R2Rlabs/reins. Every limit in this README is a function you can read.
Several open-source Hyperliquid MCP servers already exist. They are thin API wrappers: you hand them a private key and hope the model behaves. The gap is everything around that — the limits, the sandbox, the audit trail. That is what this repo is.
Early, but real. 391 tests, no network calls in any of them.
| Module | What it does |
|---|---|
src/risk.ts | The risk engine — position cap, risk per trade, leverage cap, daily loss halt, allowlist, rate limit |
src/client.ts | Hyperliquid REST client — orders, cancels, book, candles, fills, account state, builder code |
src/mcp-server.ts | The agent-facing tools, each risk-checked and logged before anything is sent |
src/paper.ts | Paper trading — live prices, simulated fills. See below |
src/paper-store.ts | Persists a paper run across restarts |
src/trading-client.ts | The interface live and paper both satisfy |
src/decision-log.ts | Append-only record of every attempt and its stated reason |
src/decision-log-file.ts | JSON Lines log on disk |
src/bin/cli.ts | The reins command: serve (default), init, approve-builder, live-check, http and stats |
src/bin/serve.ts | stdio entry point |
src/bin/http.ts | reins http — the HTTP server: token, binding, JSON |
src/http-api.ts | The same nine tools as HTTP routes, for bots that do not speak MCP |
src/runtime.ts | The limits, client, log and banner both front doors share |
src/init.ts | reins init — writes a paper-mode server entry into .mcp.json |
src/builder-fee.ts | Reins' builder fee, and the approval live trading needs before it starts |
src/approve-builder.ts | reins approve-builder — the user approves the builder fee in their own wallet |
src/live-check.ts | reins live-check — proves the live exchange accepts what Reins sends |
src/platform-stats.ts | reins stats — accounts, trades, volume and fees through Reins' builder code |
src/lz4.ts | Reads Hyperliquid's LZ4-compressed data files, without a dependency |
src/builder-approval.ts | The ApproveBuilderFee action: EIP-712 typed data, signature checks |
src/format.ts | Price and size formatting to Hyperliquid's tick and lot rules |
src/signing.ts | L1 action signing, verified against the Python SDK's vectors |
src/private-key-signer.ts | A Signer backed by a private key |
src/signer.ts | The Signer interface plus a stub. See "On signing" below |
src/mock-transport.ts | In-memory API stand-in, so agents can be tested without a network |
examples/demo-agent/ | Claude trading on paper through Reins, producing a publishable decision log |
All of it works end to end. Going live is now a matter of funding an account and setting REINS_MODE=live with a key.
REINS_MODE=live
REINS_NETWORK=testnet # mainnet spends real money REINS_ACCOUNT_ADDRESS=0x... # your Hyperliquid account REINS_PRIVATE_KEY=0x... # an API wallet's key, not your account's; omit to stay read-only
On mainnet, approve Reins' 2 bp builder fee once, from the account's own wallet, before the first live session: npx @r2rlabs/reins approve-builder. Until the account has, live mode refuses to start and says so.
Use an API wallet, not your account's own key. Hyperliquid lets an account approve API wallets that can trade for it but cannot withdraw from it — create one on Hyperliquid's API page, signing the approval with your main wallet. Put its key in REINS_PRIVATE_KEY and your account's address in REINS_ACCOUNT_ADDRESS: orders are signed by the API wallet, while positions, fills and stops are read from the account, because under the API wallet's own address the account looks empty. The startup banner names both. Hyperliquid prunes API wallets that expire or are replaced; make a fresh one rather than reusing an old address.
Every account mode works. Hyperliquid starts new accounts in Unified, where the USDC sits in the spot balance and the perps account reads $0; Reins asks the account which mode it is in and, for Unified and Portfolio margin, takes equity from the USDC balance plus the positions' unrealized PnL. Manual accounts are read from perps as before. (A *builder* address is different: it must be in Manual — standard — to earn fees.)
Defaults are deliberately safe: REINS_MODE is paper and REINS_NETWORK is testnet, so trading real funds takes two explicit changes rather than one forgotten variable. Live mode without a key stays read-only instead of failing at the first order, and mainnet prints a loud banner on startup.
The private key is only read in live mode — paper never signs anything, so it is never handed the means to.
npm run build
npm run demo -- --scripted # free: no API key, live prices, paper fills
With an Anthropic API key, npm run demo runs Claude as the agent under a hard spending cap. See examples/demo-agent for cost, limits and how to publish the result honestly.
Every attempted action is appended to a log with the reason the agent gave for it — including the ones the risk limits refused. That is the point. "The agent tried to open six times its position cap at 3am, and here is what it said it was doing" is the most useful thing this system can tell you, and it only exists if refusals are written down.
place_order, close_position and set_stop_loss take a required reason. An optional field gets omitted; a required one gets answered.
Records are JSON Lines — one self-contained object per line, appended, never rewritten. Appends stay cheap as the file grows, a truncated write damages one line instead of the file, and you can query it with ordinary tools:
jq -r 'select(.risk.allowed == false) | [.time, .risk.code, .reason] | @tsv' decisions.jsonl
Each record holds the stated reason, the request, the account context at the time, the risk verdict, and the outcome. Set REINS_LOG_FILE to persist it; without it the log lives in memory and dies with the process.
The exchange also acts on its own: a stop-loss fires, a resting order fills hours after it was placed. Before every tool call Reins compares the account's fills with the log and appends each one it has not seen as an exchange_fill record, whose reason starts "Not an agent decision:" and says whether it was a stop, a resting order, or a fill Reins did not place. Without them the trade that mattered most, the stop that closed it, would be missing from the record. The agent reads them back through get_recent_decisions like anything else.
`reason` is testimony, not ground truth. It is the model's own account of why it acted, captured because reasoning that is not asked for cannot be recovered later. A model can rationalise after the fact, and a confident explanation is not evidence that the explanation is what actually drove the decision. It is extremely useful for debugging and audit. It is not proof.
A failed log write never fails a filled order. If the log cannot be written, the tool still reports success and attaches a warning. An agent told its order failed will place it again — so a lost log line would become a doubled position, which is far worse than the missing line. The risk engine is the safety mechanism; the log is observability.
REINS_MODE=paper (the default) runs the same tools, the same risk engine and the same agent against real prices with simulated fills. Nothing is signed and nothing reaches the exchange.
Paper and live are swapped behind one interface, so an agent cannot tell which one it is talking to — which is the point. A strategy that works on paper runs unchanged on live.
The first five flatter the result; the last two can miss a fill either way. All of them are listed rather than buried:
ตัดมาแค่ช่วงต้น อ่านต่อใน repo