A Model Context Protocol server that exposes TimeTrader's race data and betting as tools any AI agent — Claude Desktop, Claude Code, and other MCP clients — can call.
What it is
MCP (the Model Context Protocol)
is an open standard that lets AI agents call external tools through a uniform interface. This server —
timetrader-mcp (Node, built on @modelcontextprotocol/sdk) —
wraps the TimeTrader External REST API (/api/v1/,
base http://localhost:7990) and presents its endpoints as MCP tools.
Important: it is a stdio server, not a web service or a port you browse to. An MCP client
launches the server process on demand and talks to it over standard input/output. This page is just the docs —
the server itself is the index.js a client runs.
Tools
All seven tools the server advertises. Each returns the API's JSON response as pretty-printed text; HTTP and network errors come back as MCP error content — the server never crashes on a bad request.
| Tool | What it does | Parameters | REST endpoint |
|---|---|---|---|
get_races |
List races from the card index (defaults to today). | date? (YYYY-MM-DD)track? |
GET /api/v1/races |
get_entries |
Entries (post position → horse) for one race, ordered by post. | urid * |
GET /api/v1/races/{urid}/entries |
get_predictions |
Agent predictions (Claude/Codex/OpenAI/etc.) for one race. | urid * |
GET /api/v1/races/{urid}/predictions |
get_odds |
Latest live odds (post, price) for a track and race number. | track *race * |
GET /api/v1/odds |
get_account |
The authenticated account: ticks, dream minutes, name/email/status. | none | GET /api/v1/account |
list_bets |
List the authenticated user's bets. | none | GET /api/v1/account/bets |
place_bet read_write |
Place a bet; debits ticks by the stake. Requires a read_write key. |
race *bet_type *selections * (array|string)stake * (number) |
POST /api/v1/bets |
* required parameter.
Get an API key
Every tool authenticates with a bearer key (ttk_…). Request one on the
API Keys console.
Keys require Captain (VGhost) approval before they authenticate — a freshly requested key
will not work until it is approved. The place_bet tool additionally needs a
read_write-scoped key; read tools work with a default read key.
Connect it
Add this to your MCP config (Claude Desktop: claude_desktop_config.json;
Claude Code: .mcp.json or the mcpServers block in settings).
Server file: C:/timetrader/starexternalapi/mcp/index.js.
{ "mcpServers": { "timetrader": { "command": "node", "args": ["C:/timetrader/starexternalapi/mcp/index.js"], "env": { "TIMETRADER_API": "http://localhost:7990", "TIMETRADER_API_KEY": "ttk_your_key_here" } } } }
TIMETRADER_API defaults to
http://localhost:7990 if omitted; TIMETRADER_API_KEY is your
ttk_… bearer key (a read_write key for betting).
Endpoints — raw HTTP
For callers who'd rather hit the REST surface directly. Base http://localhost:7990;
every route below /api/v1/ (except /health) needs
Authorization: Bearer ttk_….
- GET
/api/v1/health— service status (no auth) - GET
/api/v1/races?date=&track=— race card index - GET
/api/v1/races/{urid}/entries— race entries - GET
/api/v1/races/{urid}/predictions— agent predictions - GET
/api/v1/odds?track=&race=— latest live odds - GET
/api/v1/account— account (ticks / dream minutes) - GET
/api/v1/account/bets— your bets - POST
/api/v1/bets— place a bet (read_write) - GET
/api/v1/keys, POST/api/v1/keys, POST/api/v1/keys/revoke— manage your keys (session)
curl -s http://localhost:7990/api/v1/races \
-H "Authorization: Bearer ttk_your_key_here"