mcp-server-monmarche
This project is a Model Context Protocol server allowing interaction with the Mon Marché French grocery store website. It features product search and cart management via command-line tools.
My MCP Server
This project is a Model Context Protocol (MCP) server for interacting with the Mon Marché french grocery store website. It provides tools to search for products and add them to a cart using a command-line interface.
Features
- Search Products: Search for products by name on the Mon Marché website.
- Add Products to Cart: Add products to your cart by specifying their name.
- Session Management: Automatically logs in and manages session cookies for interacting with the website.
Prerequisites
- Node.js (v16 or higher)
- npm or yarn
- Playwright (installed automatically as a dependency)
- A Mon Marché account with valid credentials
Installation
-
Clone the repository:
git clone https://github.com/Chopin85/mcp-server-monmarche cd mcp-server-monmarche
-
Install dependencies:
npm install
-
Create a
.env
file based on the.env.example
file:cp .env.example .env
Fill in your Mon Marché credentials:
MON_MARCHE_EMAIL=your-email@example.com MON_MARCHE_PASSWORD=your-password
-
Build the project:
npm run build
Usage
Build
Before using the tools, you need build:
npm run build
Login Session
Before using the tools, you need to log in to Mon Marché:
npm run login
This will save the session cookies to session-cookie.json.
Start the Server
Run the server:
node build/index.js
The server will start and listen for requests via the standard input/output (stdio) transport.
Tools
Search Products
Use the get_products
tool to search for products by name:
{
"name": "get_products",
"arguments": {
"name": "apple"
}
}
Add Products to Cart
Use the add_product
tool to add a product to your cart:
{
"name": "add_product",
"arguments": {
"name": "apple"
}
}
Commands
You can also run commands directly thefrom CLI:
- Login:
npm run login
Project Structure
- index.ts: Main server implementation.
- monmarche.ts: Utility functions for interacting with the Mon Marché website.
- .env.example: Example environment variables file.
- tsconfig.json: TypeScript configuration.
- package.json: Project metadata and scripts.
Development
Build
To compile the TypeScript code:
npm run build
Run in Test Mode
You can run the server directly using @modelcontextprotocol/inspector
:
npx @modelcontextprotocol/inspector node build/index.js
Debugging
HEADLESS=false npx @modelcontextprotocol/inspector node build/index.js
Known Issues
- Ensure you have valid Mon Marché credentials in the .env file.
- The session-cookie.json file must exist for the tools to work.
License
This project is licensed under the ISC License.