Skip to main content

fooddb-jp 🇯🇵🍱

The complete Japanese Standard Tables of Food Composition (8th ed. 2023) as a structured SQLite database + REST API + MCP Server.

Japan's Ministry of Education (MEXT) provides food composition data only as Excel files. This project converts 2,541 foods × 353 nutrients (440,441 records) into an INFOODS Tagname-compliant SQLite database, queryable via API or AI agents (MCP).

🇯🇵 日本語 README はこちら

Quick Start

# Install dependencies
uv sync

# Start REST API (Swagger UI at http://localhost:8800/docs)
uv run uvicorn api:app --port 8800

# Start MCP Server (stdio mode)
uv run python mcp_server.py

🌐 Live API

A public API is available — no setup required:

# Search for chicken
curl "https://fooddb.navii.online/foods/search/chicken"

# Get vitamin C ranking (top 10)
curl "https://fooddb.navii.online/ranking/VITC?limit=10"

# Calculate nutrition (100g oatmeal + 200g milk)
curl "https://fooddb.navii.online/calculate?foods=1004:100,13003:200"

Base URL: https://fooddb.navii.online Swagger UI: https://fooddb.navii.online/docs Start free: https://fooddb.navii.online/start — copy a ready-to-paste keyless mcp_config.json and start on the Free tier (no API key).

Pricing

Plan Rate Limit Price
Free 100 req/day $0
Developer 10,000 req/day $9.99/mo
Pro 100,000 req/day $29.99/mo

Free tier requires no API key — grab your MCP config at /start. For higher limits, visit /billing/checkout.

Database Scale

Metric Value
Foods 2,541
Nutrient tags 353 (INFOODS-compliant)
Nutrient records 440,441
Tables 11 (Main + Amino acids ×4 + Fatty acids ×3 + Carbohydrates ×3)
JP/EN label coverage 100%
Search aliases 31,504
Food name parsing 27 categories + 44 subcategories
SQLite size ~65 MB

Why fooddb-jp?

Feature fooddb-jp USDA FoodData Central MEXT Official Site
Japanese foods ✅ 2,541 ❌ US-centric ✅ 2,541
API access ✅ REST + MCP ✅ REST ❌ Web only
INFOODS tags ✅ 353 tags ❌ NDB numbers ❌ None
SQLite download ✅ Single file ❌ CSV dumps ❌ Excel only
Fuzzy search ✅ 4-stage hybrid ✅ Basic ❌ Exact match
AI agent support ✅ MCP Server ❌ None ❌ None
Bilingual labels ✅ JP + EN ✅ EN only ✅ JP only
Free & OSS ✅ MIT ✅ Public domain ⚠️ No API

Data Source

  • Standard Tables of Food Composition in Japan (8th Revised Edition, Supplementary 2023)
  • Published by: Ministry of Education, Culture, Sports, Science and Technology (MEXT)
  • URL: https://www.mext.go.jp/a_menu/syokuhinseibun/mext_00001.html
  • All 11 Excel files (Main table, Amino acids ×4, Fatty acids ×3, Carbohydrates ×3)

Data Quality

Automated quality checks (6 validations):

  • No negative values in the entire dataset
  • Mass balance (Water + Protein + Fat + Carbs + Ash ≈ 100g) — no anomalies
  • Energy consistency — calculated vs. recorded values within tolerance
  • Estimated value flags — 18.8% of records flagged as estimated (expected)
  • Excel cross-check — 10 foods verified against original Excel (10/10 PASS)

REST API Endpoints

Method Path Description
GET / Database stats (no auth)
GET /foods List foods (?q=query&group=code&category=cat)
GET /foods/{id} Food detail + all nutrient values
GET /foods/search/{query} Fuzzy search (4-stage hybrid)
GET /nutrients Nutrient definitions
GET /nutrients/{tag} Nutrient detail
GET /ranking/{tag} Nutrient content ranking
GET /calculate Nutrition calculator (?foods=1004:100,12004:60)
GET /groups Food group list

Performance (Mac Mini, SQLite)

Query Latency QPS
Food search (LIKE) 431 µs 2,322
Food detail + nutrients (JOIN) 86 µs 11,600
Ranking (ORDER BY) 3.1 ms 326
Nutrition calculation (2 foods) 90 µs 11,100

MCP Tools (for AI Agents)

5 tools for direct AI agent integration:

Tool Description Example
search_food Fuzzy food search "chicken breast", "豆腐"
get_food_nutrients Get nutrients by food number 11220
calculate_nutrition Calculate nutrition "1004:100,12004:60"
nutrient_ranking Nutrient ranking VITC (Vitamin C)
list_food_groups List food groups

Nutrient Identifiers (INFOODS Tagnames)

Key tags:

Tag Japanese English Unit
ENERC_KCAL エネルギー Energy kcal
PROT- たんぱく質 Protein g
FAT- 脂質 Total fat g
CHOCDF- 炭水化物 Carbohydrate g
FIB- 食物繊維総量 Dietary fiber g
NA ナトリウム Sodium mg
CA カルシウム Calcium mg
FE Iron mg
VITC ビタミンC Vitamin C mg
... (353 total)

The trailing - is an official INFOODS suffix meaning "analytical method unspecified".

Project Structure

fooddb-jp/
├── data/
│   ├── raw/                     # Source data (MEXT Excel ×11)
│   └── output/                  # Converted intermediate files
├── scripts/
│   ├── convert_all.py           # Excel → SQLite pipeline
│   ├── build_nutrient_master.py # Nutrient definition builder
│   ├── build_aliases.py         # Search alias generator
│   ├── quality_check.py         # Data quality validation (6 checks)
│   └── test_food_name_parse.py  # Excel cross-validation test
├── fooddb.sqlite                # SQLite database (download from Releases)
├── api.py                       # FastAPI REST API
├── mcp_server.py                # MCP Server (stdio/HTTP)
└── pyproject.toml

License

  • Code: MIT License
  • Data: MEXT Government Standard Terms of Use 2.0 (equivalent to CC BY 4.0). Attribution: Ministry of Education, Culture, Sports, Science and Technology (MEXT), Japan.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fooddb_jp-0.3.1.tar.gz (209.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fooddb_jp-0.3.1-py3-none-any.whl (249.1 kB view details)

Uploaded Python 3

File details

Details for the file fooddb_jp-0.3.1.tar.gz.

File metadata

  • Download URL: fooddb_jp-0.3.1.tar.gz
  • Upload date:
  • Size: 209.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.8

File hashes

Hashes for fooddb_jp-0.3.1.tar.gz
Algorithm Hash digest
SHA256 9652f9c483d6e675519e1f2b046d57ebe2b036ae76863c20e881f834ec102a55
MD5 74c2df98dee28af0113d289f1629c148
BLAKE2b-256 9d098fb584f74f02daa3e71114a9ef8c4f66c3973b4072a9fe8bbd53fd107e5a

See more details on using hashes here.

File details

Details for the file fooddb_jp-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: fooddb_jp-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 249.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.8

File hashes

Hashes for fooddb_jp-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0a6d768442e03b3771ac7a6a241a68b6b7a4ccfd9d570d2062eef24a53024baf
MD5 521432131912815fcdb2fecba5b453c9
BLAKE2b-256 95edbdbcf9f08a8f6b328e9adbf0787e917483ea23b46085cdcf691392814ff2

See more details on using hashes here.

Release history Release notifications | RSS feed

0.4.0

2 files

This release

0.3.1 This release

2 files

0.3.0

2 files

0.2.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page