world-cup-stats-mcp

world-cup-stats-mcp

Provides structured access to a World Cup SQLite database via MCP tools, enabling queries for tournaments, team histories, head-to-head matches, and player records.

Category
访问服务器

README

World Cup Stats MCP

A read-only MCP server that gives compatible AI clients structured access to a World Cup SQLite database. It supports local stdio development and authenticated Streamable HTTP deployment from the same codebase.

AI host
  └── MCP client
        ├── stdio ── local server process
        └── HTTPS ── remote server on Fly.io
                          └── read-only SQLite

Production scope

For this project, production-ready means a private, single-tenant, read-only service with:

  • typed tools and bounded result sizes;
  • read-only database access and safe tool errors;
  • automated data, protocol and authenticated HTTP tests;
  • a health endpoint and structured server logs;
  • a pinned, non-root Docker image;
  • TLS deployment on Fly.io with a pre-shared bearer token.

This is not an OAuth service for arbitrary third-party users. A public, multi-user MCP product should replace the pre-shared token with a real OAuth authorization server and add its own usage limits and monitoring.

Available tools

  • list_tournaments lists available men’s or women’s tournaments.
  • get_team_history returns a country’s tournament records and totals.
  • get_head_to_head finds World Cup meetings between two countries.
  • get_player_record returns appearances, starts, goals and knockout statistics.

All tools are read-only. The server does not expose arbitrary SQL.

Dataset

The project includes the SQLite edition of The Fjelstul World Cup Database:

  • 22 men’s tournaments from 1930–2022;
  • 8 women’s tournaments from 1991–2019;
  • matches, teams, squads, appearances, goals, cards and standings.

Attribution, licence and the exact checksum are in data/README.md. The database and schema are distributed under CC BY-SA 4.0.

Local setup

Requirements:

  • Python 3.12 or newer;
  • uv;
  • Node.js if using MCP Inspector.

Install the locked dependencies:

cd "/Users/lukebyrne/Documents/builds/world-cup-stats-mcp"
uv sync --no-editable

Run all tests:

uv run --no-editable pytest

Run an ordinary Python query before introducing MCP:

uv run --no-editable python scripts/demo_query.py

Test the local stdio server

Launch MCP Inspector:

npx -y @modelcontextprotocol/inspector \
  uv \
  --directory "/Users/lukebyrne/Documents/builds/world-cup-stats-mcp" \
  run \
  --no-editable \
  world-cup-stats-mcp

In Inspector, open Tools, list the tools and call get_player_record with Kylian Mbappe.

The ready-to-use stdio configuration is in mcp.json.

Test Streamable HTTP locally

Create a temporary token and start the HTTP transport:

export MCP_API_TOKEN="$(openssl rand -hex 32)"
export MCP_TRANSPORT="streamable-http"
export MCP_PUBLIC_BASE_URL="http://127.0.0.1:8000"
export MCP_ALLOWED_HOSTS="127.0.0.1:8000,localhost:8000"
uv run --no-editable world-cup-stats-mcp

The endpoints are:

Health: http://127.0.0.1:8000/health
MCP:    http://127.0.0.1:8000/mcp

In Inspector, select Streamable HTTP, enter the MCP URL and paste the token into Bearer Token. An omitted or incorrect token receives HTTP 401.

The repeatable command-line smoke test is:

MCP_SERVER_URL="http://127.0.0.1:8000/mcp" \
MCP_API_TOKEN="$MCP_API_TOKEN" \
uv run --no-editable python scripts/remote_smoke_test.py

Build the container

The Docker image contains the immutable database snapshot and runs as a non-root user:

docker build -t world-cup-stats-mcp .
docker run --rm \
  -p 8000:8000 \
  -e MCP_API_TOKEN="$MCP_API_TOKEN" \
  -e MCP_PUBLIC_BASE_URL="http://127.0.0.1:8000" \
  -e MCP_ALLOWED_HOSTS="127.0.0.1:8000,localhost:8000" \
  world-cup-stats-mcp

Fly can build the same Dockerfile remotely, so a local Docker daemon is not required for deployment.

Deploy to Fly.io

Install and authenticate Fly’s CLI:

brew install flyctl
fly auth login

The repository contains a checked-in fly.toml. Set the bearer token as a Fly secret, then deploy:

fly secrets set MCP_API_TOKEN="$MCP_API_TOKEN"
fly deploy

Check the deployment:

fly status
fly logs
curl --fail "https://world-cup-mcp-luke.fly.dev/health"

Run the authenticated MCP smoke test:

MCP_SERVER_URL="https://world-cup-mcp-luke.fly.dev/mcp" \
MCP_API_TOKEN="$MCP_API_TOKEN" \
uv run --no-editable python scripts/remote_smoke_test.py

Recording prompts

Start with:

Compare Lionel Messi and Kylian Mbappé’s World Cup records through 2022. Include appearances, starts, total goals, knockout goals, final appearances and final goals. Use only the connected World Cup tools.

Then demonstrate a multi-tool question:

Compare Argentina and France at the men’s World Cup since 1990. Include each team’s tournament record and their head-to-head matches, then give me an evidence-based verdict. Use only the connected World Cup tools.

The second prompt should call get_team_history twice and get_head_to_head once.

Data conventions

  • Match wins and losses follow the source database’s convention. A knockout match decided on penalties counts as a win for the shootout winner.
  • Shootout wins and losses are also returned separately.
  • Own goals are excluded from personal goal totals.
  • Germany and West Germany remain separate source teams.
  • SQLite is opened with mode=ro and PRAGMA query_only.
  • Set WORLDCUP_DB_PATH only when moving the database file.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选