ligamx-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ligamx-mcpHow have Tigres performed in their last 5 matches?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Liga MX API
Query Liga MX form, head-to-head history, and tournament standings from football-data.co.uk match data.
Data is rebuilt daily into a local SQLite database (data/ligamx.db). Form and H2H are answered from the matches table; standings are materialised at rebuild time.
Setup
Requires Python 3.12+ and uv.
uv sync
DATA_URL=https://www.football-data.co.uk/new/MEX.csv ./scripts/rebuild_db.shOr rebuild from an existing CSV without re-downloading:
uv run python -m ligamx.etlRelated MCP server: copamind-mcp
Run the server
One process serves both the REST API and MCP (streamable HTTP):
uv run ligamx-serve
# or
uv run uvicorn ligamx.api:app --reloadREST docs: http://127.0.0.1:8000/docs
MCP endpoint:
http://127.0.0.1:8000/mcp
Deploy on Fly.io
The image rebuilds data/ligamx.db from DATA_URL on every start (fits free machines that stop when idle).
Set the CSV URL as a Fly secret (required by scripts/rebuild_db.sh):
fly secrets set DATA_URL=https://www.football-data.co.uk/new/MEX.csv# once: install flyctl, log in, then from the repo root:
fly launch # accept the existing fly.toml; pick a unique app name if needed
fly deployUseful checks:
fly status
fly logs
fly open /docsApp URL will look like https://<app-name>.fly.dev — MCP at /mcp, REST docs at /docs.
After deploy, optional daily refresh without idle sleep:
fly machine run --schedule daily ... # or just rely on rebuild-on-boot when traffic wakes the machineOn the free allowance, auto_stop_machines means the first request after idle pays a cold start (download CSV + ETL + boot).
MCP (HTTP)
Point an MCP client at the streamable HTTP URL (no stdio):
{
"mcpServers": {
"ligamx": {
"url": "http://127.0.0.1:8000/mcp"
}
}
}Exact client config keys vary; the transport is streamable HTTP at /mcp.
MCP tools
Tool | Description |
| All known team slugs |
| Last |
| Historical H2H between two slugs |
| Full current tournament table |
| One team’s row in the current table |
REST and MCP share ligamx/service.py payloads.
Endpoints
Method | Path | Description |
|
| Liveness check |
|
| Last |
|
| Historical head-to-head + summary |
|
| Full table for the current tournament |
|
| One team’s row in the current table |
|
| MCP streamable HTTP endpoint |
Unknown team slugs return 404.
Examples
curl 'http://127.0.0.1:8000/teams/america/form?n=10'
curl 'http://127.0.0.1:8000/h2h/america/guadalajara'
curl 'http://127.0.0.1:8000/standings/current'
curl 'http://127.0.0.1:8000/teams/tigres/position'Pipeline
MEX.csv → ligamx.etl → ligamx.db → FastAPI (REST + MCP /mcp)
│
├─ matches (raw names + slugs)
└─ standings (per season + tournament)scripts/rebuild_db.shdownloadsDATA_URL(required env var) intodata/MEX.csvand runs the ETL.ETL loads matches via the CSV reader, normalises team names to slugs, writes a temp SQLite file, then atomically replaces
data/ligamx.db.Standings are aggregated with 3/1/0 points and ranked by points → goal difference → goals for.
Tournaments
The CSV only has a Season string (e.g. 2025/2026). Short tournaments are derived from the match date:
Apertura — July–December
Clausura — January–June
“Current” standings use the season and tournament of the latest match in the database.
Team slugs
Raw CSV labels are kept on each match; API paths use stable slugs from ligamx/teams.py:
Slug | CSV label |
| Club America |
| Atlante |
| Atlas |
| Atl. San Luis |
| Chiapas |
| Cruz Azul |
| Dorados de Sinaloa |
| Guadalajara Chivas |
| Juarez |
| Club Leon |
| Leones Negros |
| Lobos BUAP |
| Mazatlan FC |
| Monterrey |
| Monarcas |
| Necaxa |
| Pachuca |
| Puebla |
| UNAM Pumas |
| Queretaro |
| Santos Laguna |
| Tigres UANL |
| Club Tijuana |
| Toluca |
| Veracruz |
Package layout
Path | Role |
| Parse |
| Raw name → slug map |
| Schema + SQLite connection |
| Daily rebuild + standings |
| Form / H2H / standings helpers |
| Shared JSON payloads for API + MCP |
| FastAPI REST + MCP HTTP mount |
| MCP tool definitions |
| Download + ETL entrypoint |
| Container entrypoint (rebuild + serve) |
| Fly.io deploy |
| football-data.co.uk column key |
Library usage
from ligamx.queries import get_form, get_h2h, get_standings, get_position
get_form("america", n=5)
get_h2h("america", "guadalajara")
get_standings() # current tournament
get_position("tigres")This server cannot be deployed
Maintenance
Related MCP Connectors
API-Football MCP — comprehensive soccer/football data
Football-Data.org MCP — soccer competitions, matches, standings
OpenLigaDB MCP — community-run, keyless football / soccer match data.
Sports MCP — wraps TheSportsDB API (free tier, test key 3, no auth required)
Related MCP Servers
- FlicenseAqualityDmaintenanceProvides live football data through MCP tools, enabling users to fetch today's matches and top scorers for competitions like the Premier League or World Cup.2-
- AlicenseNot gradedqualityBmaintenanceEnables interaction with the CopaMind platform via MCP, exposing read-only and write tools for querying match predictions, Monte Carlo simulations, team rankings, and RAG-based explanations, all while maintaining full traceability and reproducibility.1MIT
- FlicenseAqualityBmaintenanceEnables conversational AI to fetch live World Cup matches, standings, results, and generate journalist-style match summaries using MCP tools and prompts.4-
- AlicenseAqualityCmaintenanceEnables MCP clients to access live football data from FotMob, including match stats, team form, injuries, and player workload, without making predictions.101MIT