Skip to content

Spanish Lottery MCP Server for Claude, ChatGPT & Codex

Loteria API runs a free MCP server at https://api.loteriasapi.com/mcp that connects Claude, ChatGPT, Codex or any AI agent to the official results of the Spanish lotteries: EuroMillions, La Primitiva, Bonoloto, El Gordo, Loteria Nacional and more. Without an API key it returns the last 3 draws and checks numbers; with a key, the history and statistics of your plan.

Connect your agent to the Loteria API MCP server and ask it about EuroMillions, La Primitiva, Bonoloto, El Gordo, Loteria Nacional, EuroDreams, La Quiniela, Quinigol, Lototurf or Quintuple Plus. The agent looks up the official data and answers: "what were last night's EuroMillions numbers?", "did my ticket win?", "which numbers came up most this year?".

Server URLhttps://api.loteriasapi.com/mcp

Two modes: free or with your API key

Without an API key (free)

  • The last 3 draws of each game.
  • The next draw and its jackpot.
  • Check numbers against the last 3 draws.
  • Aggregated statistics.
  • 60 calls per minute per IP.

With an API key (your plan)

  • History based on your plan: search by date range, year or minimum jackpot.
  • The draw of a given day with its full prize breakdown.
  • Check numbers in any draw, by date or draw ID.
  • Statistics, number frequencies, jackpot history and patterns.
  • Each call uses 1 request from your plan; 300 per minute per key.

How to connect

Claude Code

Without a key:

claude mcp add --transport http loterias https://api.loteriasapi.com/mcp

With your API key (create it in your dashboard, under API keys):

claude mcp add --transport http loterias https://api.loteriasapi.com/mcp \
  --header "X-API-Key: $LOTERIAS_API_KEY"

Claude API (MCP connector)

Pass the server in mcp_servers with your key in authorization_token (sent as Authorization: Bearer) and the anthropic-beta: mcp-client-2025-11-20 header:

{
  "model": "claude-opus-5-5",
  "max_tokens": 1024,
  "messages": [
    { "role": "user", "content": "What were the last EuroMillions numbers?" }
  ],
  "mcp_servers": [
    {
      "type": "url",
      "url": "https://api.loteriasapi.com/mcp",
      "name": "loterias",
      "authorization_token": "lat_..."
    }
  ],
  "tools": [{ "type": "mcp_toolset", "mcp_server_name": "loterias" }]
}

claude.ai

Add a custom connector with the URL https://api.loteriasapi.com/mcp. It works in free mode: claude.ai connectors cannot send an API key yet.

Codex

Without a key:

codex mcp add loterias --url https://api.loteriasapi.com/mcp

With your API key, which Codex sends as Authorization: Bearer:

export LOTERIAS_API_KEY=lat_...
codex mcp add loterias --url https://api.loteriasapi.com/mcp --bearer-token-env-var LOTERIAS_API_KEY

Or in ~/.codex/config.toml:

[mcp_servers.loterias]
url = "https://api.loteriasapi.com/mcp"
bearer_token_env_var = "LOTERIAS_API_KEY"

ChatGPT

Add a custom connector (remote MCP server) with the URL https://api.loteriasapi.com/mcp and no authentication. It works in free mode; depending on your plan, you may need to turn on developer mode in the connector settings first.

Any other MCP client

The server uses the stateless Streamable HTTP transport. Send your key in the X-API-Key: lat_... or Authorization: Bearer lat_... header. Without a header the client uses the free mode. Cursor and VS Code configuration and the details of each tool are in the MCP server reference (in Spanish).

Tools

ToolWhat it doesNo key
list_gamesLists the games and their identifiers.Yes
get_latest_resultsLatest results of a game.Yes
get_next_drawNext draw, date and jackpot.Yes
check_numbersChecks your numbers or your Loteria Nacional ticket and tells you the prize.Yes
get_public_statisticsAggregated statistics of a game.Yes
search_resultsSearches draws by date range, year or minimum jackpot, with pagination.No
get_result_by_dateThe draw of a given day, with its full prize breakdown.No
get_statisticsFull statistics of a game, by year.No
get_number_frequenciesHow many times each number has come up.No
get_jackpot_historyJackpot history.No
get_patternsPatterns: odd/even, high/low, sums, consecutive numbers.No

Without a key, get_latest_results returns up to 3 draws and check_numbers only looks at the last 3; statistics are aggregated through get_public_statistics. Tool summaries are written in Spanish; the agent translates them for you.

Questions you can ask your agent

  • What were the winning numbers of the last EuroMillions draw?
  • I played 4, 12, 23, 31, 40 and 45 in Saturday's La Primitiva. Did I win anything?
  • When is the next El Gordo draw and how big is the jackpot?
  • List this year's EuroMillions jackpots over 100 million euros.
  • Which Bonoloto numbers came up most often in 2025?
  • Did my Loteria Nacional ticket 01755 win anything on Thursday?

Frequently asked questions

Do I need an API key to use the MCP server?

Not to try it: without a key the MCP server gives you the last 3 draws of each game, the next draw and aggregated statistics for free. With an API key your agent can query the history, search by date or jackpot and use every statistic, depending on your plan.

How many requests does each question to the agent use?

Each tool call uses 1 request from your plan, just like the REST API. list_games and get_next_draw are free, failed calls are not counted and check_numbers with a date uses 2. A typical question needs 1 or 2 calls.

Does it work with claude.ai?

Yes, in free mode: add a custom connector with the MCP server URL. claude.ai connectors cannot send an API key in a header yet, so the keyed mode is used from Claude Code, the Claude API or any MCP client that supports custom headers.

Does it work with ChatGPT?

Yes, in free mode: add the MCP server as a custom connector with the URL https://api.loteriasapi.com/mcp and no authentication. ChatGPT cannot send an API key in a header, so the history and full statistics are used from Codex, Claude Code or the API.

How do I use it with Codex?

Run codex mcp add loterias --url https://api.loteriasapi.com/mcp. For the keyed mode, store your key in the LOTERIAS_API_KEY environment variable and add --bearer-token-env-var LOTERIAS_API_KEY, or set bearer_token_env_var in config.toml.

Can an AI predict the winning numbers?

No. No AI can predict a lottery draw: every combination has the same probability. The MCP server is for looking up real results, checking your numbers and reading statistics about past draws.

What are the limits?

Without a key, 60 calls per minute per IP. With a key, 300 per minute per key, plus the maximum draws per request and the days of history of your plan. Every response includes a plan object with your plan and the requests you have left.

Can the MCP server change anything in my account?

No. Every tool is read-only: it looks up results, draws and statistics. Nothing is created, changed or deleted.

Give your agent Spanish lottery data

Create your account, generate an API key and connect it to the MCP server. The Free plan includes 50 requests to try it out.

Create a free account

Prefer the REST API? Getting started