ANSES Ciqual MCP Server

ANSES Ciqual MCP Server

Provides SQL access to the ANSES Ciqual French food composition database with nutritional data for over 3,000 foods. Supports full-text search and bilingual queries for comprehensive nutrition analysis.

Category
访问服务器

README

ANSES Ciqual MCP Server

<div align="center">

Tests PyPI version Python 3.10+ License: MIT MCP Protocol

An MCP (Model Context Protocol) server providing SQL access to the ANSES Ciqual French food composition database. Query nutritional data for over 3,000 foods with full-text search support.

ANSES Ciqual Database

</div>

Features

  • 🍎 Comprehensive Database: Access nutritional data for 3,185+ French foods
  • 🔍 SQL Interface: Query using standard SQL with full flexibility
  • 🌍 Bilingual Support: French and English food names
  • 🔤 Fuzzy Search: Built-in full-text search with typo tolerance
  • 📊 60+ Nutrients: Detailed composition including vitamins, minerals, macros, and more
  • 🔄 Auto-Updates: Automatically refreshes data yearly from ANSES (checks on startup)
  • 🔒 Read-Only: Safe queries with no risk of data modification
  • 💾 Lightweight: ~10MB SQLite database with efficient indexing

Installation

Via pip

pip install ciqual-mcp

Via uvx (recommended)

uvx ciqual-mcp

From source

git clone https://github.com/zzgael/ciqual-mcp.git
cd ciqual-mcp
pip install -e .

MCP Client Configuration

Claude Desktop

Add to your Claude Desktop configuration:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "ciqual": {
      "command": "uvx",
      "args": ["ciqual-mcp"]
    }
  }
}

Zed

Add to your Zed settings:

{
  "assistant": {
    "version": "2",
    "mcp": {
      "servers": {
        "ciqual": {
          "command": "uvx",
          "args": ["ciqual-mcp"]
        }
      }
    }
  }
}

Cline (VSCode Extension)

Add to your VSCode settings (settings.json):

{
  "cline.mcpServers": {
    "ciqual": {
      "command": "uvx",
      "args": ["ciqual-mcp"]
    }
  }
}

Continue.dev

Add to your Continue config (~/.continue/config.json):

{
  "mcpServers": [
    {
      "name": "ciqual",
      "command": "uvx",
      "args": ["ciqual-mcp"]
    }
  ]
}

Usage

As an MCP Server

The server implements the Model Context Protocol and exposes a single query function:

# Start the server standalone (for testing)
ciqual-mcp

Direct Python Usage

from ciqual_mcp.data_loader import initialize_database

# Initialize/update the database
initialize_database()

# Then use SQLite directly
import sqlite3
conn = sqlite3.connect("~/.ciqual/ciqual.db")
cursor = conn.execute("SELECT * FROM foods WHERE alim_nom_eng LIKE '%apple%'")

Database Schema

Tables

foods - Food items

  • alim_code (INTEGER, PK): Unique food identifier
  • alim_nom_fr (TEXT): French name
  • alim_nom_eng (TEXT): English name
  • alim_grp_code (TEXT): Food group code

nutrients - Nutrient definitions

  • const_code (INTEGER, PK): Unique nutrient identifier
  • const_nom_fr (TEXT): French name
  • const_nom_eng (TEXT): English name
  • unit (TEXT): Measurement unit (g/100g, mg/100g, etc.)

composition - Nutritional values

  • alim_code (INTEGER): Food identifier
  • const_code (INTEGER): Nutrient identifier
  • teneur (REAL): Value per 100g
  • code_confiance (TEXT): Confidence level (A/B/C/D)

foods_fts - Full-text search

Virtual table for fuzzy matching with French/English names

Common Nutrient Codes

Category Code Nutrient Unit
Energy 327 Energy kJ/100g
328 Energy kcal/100g
Macros 25000 Protein g/100g
31000 Carbohydrates g/100g
40000 Fat g/100g
34100 Fiber g/100g
32000 Sugars g/100g
Minerals 10110 Sodium mg/100g
10200 Calcium mg/100g
10260 Iron mg/100g
10190 Potassium mg/100g
Vitamins 55400 Vitamin C mg/100g
56400 Vitamin D µg/100g
51330 Vitamin B12 µg/100g

