mcp-open-food-facts
Version:
MCP server to use Open Food Facts API
137 lines (101 loc) ⢠3.14 kB
Markdown
# MCP Open Food Facts Server




[SPANISH VERSION](README_ES.md)
An MCP (Model Context Protocol) server that provides access to the Open Food Facts API, enabling searches and queries for nutritional information of food products.
## š Features
- Product search by name
- Product search by barcode
- Detailed product information retrieval
- MCP protocol integration
- TypeScript support
## š Prerequisites
- Node.js (version 18 or higher)
- npm or yarn
- TypeScript
## š§ Installation
1. Clone the repository:
```bash
git clone https://github.com/PayCode-Studio/mcp-open-food-facts
cd mcp-open-food-facts
```
2. Install dependencies:
```bash
npm install
# or
yarn install
```
## š Usage
### Development
To run the server in development mode:
```bash
npm run dev
# or
yarn dev
```
### Production
To build and run in production:
```bash
npm run build
npm start
# or
yarn build
yarn start
```
## š¦ Project Structure
```
mcp-open-food-facts/
āāā src/
ā āāā index.ts # Application entry point
ā āāā services/ # Application services
ā ā āāā open-food-facts.services.ts
ā āāā types/ # TypeScript type definitions
ā āāā mcp.type.ts
ā āāā open-food-facts.type.ts
āāā dist/ # Compiled code
āāā package.json
āāā tsconfig.json
āāā README.md
```
## š API
### Product Search
#### Search by Name
```typescript
const products = await searchProduct("coca cola");
```
#### Search by Barcode
```typescript
const product = await getProductByBarcode("5449000000996");
```
### Response
The API returns detailed information about products, including:
- Nutritional information
- Ingredients
- Allergens
- Brand
- Categories
- Ecoscore score
- And more...
## š¤ Contribution
1. Fork the project
2. Create a branch for your feature (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## š License
This project is under the ISC License. See the `LICENSE` file for more details.
## ⨠Author
**cisco_juan** - *Initial Work* - [cisco_juan](https://github.com/cisco_juan)
## š Thanks
- [Open Food Facts](https://world.openfoodfacts.org/) for providing the API
- [Model Context Protocol](https://github.com/modelcontextprotocol) for the MCP framework
- All contributors who participate in this project
## š Support
If you have any questions or problems, please:
1. Check existing issues
2. Open a new issue if necessary
3. Contact the maintenance team
---
Made with ā¤ļø by the community of developers