pegcheck
Enables AI agents to verify Robinhood Stock Token prices against real market prices before trading, providing a fair-price verdict based on onchain and reference data.
README
pegcheck-mcp
A read-only MCP server that checks whether a Robinhood Chain Stock Token is currently trading at a fair price relative to the real-world stock it represents — designed to be called by an AI agent, right before it trades, not read off a dashboard by a human.
✅ Verdict: FAIR (deviation: 0.11%)
The problem
Robinhood Chain's Stock Tokens are self-custodiable ERC-20s that track real stocks and trade 24/7 on onchain DEXs. Real stock markets are only open ~6.5 hours a day, 5 days a week. Outside those hours there's no active market to arbitrage the token price back to fair value, so it can drift.
An AI agent trading these tokens directly onchain — holding a wallet key and swapping against a DEX pool — has no built-in way to know if the price it's about to pay is trustworthy. Every existing tool that surfaces this gap (dashboards, Telegram alert bots, trading terminals) is built for a human to look at. None of them are built to be called by an agent mid-decision.
The solution
One focused MCP tool: check_stock_token_price.
Give it a ticker. It returns a structured, session-aware verdict an agent can act on — before it signs a trade, whether that trade goes through Robinhood's own Trading MCP or directly against an onchain DEX.
{
"symbol": "AAPL",
"onchain": { "priceUsd": 310.32, "method": "liquidity-weighted-average", "poolsUsed": 10 },
"reference": { "tokenEquivalentPriceUsd": 309.99, "isTradingHalt": false },
"deviation": { "pct": 0.11, "direction": "premium" },
"marketSession": { "state": "weekend" },
"verdict": "fair",
"warnings": []
}
This server is read-only. It never holds a private key, never signs a transaction, and never places a trade.
How it works
Two independent data sources, compared:
- Onchain price — every indexed Robinhood Chain pool for the token, from DexScreener's public API, filtered to pools quoted in a stable reference asset (USDG/USDC) with at least $500 of liquidity, combined into a liquidity-weighted average (so one deep pool dominates over several shallow, noisy ones). Falls back to the single deepest pool — flagged as low-confidence — if nothing passes the filter.
- Reference price — Robinhood's own public Stock Token API (
/rhj/prices/{symbol}), which reports the raw underlying-equity bid/ask. This is scaled by the token's current ERC-8056multiplier(from/rhj/assets) to get the token-equivalent fair price, since dividends are reinvested into the multiplier rather than paid out in cash.
The deviation between the two is compared against a threshold table that depends on the current US market session (regular, pre-market, after-hours, weekend, holiday, closed), computed locally with no external dependency — a 2% gap on a Saturday night is expected; the same gap at 11am on a Tuesday is not. Session detection includes a full NYSE holiday calendar, computed algorithmically (nth-weekday-of-month rules, an Easter calculation for Good Friday, and the standard weekend-observance shift) rather than fetched from any external API, so it works for any year with no network dependency, no API key, and no static file to go stale. Verified against NYSE's officially published 2026-2028 calendar in test/nyseHolidays.test.ts. See src/config.ts for the exact thresholds and src/nyseHolidays.ts for the holiday rules.
Install & run
git clone https://github.com/kushal613/pegcheck-mcp.git
cd pegcheck-mcp
npm install
npm run build
No API keys, no .env file, no wallet — every data source used is a free, public, keyless API.
Try it from the terminal
npm run check -- AAPL
npm run check -- TSLA
Connect it to an MCP client
Claude Desktop / Claude Code (claude_desktop_config.json or .mcp.json):
{
"mcpServers": {
"pegcheck": {
"command": "node",
"args": ["/absolute/path/to/pegcheck-mcp/dist/index.js"]
}
}
}
Cursor (.cursor/mcp.json): same shape as above.
Once connected, ask your agent: "Before you buy any TSLA stock token, check pegcheck to see if the price is fair right now."
Tool reference
check_stock_token_price
| Field | Type | Description |
|---|---|---|
symbol (input) |
string |
Ticker, e.g. "AAPL". |
onchain.priceUsd |
number | null |
Liquidity-weighted onchain price. |
onchain.method |
string |
liquidity-weighted-average, deepest-pool (low confidence), or none. |
reference.tokenEquivalentPriceUsd |
number | null |
Real stock mid-price, scaled by the corporate-action multiplier. |
deviation.pct |
number | null |
Signed % deviation, onchain vs. reference. |
marketSession.state |
string |
regular | pre-market | after-hours | weekend | holiday | closed. |
marketSession.holidayName |
string | null |
e.g. "Thanksgiving Day", when state is "holiday". |
verdict |
string |
fair | caution | unreliable | no_liquidity | unknown_symbol. |
warnings |
string[] |
Human-readable caveats (stale quote, trading halt, low-confidence pool, etc.). |
Architecture
src/
config.ts Every tunable threshold, in one place
types.ts Shared types for the whole pipeline
http.ts Fetch wrapper with timeout + consistent errors
robinhoodApi.ts Reference leg: /rhj/assets + /rhj/prices (Robinhood's own APIs)
dexscreener.ts Onchain leg: liquidity-weighted price across Robinhood Chain pools
marketSession.ts Local US-market-session calculation (no external dependency)
nyseHolidays.ts Algorithmic NYSE holiday calendar (no external dependency)
pegCheck.ts Combines both legs into one PegCheckResult
server.ts MCP tool registration
index.ts stdio entrypoint
cli.ts Standalone terminal usage (no MCP client needed)
scripts/
smoke-test.mjs End-to-end MCP protocol handshake test (initialize -> tools/list -> tools/call)
Known limitations (v0.1)
- No early-close handling. NYSE's 1:00 PM closes (day after Thanksgiving, a weekday Christmas Eve) are not modeled as a distinct session — those afternoons will still report
after-hours/closeda few hours later than the real early close. Full-day holiday closures are fully covered. - No venue-specific slippage estimate. This reports the aggregate liquidity-weighted price, not "what would my $500 trade cost against this specific pool." That's a deliberate v0.1 scope boundary (a natural v0.2: an
advancedmode that takes a trade size and a specific pool/venue and estimates price impact). - DexScreener coverage dependency. If DexScreener hasn't indexed a very new pool yet,
onchain.methodwill be"none"and the verdict will beno_liquidity. This is a "fail loud," not a silent wrong answer. - Not a substitute for due diligence. See the disclaimer below.
Disclaimer
This project is not affiliated with or endorsed by Robinhood. It is an independent, informational tool. Data is sourced from Robinhood's public APIs and DexScreener's public API and may be delayed, incomplete, or inaccurate. Nothing here is financial advice. This server cannot place trades and holds no funds or keys.
License
MIT — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。