Example Queries

Basic Search

-- Find foods by name
SELECT * FROM foods WHERE alim_nom_eng LIKE '%orange%';

-- Fuzzy search (handles typos)
SELECT * FROM foods_fts WHERE foods_fts MATCH 'orang*';

Nutritional Queries

-- Get vitamin C content for oranges
SELECT f.alim_nom_eng, c.teneur as vitamin_c_mg
FROM foods f
JOIN composition c ON f.alim_code = c.alim_code
WHERE f.alim_nom_eng LIKE '%orange%' 
  AND c.const_code = 55400;

-- Find foods highest in protein
SELECT f.alim_nom_eng, c.teneur as protein_g
FROM foods f
JOIN composition c ON f.alim_code = c.alim_code
WHERE c.const_code = 25000
ORDER BY c.teneur DESC
LIMIT 10;

-- Compare macros for different foods
SELECT 
    f.alim_nom_eng as food,
    MAX(CASE WHEN c.const_code = 25000 THEN c.teneur END) as protein_g,
    MAX(CASE WHEN c.const_code = 31000 THEN c.teneur END) as carbs_g,
    MAX(CASE WHEN c.const_code = 40000 THEN c.teneur END) as fat_g,
    MAX(CASE WHEN c.const_code = 328 THEN c.teneur END) as calories_kcal
FROM foods f
JOIN composition c ON f.alim_code = c.alim_code
WHERE f.alim_nom_eng IN ('Apple, raw', 'Banana, raw', 'Orange, raw')
  AND c.const_code IN (25000, 31000, 40000, 328)
GROUP BY f.alim_code, f.alim_nom_eng;

Dietary Restrictions

-- Find low-sodium foods (<100mg/100g)
SELECT f.alim_nom_eng, c.teneur as sodium_mg
FROM foods f
JOIN composition c ON f.alim_code = c.alim_code
WHERE c.const_code = 10110 
  AND c.teneur < 100
ORDER BY c.teneur ASC;

-- High-fiber foods (>5g/100g)
SELECT f.alim_nom_eng, c.teneur as fiber_g
FROM foods f
JOIN composition c ON f.alim_code = c.alim_code
WHERE c.const_code = 34100 
  AND c.teneur > 5
ORDER BY c.teneur DESC;

Data Source

Data is sourced from the official ANSES Ciqual database:

  • Website: https://ciqual.anses.fr/
  • Data portal: https://www.data.gouv.fr/fr/datasets/table-de-composition-nutritionnelle-des-aliments-ciqual/

The database is automatically updated yearly when the server starts (data hasn't changed since 2020, so yearly updates are sufficient).

Requirements

  • Python 3.9 or higher
  • 50MB free disk space (for database)
  • Internet connection (for initial data download)

License

MIT License - See LICENSE file for details

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development

Running Tests

# Install development dependencies
pip install -e .
pip install pytest pytest-asyncio

# Run unit tests
python -m pytest tests/test_server.py -v

# Run functional tests (requires database)
python -m pytest tests/test_functional.py -v

Troubleshooting

Database not initializing

  • Check internet connection
  • Ensure write permissions to ~/.ciqual/ directory
  • Try manual initialization: python -m ciqual_mcp.data_loader

XML parsing errors

  • The tool handles malformed XML automatically with recovery mode
  • If issues persist, delete ~/.ciqual/ciqual.db and restart

Credits

Developed by Gael Debost as part of GPT Workbench, a multi-LLM interface for medical research developed by Ideagency.

Data provided by ANSES (Agence nationale de sécurité sanitaire de l'alimentation, de l'environnement et du travail).

Citation

If you use this tool in your research, please cite:

@software{ciqual_mcp,
  title = {ANSES Ciqual MCP Server},
  author = {Gael Debost},
  year = {2025},
  url = {https://github.com/zzgael/ciqual-mcp}
}

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选