Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungPlanning a DEX Product Without Starting With Smart Contracts(21.09.2026 um 15:26 Uhr)
Malware / Trojaner / VirenInside BambooToken’s Linux implant: shell and file control over MQTT(21.09.2026 um 12:37 Uhr)
Linux Tipps & HardeningVoid Linux (base) as a server distro?(21.09.2026 um 14:13 Uhr)
IT Security VideoBlack Hat Stories | Ryan & Isabella Barnett(21.09.2026 um 15:30 Uhr)
IT Security NachrichtenSuccess of Trump-Xi summit lies in what happens afterwards(21.09.2026 um 14:30 Uhr)
Sichere ProgrammierungPlanning a DEX Product Without Starting With Smart Contracts(21.09.2026 um 15:26 Uhr)
Malware / Trojaner / VirenInside BambooToken’s Linux implant: shell and file control over MQTT(21.09.2026 um 12:37 Uhr)
Linux Tipps & HardeningVoid Linux (base) as a server distro?(21.09.2026 um 14:13 Uhr)
IT Security VideoBlack Hat Stories | Ryan & Isabella Barnett(21.09.2026 um 15:30 Uhr)
IT Security NachrichtenSuccess of Trump-Xi summit lies in what happens afterwards(21.09.2026 um 14:30 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Build a Pear Protocol DeFi trading agent with MCP

If you want an AI agent that can actually trade, not just chat about charts, the Model Context Protocol (MCP) is the cleanest way to wire a model to a real exchange. This post builds a Pear Protocol DeFi trading agent: one that can browse…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

If you want an AI agent that can actually trade, not just chat about charts, the Model Context Protocol (MCP) is the cleanest way to wire a model to a real exchange. This post builds a Pear Protocol DeFi trading agent: one that can browse pair markets, read your positions and portfolio, and (when you turn it on) open and close leveraged pair trades on Hyperliquid.



We'll use mcp-pear, an open-source MCP server that wraps Pear Protocol's API.






What is Pear Protocol?



Pear Protocol is a Hyperliquid-backed platform for pair trading. You go long one basket and short another in a single position, and profit from the ratio between them moving your way, regardless of overall market direction. Classic example: long ETH, short BTC if you think ETH outperforms, without betting on crypto as a whole.



Pear settles on Hyperliquid, so every pair position is really a pair of perp legs executed on-chain.






What is MCP, and why use it here?



The Model Context Protocol is an open standard that lets an LLM call external tools through one uniform interface. Instead of gluing Pear's REST API to your model by hand, you run an MCP server that describes its tools to the model, and any MCP client (Claude Desktop, Cursor, Cline, or your own agent) can use them.



mcp-pear exposes Pear as a set of MCP tools:





  • Public (no auth): list_markets, get_active_markets, get_pair_ratio, get_health


  • Authenticated read: get_open_positions, get_open_orders, get_portfolio, get_trade_history, get_account_summary


  • Write (opt-in): open_position, close_position, adjust_position, adjust_leverage, set_risk_parameters, cancel_order






Step 1: run the server



No install needed. npx fetches it:




npx -y @marvelcodes/mcp-pear@latest






The public tools work with zero config, so your agent can browse markets and pair ratios right away.






Step 2: wire it into Claude Desktop



Add this to your Claude Desktop MCP config:




{
"mcpServers": {
"pear": {
"command": "npx",
"args": ["-y", "@marvelcodes/mcp-pear@latest"]
}
}
}






Restart Claude and ask: "What are the top gaining pair markets on Pear right now?" It calls get_active_markets and answers from live data.






Step 3: add your account (read tools)



To read your positions and portfolio, mint a Pear API key:




npx -y @marvelcodes/mcp-pear@latest setup






This opens a browser, asks you to sign once with your wallet, and writes PEAR_API_KEY + PEAR_ADDRESS. Add them to the config:




{
"mcpServers": {
"pear": {
"command": "npx",
"args": ["-y", "@marvelcodes/mcp-pear@latest"],
"env": {
"PEAR_API_KEY": "your_key",
"PEAR_ADDRESS": "0xyour_address"
}
}
}
}






Now "How's my portfolio doing this week?" works. It calls get_portfolio with your real PnL.






Step 4: let the agent trade (carefully)



Trade execution is off by default. You opt in on purpose:




"env": {
"PEAR_API_KEY": "your_key",
"PEAR_ADDRESS": "0xyour_address",
"PEAR_TRADE_ENABLED": "true"
}






With that flag set, the agent can call open_position. A pair trade looks like this: long ETH, short BTC, 3x, $100 notional.




{
"executionType": "MARKET",
"leverage": 3,
"usdValue": 100,
"slippage": 0.01,
"longAssets": [{ "asset": "ETH", "weight": 1 }],
"shortAssets": [{ "asset": "BTC", "weight": 1 }]
}






open_position also takes TRIGGER, TWAP, and LADDER execution types, plus attached stopLoss / takeProfit. Pear signs the trade server-side, so the MCP server never holds your private keys.



Two Hyperliquid gotchas worth knowing:





  • ~$10 minimum notional per order. Smaller orders get rejected.


  • Spot vs Perps balance. USDC bridged onto Hyperliquid often lands in your Spot balance. Move it to Perps first or open_position fails with insufficient margin.






Putting it together



Here's the shape of an agent loop that uses it:





  1. get_active_markets to find pairs with strong momentum


  2. get_pair_ratio to check the current ratio and funding

  3. Model decides direction


  4. open_position with a stop-loss attached

  5. Poll get_open_positions, then close_position when the thesis plays out



Everything is a tool call, so the model reasons over live data and acts. No custom API glue.






Safety notes




  • Keep PEAR_TRADE_ENABLED off until you've tested read-only behaviour.

  • Start with tiny notionals.

  • The write tools execute real trades with real money. Constrain the agent, monitor it, and set risk parameters like you would any trading bot.






Links





mcp-pear is an independent, open-source community project, not affiliated with Pear Protocol. PRs and issues welcome.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Build a Pear Protocol DeFi trading agent with MCP

Thematisch verwandte Begriffe: Build, Pear, Protocol, DeFi · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-94142 | A security vulnerability has been detected in BioStar Temperature Monito…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick