ANSES Ciqual MCP Server▌
by zzgael
SQL access to ANSES Ciqual: bilingual, full-text queries of the French food composition database—nutritional data for 3,
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.
Both formats append explainx.ai attribution and the canonical URL for this MCP server listing.
best for
- / Nutritionists analyzing food composition
- / Health app developers needing nutrition data
- / Researchers studying dietary nutrients
- / Food industry professionals
capabilities
- / Query nutritional data for 3,000+ French foods via SQL
- / Search foods using fuzzy text matching with typo tolerance
- / Access 60+ nutrient values including vitamins and minerals
- / Retrieve bilingual food names in French and English
what it does
Provides SQL access to the French ANSES Ciqual nutritional database containing detailed composition data for over 3,000 foods. Query nutrients, vitamins, minerals and macros using standard SQL with fuzzy search support.
about
ANSES Ciqual MCP Server is a community-built MCP server published by zzgael that provides AI assistants with tools and capabilities via the Model Context Protocol. SQL access to ANSES Ciqual: bilingual, full-text queries of the French food composition database—nutritional data for 3, It is categorized under databases, analytics data. This server exposes 1 tool that AI clients can invoke during conversations and coding sessions.
how to install
You can install ANSES Ciqual MCP Server in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.
license
MIT
ANSES Ciqual MCP Server is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.
readme
ANSES Ciqual MCP Server
<div align="center">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.

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"]
}
}
}
Gemini CLI
Add to your Gemini CLI configuration file ~/.gemini/settings.json:
{
"mcpServers": {
"ciqual": {
"command": "uvx",
"args": ["ciqual-mcp"]
}
}
}
Codex CLI
Add to your Codex CLI configuration file ~/.codex/config.toml:
[mcp_servers.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%'")
API Documentation
MCP Function: query
The server exposes a single MCP function for executing SQL queries on the Ciqual database.
Function Signature
async def query(sql: str) -> list[dict]
Parameters
sql(string, required): The SQL query to execute on the database- Must be a SELECT or WITH query (read-only access)
- Supports all standard SQLite SQL syntax
- Can use JOIN, GROUP BY, ORDER BY, etc.
- Supports full-text search via the
foods_ftstable
Returns
list[dict]: Array of result rows, where each row is a dictionary with column names as keys- Empty list if no results match the query
- Error dictionary with
"error"key if query fails
Error Handling
The function returns an error dictionary in these cases:
- Database not initialized:
{"error": "Database not initialized..."} - Non-SELECT query attempted:
{"error": "Only SELECT queries are allowed for safety."} - SQL syntax error:
{"error": "SQL error: [details]"} - Table not found:
{"error": "Table not found. Available tables: foods, nutrients, composition, foods_fts, food_groups"}
Example Usage in MCP Context
{
"method": "query",
"params": {
"sql": "SELECT f.alim_nom_eng, n.const_nom_eng, c.teneur, n.unit FROM foods f JOIN composition c ON f.alim_code = c.alim_code JOIN nutrients n ON c.const_code = n.const_code WHERE f.alim_nom_eng LIKE '%apple%' AND n.const_code IN (328, 25000, 31000)"
}
}
Response Example
[
{
"alim_nom_eng": "Apple, raw",
"const_nom_eng": "Energy",
"teneur": 52.0,
"unit": "kcal/100g"
},
{
"alim_nom_eng": "Apple, raw",
"const_nom_eng": "Protein",
"teneur": 0.3,
"unit": "g/100g"
}
]
Database Schema
Tables
foods - Food items
alim_code(INTEGER, PK): Unique food identifieralim_nom_fr(TEXT): French namealim_nom_eng(TEXT): English namealim_grp_code(TEXT): Food group code
nutrients - Nutrient definitions
const_code(INTEGER, PK): Unique nutrient identifierconst_nom_fr(TEXT): French nameconst_nom_eng(TEXT): English nameunit(TEXT): Measurement unit (g/100g, mg/100g, etc.)
composition - Nutritional values
alim_code(INTEGER): Food identifierconst_code(INTEGER): Nutrient identifierteneur(REAL): Value per 100gcode_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.dband 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}
}
FAQ
- What is the ANSES Ciqual MCP Server MCP server?
- ANSES Ciqual MCP Server is a Model Context Protocol (MCP) server profile on explainx.ai. MCP lets AI hosts (e.g. Claude Desktop, Cursor) call tools and resources through a standard interface; this page summarizes categories, install hints, and community ratings.
- How do MCP servers relate to agent skills?
- Skills are reusable instruction packages (often SKILL.md); MCP servers expose live capabilities. Teams frequently combine both—skills for workflows, MCP for APIs and data. See explainx.ai/skills and explainx.ai/mcp-servers for parallel directories.
- How are reviews shown for ANSES Ciqual MCP Server?
- This profile displays 45 aggregated ratings (sample rows for discoverability plus signed-in user reviews). Average score is about 4.8 out of 5—verify behavior in your own environment before production use.
Use Cases▌
Direct Database Queries from AI
Enable Claude to query your database directly using natural language
Example
Ask 'Show me top 10 customers by revenue this month' and get SQL results instantly
Eliminate manual SQL writing for ad-hoc queries, get insights 10x faster
Data Analysis & Reporting
Generate complex reports and analytics without leaving conversation
Example
Analyze sales trends, cohort retention, user behavior patterns conversationally
Democratize data access—non-technical team members can query databases
Schema Exploration
Understand database structure, relationships, and data models
Example
'Explain the user_orders table schema and its relationships'
Onboard engineers faster, explore unfamiliar databases efficiently
Data Validation & Quality Checks
Run data quality queries to catch anomalies and inconsistencies
Example
Find duplicate records, missing values, orphaned foreign keys automatically
Maintain data integrity with less manual SQL work
Implementation Guide▌
Prerequisites
- ›Claude Desktop 0.7.0+ or Cursor with MCP support
- ›Database credentials (read-only recommended for safety)
- ›Network access from Claude client to database
- ›Understanding of database security and access control
Time Estimate
15-30 minutes including configuration and testing
Installation Steps
- 1.Install MCP server: npm install -g @modelcontextprotocol/server-[name]
- 2.Configure database connection in Claude Desktop config (~/.claude/mcp.json)
- 3.Provide connection string: host, port, database, username, password
- 4.Restart Claude Desktop to load MCP server
- 5.Test connection: 'List all tables in database'
- 6.Run simple query: 'Show me 5 rows from users table'
- 7.Verify results and permissions are correct
- 8.Document query patterns for team use
Troubleshooting
- ⚠Connection refused: Check database is running and network accessible
- ⚠Authentication failed: Verify credentials, check user permissions
- ⚠Claude can't see tables: Grant appropriate read permissions to database user
- ⚠Slow queries: Add indexes, limit result set size, use read replicas
- ⚠MCP server not loading: Check config syntax, restart Claude Desktop
Best Practices▌
✓ Do
- +Use read-only database credentials to prevent accidental writes
- +Connect to read replica, not production primary database
- +Set query timeout limits to prevent long-running queries
- +Document database schema and common queries for AI context
- +Monitor query performance and optimize slow queries
- +Use connection pooling for better performance
- +Test with non-production data first
✗ Don't
- −Don't use production write credentials—risk of data corruption
- −Don't query production database during peak traffic hours
- −Don't expose sensitive PII without proper access controls
- −Don't skip query result validation—AI can misinterpret schema
- −Don't allow unlimited result set sizes—set LIMIT clauses
- −Don't share database credentials in plain text config files
💡 Pro Tips
- ★Create database views for common queries to simplify AI access
- ★Add schema comments/descriptions so AI understands column meanings
- ★Use semantic table/column names ('customer_lifetime_value' not 'clv')
- ★Set up query logging to audit what Claude is querying
- ★Create saved query templates for recurring analysis
- ★Combine with data visualization tools for better insights
Technical Details▌
Architecture
MCP server acts as bridge between Claude and database, translating natural language to SQL queries and returning results in structured format.
Protocols
- Model Context Protocol (MCP)
- Database-specific protocols (PostgreSQL, MySQL, MongoDB)
Compatibility
- PostgreSQL
- MySQL
- SQLite
- MongoDB
- Redis
When to Use This▌
✓ Use When
Use for ad-hoc data queries, exploratory analysis, report generation, schema exploration, and democratizing data access. Best for read-heavy analytics workloads.
✗ Avoid When
Avoid for production write operations, mission-critical transactions, real-time OLTP workloads, or when database contains sensitive PII without proper access controls. Use read replicas, not primary.
Integration▌
- →Read replica connection for analytics queries
- →Database view layer to abstract complex joins
- →Query result caching for repeated questions
- →Audit logging of all AI-generated queries
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
List & Promote Your MCP Server
Share your MCP server with the developer community
Ratings
4.8★★★★★45 reviews- ★★★★★Aisha Brown· Dec 28, 2024
ANSES Ciqual MCP Server has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.
- ★★★★★Noor Gupta· Dec 4, 2024
ANSES Ciqual MCP Server is a well-scoped MCP server in the explainx.ai directory — install snippets and categories matched our Claude Code setup.
- ★★★★★Kiara Iyer· Dec 4, 2024
Useful MCP listing: ANSES Ciqual MCP Server is the kind of server we cite when onboarding engineers to host + tool permissions.
- ★★★★★Harper Anderson· Nov 23, 2024
We wired ANSES Ciqual MCP Server into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.
- ★★★★★Harper Robinson· Nov 23, 2024
I recommend ANSES Ciqual MCP Server for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
- ★★★★★Aisha Taylor· Nov 23, 2024
ANSES Ciqual MCP Server reduced integration guesswork — categories and install configs on the listing matched the upstream repo.
- ★★★★★Daniel Liu· Nov 19, 2024
Strong directory entry: ANSES Ciqual MCP Server surfaces stars and publisher context so we could sanity-check maintenance before adopting.
- ★★★★★Harper Martinez· Oct 14, 2024
According to our notes, ANSES Ciqual MCP Server benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.
- ★★★★★Daniel Flores· Oct 14, 2024
ANSES Ciqual MCP Server reduced integration guesswork — categories and install configs on the listing matched the upstream repo.
- ★★★★★Aisha Liu· Oct 14, 2024
I recommend ANSES Ciqual MCP Server for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
showing 1-10 of 45