# MCP Open Food Facts Server

![Version](https://img.shields.io/badge/version-1.0.0-blue.svg)
![License](https://img.shields.io/badge/license-MIT-green.svg)
![TypeScript](https://img.shields.io/badge/TypeScript-5.0.4-blue.svg)
![Node.js](https://img.shields.io/badge/Node.js-18.x-green.svg)


[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 