After-Hours Dip Agent MCP Server

After-Hours Dip Agent MCP Server

Enables scanning live after-hours stock prices on Robinhood Chain, paying for quotes via x402, and buying dips below the NYSE close.

Category
访问服务器

README

After-Hours Dip Agent

An AI agent that pays another machine for a signal that exists nowhere else, then acts on it. All on Robinhood Chain, Robinhood's own Ethereum L2.

When the NYSE closes, price discovery for a stock does not stop. Robinhood's tokenized stocks keep trading on-chain against USDG, after hours and all weekend. This agent watches a watchlist of them, pays for each price over x402, and buys the ones trading below their last NYSE close. No brokerage, no API keys, no human in the loop.

Live instance: afterhoursoracle.xyz — the oracle running as a public paid API. Any agent with USDG on Robinhood Chain can buy a quote right now.

Default watchlist: NVDA (NVIDIA), AAPL (Apple), AMD, SNDK (SanDisk), plus MU (Micron) and QQQ (Nasdaq-100 ETF) as signal-only tickers (quotable, not buyable — see below).

The loop

  1. After-Hours Oracle (oracle/): a paid API with one route per stock. Each query reads the live on-chain price from a Uniswap v4 pool, compares it to the last official NYSE close, and returns the discount. Each call costs $0.05, paid over x402 (the HTTP "402 Payment Required" protocol) in USDC on Base or USDG on Robinhood Chain — the 402 challenge offers both and the buyer picks. The same self-hosted facilitator settles both chains (fund its wallet with a little ETH on each).
  2. Facilitator (facilitator/): a self-hosted x402 facilitator for eip155:4663. No hosted facilitator supports Robinhood Chain, so you run your own. It verifies the agent's signed EIP-3009 USDG authorization and settles it on-chain.
  3. Agent (agent/): scans the watchlist (paying for each quote), holds the stocks tracking their close, and buys the ones trading at least THRESHOLD_DISCOUNT_PCT below it, biggest dip first. Buys route USDG → ETH → stock on Uniswap v4.

Three ways to run it

  • CLI (npm run agent): the autonomous, headless version. Scan, decide, buy.
  • MCP tools (mcp/): the same engine exposed as tools a model can call, so you can drive it from a chat window in Claude.
  • Dashboard (npm run dashboard): a live visual UI at localhost:4025. Watchlist cards with on-chain price vs close, a streaming x402 payment feed with tx links, and wallet balances that update as the agent pays and trades.

All three share one engine: same wallet, same x402 payment path, same Uniswap route (lib/).

Run it

npm install
npm run gen-wallets     # creates .env with fresh keys, prints the three addresses

# fund the agent on Robinhood Chain (from the Robinhood app, network = Robinhood Chain):
#   agent:       USDG for buys + a little ETH for gas
#   facilitator: a little ETH for settlement gas

npm run status          # balances + live watchlist scan
npm run facilitator     # terminal 1 - the x402 settlement rail
npm run oracle          # terminal 2 - the paid price API
npm run dashboard       # terminal 3 - visual UI at http://localhost:4025
# ...or drive it headless:
npm run agent           # scan the watchlist, buy the dips

Tune THRESHOLD_DISCOUNT_PCT, BUY_USDG, SLIPPAGE_PCT in .env. WATCH_MINUTES=30 npm run agent runs it as a standing after-hours watcher.

Hosting the oracle as a public product

server/ is a single deployable service: a public landing page with the live board, the x402-gated /price/<TICKER> API, a free cached /api/board, and the facilitator running in-process on a loopback port (never exposed). Any agent with USDG on Robinhood Chain can pay it, no account needed.

npm run gen-prod-facilitator   # prints a FRESH key + address; nothing written to disk

Deploy anywhere that runs Node or Docker (Railway, Render, Fly). Entry point is npm start (or the included Dockerfile), listening on $PORT. Set three environment variables on the platform:

Var What
FACILITATOR_PRIVATE_KEY The fresh prod key from the script. Fund its address with ~0.002 ETH on Robinhood Chain (settlement gas).
TREASURY_ADDRESS Where the USDG lands. Its private key never goes on the server.
RPC_URL An Alchemy endpoint for chain 4663 (the public RPC is rate-limited).

Operational notes: the facilitator wallet is a hot wallet, so keep only gas-money in it. The buyer needs no ETH; your facilitator sponsors settlement gas (fractions of a cent per quote on this chain).

MCP tools

Copy claude_desktop_config.example.json into your Claude Desktop config (fix the absolute path), restart Claude, and keep the facilitator + oracle running (the tools pay them).

Tool What it does
get_wallet_status Read-only balances of the agent + treasury. No spend.
scan_watchlist Pays the oracle ~$0.05 USDG over x402 for each stock, returns the board ranked by discount. Real settlement.
buy_the_dips Buys every stock trading below threshold, biggest dip first. Real trades.
buy_stock Buys one named stock. Manual, no threshold check.

Then ask Claude: "scan my watchlist" and "buy anything more than 1% below its close."

On "paid MCP": the purest form is the MCP client paying the server with a payment signature, replacing API keys. No shipping MCP client signs x402 yet. So today this server pays a downstream x402 API (the oracle); the payment is real, it just sits one hop past the tool call. When clients support x402 natively, this same server becomes the gated resource directly.

The one non-obvious thing I learned

Robinhood's tokenized stock pools are paired token-to-token against USDG, and those pools do not route through Uniswap's Universal Router on this chain. The Quoter happily simulates a USDG → stock swap, but execute() reverts with empty data. Every pool with native ETH on one side works fine, both directions, every fee tier. So buys route USDG → ETH → stock as two chained hops. Worth knowing if you build agentic trading of real-world assets here.

Adding a stock

The watchlist is one array in config.js. A stock needs a liquid USDG/<stock> pool for the price signal; add an ETH/<stock> pool too and it becomes tradable (the buy leg).

stock('TSLA', 'Tesla', '0x...', priceFee, priceTs, ethFee, ethTs)  // tradable
stock('MU',   'Micron', '0x...', priceFee, priceTs)                // signal-only

Signal-only entries are served by the oracle but refused by every buy path (agent, MCP tools, dashboard) with a clear message. On a young chain the usable list is short — NVDA, AAPL, AMD, SNDK tradable and MU, QQQ signal-only are verified — and it grows as liquidity arrives. A sanity bar worth keeping: only add a price pool that tracks the real market within a few percent, or you are selling noise.

Notes

  • Set RPC_URL in .env to an Alchemy endpoint for reliability; the default is Robinhood Chain's public RPC.
  • The x402 payment itself needs no ETH from the agent (the facilitator submits the transfer). The agent only needs ETH for its own Uniswap swaps.
  • This is a demo, not investment software. Mainnet, real money, tiny amounts. Your keys live in .env (gitignored) — fund only with small amounts.

Built on Robinhood Chain, x402, Uniswap v4, and USDG.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选