AI CLIENTS
Use the DraftKings API with Lovable
Build a Lovable app on observed DraftKings data: the chat connector for build context, a server function with a project secret for runtime, and no key in the browser.
Editorial review: · Not a live coverage report
Build time and run time are separate
Lovable's custom MCP connector gives Lovable context while you chat with it. Lovable's documentation says a published app cannot use it. Your running app needs its own server-side REST call with a project secret.
| Stage | Mechanism | Credential |
|---|---|---|
| Building in chat | Custom MCP connector to https://draftkingsapi.com/api/mcp | Optional bearer token, or none for search and fetch |
| Published app | Server function, or Edge Function on older React and Vite apps, calling /api/v1/* | Project secret named DRAFTKINGS_API_KEY |
Store the key as a project secret
Add a project secret named DRAFTKINGS_API_KEY with a dedicated named key. Lovable describes secrets as encrypted, write-only and injected into server-side code at runtime, so they never reach the browser. Never add it to client code or to a variable prefixed with VITE_, because that ships it in the bundle.
Connect the chat connector
Add a custom MCP connector with the URL below. Lovable's documentation offers OAuth by default, or a bearer token or API key, and lists the connector on all plans. Choose a bearer token and paste a dedicated key to let the chat read live rows while it builds, or leave authentication off for documentation only. Lovable says chat connections are per user.
https://draftkingsapi.com/api/mcpUse the draftkings MCP tools. Call get_coverage, then get_pick6_projections with sport NHL, stat Shots on Goal and limit 5. Report the rows you actually got, with observed_at and stale for each. If rows are stale or absent, say so. Never invent rows. Standings multipliers are not odds. Do not recommend entries or bets.Ask for a server-side call
Tell Lovable the boundaries up front. The prompt below asks for a server-side route, a five-minute cache and honest stale handling.
Add a server function named getPick6Board that calls https://draftkingsapi.com/api/v1/pick6/projections with query parameters sport, stat, limit=25 and offset. Send the header Authorization: Bearer <key>, reading the key from the DRAFTKINGS_API_KEY secret. Never send the key to the browser. Cache responses for five minutes per query. Show observed_at and age_seconds on every row, and a visible note when stale is true. Hide is_paused rows from the selectable list. Show API errors as an error state, and never fill the UI with sample data. Label multipliers "standings multiplier" and never call them odds. Add this footer: Independent service, not affiliated with or endorsed by DraftKings. No wagering.// Edge Function shape for older React and Vite Lovable apps. Newer apps use a server function.
Deno.serve(async (request) => {
const incoming = new URL(request.url);
const url = new URL("https://draftkingsapi.com/api/v1/pick6/projections");
url.searchParams.set("sport", incoming.searchParams.get("sport") ?? "NHL");
url.searchParams.set("limit", "25");
const response = await fetch(url, {
headers: { Authorization: `Bearer ${Deno.env.get("DRAFTKINGS_API_KEY")}` },
signal: AbortSignal.timeout(20_000),
});
return new Response(await response.text(), {
status: response.status,
headers: { "Content-Type": "application/json", "Cache-Control": "public, max-age=300" },
});
});Check rights before you publish
A public Lovable app that displays these rows is redistribution. Technical access is not a redistribution license, so establish your own rights before you publish rows. A private internal tool has a different risk profile from a public one, and neither is legal advice. Do not build wagering flows on this data: this service does not place, recommend or settle entries or bets.
Tools the server exposes
The endpoint is Streamable HTTP in its stateless JSON form, over POST. search and fetch read public documentation and need no key. Every other tool calls the same handler as its REST endpoint, so a Bearer key is required and each call counts against your plan.
| Tool | Key needed | Use it for |
|---|---|---|
search, fetch | No | Guides, questions, data reports and integration pages |
get_coverage | Yes | Call this first: measured stored coverage and collector context |
get_pick6_projections, get_pick6_history | Yes | Pick6 rows and recorded changes |
get_sportsbook_events, get_sportsbook_odds, get_sportsbook_history | Yes | Mainline observations and retained history |
get_dfs_sports, get_dfs_contests, get_dfs_slates, get_dfs_players | Yes | DFS catalog, contests, slates and salaries |
get_context_games, get_context_player_stats, get_context_team_stats | Yes | Scores and box scores for observed events |
get_stats_games, get_stats_player_games, get_stats_team_games | Yes | Independent statistics. sport and season are required |
As of 2026-11-03, native sportsbook scopes cover New York NFL, NHL, college basketball and college football game lines and New York NHL Shots on Goal, points, assists, saves, goalscorers, power-play points and first-period shots. Read snapshots and streamed changes through the sportsbook endpoints. ESPN-attributed DraftKings moneyline, spread and total observations are also available across eight leagues. Current scope inventory is listed at /api/v1/sportsbook/scopes. Pick6 rows carry standings multipliers such as 1.5x. A standings multiplier is not decimal odds, a probability or an established entry payout.
Troubleshoot Lovable
Check these first when the generated app misbehaves.
- The generated code calls the API from the browser: data endpoints send no cross-origin headers, so the browser blocks the response, and the key is exposed anyway. Ask Lovable to move the call into a server function.
- HTTP 401 at run time: the secret name differs from the code, or the key was revoked.
- The chat can read rows but the published app cannot: expected. The connector is build-time context only.
- HTTP 429 in production: every page view is calling the API. Add the five-minute cache, then check your plan on pricing.
- The UI shows rows with an old
observed_at: retained rows can be stale. Surfacestale, and see freshness.
REST alternative
Everything the data tools do is a plain HTTP call, and MCP is optional. Use REST when a client cannot send a header, or when a scheduled job needs no assistant in the loop.
curl --fail-with-body "https://draftkingsapi.com/api/v1/pick6/projections?sport=NHL&stat=Shots%20on%20Goal&limit=5" \
-H "Authorization: Bearer $DRAFTKINGS_API_KEY"The public contract is at /api/openapi. See the Python guide and the JavaScript guide for retries and pagination.
Evaluate before you build on Lovable
Check the data before you promise a feature. A connected client shows that the transport works, not that the coverage fits your project.
- Read the measured coverage report and status for the sports and stats you need.
- Read league coverage, because filter labels differ by dataset.
- Read odds vs Pick6 multipliers vs DFS salaries so the assistant does not mix up what the numbers mean.
- Read freshness, then ask the assistant to report
observed_atandstalefor each row it uses. - Compare other providers on the comparison hub if you need full-book sportsbook props or multi-book feeds.
Free includes 500 requests/month at 20/minute; Developer is $49/month with 10,000 requests/month at 60/minute; Production is $149/month with 50,000 requests/month at 120/minute. Limits are shared across keys.
Try it
Check your key over REST before you hand it to a project secret.
curl --fail-with-body "https://draftkingsapi.com/api/v1/pick6/projections?sport=NHL&stat=Shots%20on%20Goal&limit=5" \
-H "Authorization: Bearer $DRAFTKINGS_API_KEY"Check the recorded data
Questions
Can a published Lovable app use the MCP connector?
No. Lovable's documentation says the custom MCP connector only gives Lovable context in project chat. A published app needs a server-side REST call with a project secret.
Where does the API key go?
In a Lovable project secret named DRAFTKINGS_API_KEY, read only by server-side code. Never put it in client code or in a VITE_ variable.
Can I publish a public app with this data?
Technical access is not a redistribution license. Establish your own rights before showing rows publicly. This service provides observed data for analysis and has no wagering features.
Which Lovable plan do I need?
Lovable's documentation lists the custom MCP connector on all plans. Check Lovable's pricing for limits on functions and secrets.
Sources
- Lovable: custom MCP connectors checked 2026-11-03
- Lovable: connect to any API checked 2026-11-03
- Lovable: secrets checked 2026-11-03
- Lovable: Edge Functions checked 2026-11-03
Related resources
Connect ChatGPT to DraftKings API documentation over MCP, understand why connectors cannot send an API key, and bring live observations in with REST or an Action.
DraftKings API in JavaScript and Node.jsCall the API from Node.js with built-in fetch: timeouts, retries, async pagination and a server route that keeps your key private.
Can I call the API from browser JavaScript?Keep the key on a server. A browser bundle would expose it, and data endpoints do not send cross-origin headers. Use a server route.
DraftKings API developer starter kitDownload Python and Node examples, a notebook, Postman templates, a daily archive workflow and a comparison feed. Bounded requests and no embedded credentials.
DraftKings API quickstart: your first call in one minuteFor developers who want a response now: a keyless sample, then a free key, then an authenticated call. Not for production hardening or sportsbook player props.
Is there an MCP server for AI agents?Yes. The hosted MCP endpoint offers keyless search and fetch tools plus data tools that need a Bearer key in the client configuration.
Compare DraftKings data providersSourced, dated comparisons of OpticOdds, ParlayAPI and DFS pick'em providers, plus a scraper migration path.
Independent service operated by DD Inc., not affiliated with or endorsed by DraftKings. Technical access is not a redistribution license. No wagering: this service does not place, recommend or settle entries or bets. Check sources and status for actual capture context.