Skip to main content
Glama
jjaquezito

Football Live MCP

by jjaquezito
README.md
# Football Live MCP

Remote MCP server that exposes live football data from API-Football over
HTTP, implementing JSON-RPC 2.0 directly without any MCP SDK.

Companion to the local Football Intelligence MCP server: this one serves the
**current season**, while the local one serves the historical database
(2010-2025) stored in PostgreSQL.

## Protocol

Transport: HTTP. Single endpoint, one JSON-RPC message per request.

| Endpoint | Purpose |
|---|---|
| `GET /` | Health check. Returns server name, version and tool count. |
| `POST /mcp` | JSON-RPC 2.0 messages. Notifications return `202` with no body. |

Implemented methods: `initialize`, `notifications/initialized`, `ping`,
`tools/list`, `tools/call`.

Protocol version: `2025-06-18`.

## Tools

| Tool | Arguments | Returns |
|---|---|---|
| `get_upcoming_matches` | `league_id`, `days` (default 7) | Scheduled fixtures in the window |
| `get_recent_results` | `league_id`, `days` (default 7) | Finished fixtures with scores |
| `get_current_standings` | `league_id` | Live league table |
| `get_current_injuries` | `team_id` | Injured/suspended players |
| `get_live_matches` | — | Matches in play right now |
| `search_team_live` | `query` | Team ids from API-Football |

League ids: `39` Premier League, `140` La Liga, `135` Serie A, `78`
Bundesliga, `61` Ligue 1, `94` Primeira Liga, `2` UEFA Champions League.

## Running locally

```bash
pip install -r requirements.txt
export API_FOOTBALL_KEY=your_key_here
python server.py                    # listens on :8080
```

Verify:

```bash
curl http://localhost:8080/

curl -X POST http://localhost:8080/mcp \
  -H 'content-type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
```

## Deploying to Render

1. Push this directory to a GitHub repository.
2. In Render, create a **New Web Service** and connect that repository.
3. Render reads `render.yaml`; confirm runtime Python and the free plan.
4. Add the environment variable `API_FOOTBALL_KEY` with your API-Football key.
5. Deploy. The public endpoint will be `https://<service>.onrender.com/mcp`.

The free plan sleeps the service after inactivity, so the first request after
a pause takes around 50 seconds. Hit `GET /` once before a live demo to wake it.

## Using it from an MCP host

Add an entry with a `url` field to the host configuration:

```json
{
  "mcpServers": {
    "football_live": { "url": "https://<service>.onrender.com/mcp" }
  }
}
```