Intelligence API and MCP server
Kokoah’s Hyperliquid market intelligence for your agents and scripts: the REST endpoints, the MCP server, and how to connect Claude, ChatGPT or your own code.
What it gives you
The same market intelligence the app shows, as JSON for your own agents and scripts: where large positions would be liquidated, how groups of traders lean, order flow, whale moves, TWAPs, a wallet’s record, Kokoah’s AI market read and its track record.
Use it two ways: the REST endpoints under /v1/agent/, or the MCP server, which AI assistants such as Claude and ChatGPT can call as tools. For live news, see the News API.
Keys and scopes
Use the same key as the News API: make one in Settings → News API and send it as Authorization: Bearer kk_…. Each key has scopes, the kinds of data it may read:
news:read- The news and order-flow cards.
intel:read- The market reads and the AI market read.
traders:read- A wallet’s record.
alerts:write- Market alerts and their webhooks.
New keys get all four. A key made before a scope came lacks it and answers 403 there: make a new key.
Three more scopes work with your own account. A key gets them only when you tick them as you make it, and you sign once more with your wallet. They act on the account that made the key and its sub-accounts, and none can move funds:
account:read- Your account’s risk: positions, liquidation distance, margin use and stop cover (
GET /v1/agent/account/risk, MCPaccount_risk). guardians:protect- Protection rules that can only reduce or close a position: breakeven, trailing stop, liquidation guard, bracket, a closing TWAP, daily loss lock (
/v1/agent/guardians, MCPadd_protection,list_protection,remove_protection). Their orders are signed reduce-only; revoking the key pauses them. orders:propose- Order drafts you confirm or dismiss in the app (
/v1/agent/orders/drafts, MCPpropose_order). Nothing is placed without you, and a draft expires after 10 minutes.
The REST endpoints
Every path starts at https://api.kokoah.com. Coins are written as Hyperliquid writes them (BTC, kPEPE, xyz:TSLA); times are in milliseconds since 1 January 1970 UTC.
GET /v1/agent/markets/scanner- Every market in one row: how groups lean, liquidations near the price, TWAPs and whale trades.
GET /v1/agent/markets/{coin}/positioning- The liquidation map, the entry profile, how groups lean and the largest positions.
/positioning/history?days=: how each group leaned over time. GET /v1/agent/markets/{coin}/flow- Order flow between
fromandto: taker buys and sells, positions opened and closed, liquidations./flow/seriesaddsintervalfor one row per candle. GET /v1/agent/whales- Position changes of $100,000 or more as they happened.
GET /v1/agent/twaps- The TWAP orders filling now.
GET /v1/agent/markets/positioning?coin=- How Hyperliquid’s most active traders lean, with open interest.
GET /v1/agent/traders/{address}- A wallet’s record: PnL, ROI and rank on the leaderboard, its largest 30-day drawdown, active days and recent fills.
GET /v1/agent/ai/markets/{coin}/read- Kokoah’s short AI read of a market: a bull case, a bear case, what to watch and which way the data leans.
GET /v1/agent/ai/markets/track-record- How the AI reads did over the last 30 days.
Every field is described in the API’s OpenAPI document, https://api.kokoah.com/docs/openapi.json, under the tag agent-intel.
The MCP server
Kokoah’s MCP server is at https://api.kokoah.com/mcp, over streamable HTTP, without sessions. Send your key in the Authorization header. It has nine read-only tools, each answering through the same code and limits as the endpoints:
scan_markets- Every market in one row.
liquidation_map- Where a market’s large positions would be liquidated and where they entered.
order_flow- A market’s order flow over the last minutes or hours.
whale_moves- Large position changes, newest first.
top_trader_lean- How the most active traders lean.
flow_events- Kokoah’s news and order-flow cards.
trader_record- A wallet’s record.
market_read- Kokoah’s AI read of a market.
read_track_record- How the AI reads did.
Connect Claude, ChatGPT or your code
- Claude Code
- Add the server once with the command below; its tools are then there in every session.
- Claude API
- Name the server in
mcp_serverswith your key asauthorization_token, as in the Python example below. - ChatGPT and the OpenAI API
- In the Responses API, add an
mcptool with the server’s address and your key inheaders. - Your own code
- Any MCP client that sends a header works, or call the REST endpoints directly.
Alerts and webhooks
With the alerts:write scope, your agent can make market alerts (a price, a percent move, funding, positioning, liquidation clusters, TWAPs) at /v1/agent/alerts, list them and delete them. Each key sees only its own, up to 20.
When a rule fires, Kokoah writes an event in its own words. Read events at /v1/agent/alerts/events?after=, follow them live on the stream /v1/agent/alerts/stream, or give the rule a webhookUrl: Kokoah then posts each event to it, signed.
Check every webhook: its Kokoah-Signature header is t=…,v1=…, an HMAC-SHA256 of t, a dot and the body, made with the webhookSecret shown once when the rule was made. A failed delivery is tried again five times over about 7 hours, so the same Kokoah-Event-Id can come twice.
A skill file for agents
The SKILL.md file tells an agent what each tool answers and how to read it. Add it to your agent’s skills or its instructions.
Limits and errors
- 120 requests a minute per key, counted across every endpoint, the news and the MCP server together. Each MCP request counts once.
- Answers Kokoah has just read are shared and free. New market reads have a share of their own each minute, so agents never slow the app down. Past it you get 503 for a minute.
- 20 alert rules per key, once the account holds funds (as for the app’s alerts); a rule fires at most once a minute, and a key’s rules 60 times an hour; 2 open alert streams per key.
- 30 new wallet lookups a minute per account; a wallet’s record is reused for 5 minutes.
- 20 new AI reads a day per account. A fresh read someone already asked for is free.
Errors are JSON with a code and a message: 401 no key or a wrong one, 403 a scope the key lacks, 429 a limit (wait as long as Retry-After says), 503 paused or busy. In MCP, a refused call comes back as a tool error with the same code.
Examples
Each example has your key in the KOKOAH_KEY environment variable. Keep it on your server or computer, never in a web page.
curl -H "Authorization: Bearer $KOKOAH_KEY" \
"https://api.kokoah.com/v1/agent/markets/BTC/positioning"
curl -H "Authorization: Bearer $KOKOAH_KEY" \
"https://api.kokoah.com/v1/agent/traders/0x0000000000000000000000000000000000000000"curl -X POST "https://api.kokoah.com/mcp" \
-H "Authorization: Bearer $KOKOAH_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "MCP-Protocol-Version: 2025-06-18" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"liquidation_map","arguments":{"coin":"BTC","top":5}}}'claude mcp add --transport http kokoah https://api.kokoah.com/mcp \
--header "Authorization: Bearer $KOKOAH_KEY"import os
import anthropic
client = anthropic.Anthropic()
response = client.beta.messages.create(
model="claude-opus-5-5",
max_tokens=16000,
betas=["mcp-client-2025-11-20"],
mcp_servers=[{
"type": "url",
"url": "https://api.kokoah.com/mcp",
"name": "kokoah",
"authorization_token": os.environ["KOKOAH_KEY"],
}],
tools=[{"type": "mcp_toolset", "mcp_server_name": "kokoah"}],
messages=[{"role": "user", "content": "Where are BTC's largest liquidation clusters?"}],
)
print(response.content[-1].text){
"type": "mcp",
"server_label": "kokoah",
"server_url": "https://api.kokoah.com/mcp",
"headers": { "Authorization": "Bearer <your kk_ key>" },
"require_approval": "never"
}curl -X POST "https://api.kokoah.com/v1/agent/alerts" \
-H "Authorization: Bearer $KOKOAH_KEY" -H "Content-Type: application/json" \
-d '{"rule":{"type":"liquidationCluster","coin":"BTC","pct":2,"minUsd":5000000},
"label":"BTC liquidation wall","webhookUrl":"https://example.com/kokoah-hook"}'import hashlib, hmac, time
def verify(secret: str, header: str, body: bytes, max_age: int = 300) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
t, sent = parts.get("t", ""), parts.get("v1", "")
if not t.isdigit() or abs(time.time() - int(t)) > max_age:
return False
want = hmac.new(secret.encode(), t.encode() + b"." + body, hashlib.sha256).hexdigest()
return hmac.compare_digest(want, sent)