mcp-grocy
Version:
Model Context Protocol (MCP) server for Grocy integration
320 lines (257 loc) • 7.17 kB
Markdown
private Grocy demo instance:
1. Visit [https://demo.grocy.info](https://demo.grocy.info).
2. Look for "Create a private demo instance" section
3. Create your personal instance which will remain available for testing
4. Use the provided API key and URL in your `.env` file:
```
GROCY_BASE_URL=https://your-name-xxxxx.demo.grocy.info
GROCY_API_KEY=your-private-api-key
```
⚠️ IMPORTANT: Only provide the endpoint path - do not include full URLs. Your path will be automatically resolved to the full URL.
For example, if the base URL is `https://your-own-demo.grocy.info`:
✅ Correct: `"/api/objects/products"` → Resolves to: `https://your-own-demo.grocy.info/api/objects/products`
❌ Incorrect: `"https://your-own-demo.grocy.info/api/objects/products"` or `"www.grocy.example.com/api/objects/products"`
```typescript
use_mcp_tool('grocy-api', 'get_stock', {});
```
```typescript
use_mcp_tool('grocy-api', 'get_stock_volatile', {
"includeDetails": true
});
```
```typescript
use_mcp_tool('grocy-api', 'get_products', {});
```
```typescript
use_mcp_tool('grocy-api', 'get_shopping_list', {});
```
```typescript
use_mcp_tool('grocy-api', 'add_shopping_list_item', {
"productId": 1,
"amount": 2,
"shoppingListId": 1,
"note": "Get the organic variety"
});
```
```typescript
use_mcp_tool('grocy-api', 'inventory_transactions_purchase', {
"productId": 1,
"amount": 2,
"bestBeforeDate": "2024-12-31",
"price": 3.99,
"storeId": 1
});
```
```typescript
use_mcp_tool('grocy-api', 'inventory_stock_entry_consume', {
"productId": 1,
"amount": 1,
"spoiled": false
});
```
```typescript
use_mcp_tool('grocy-api', 'get_recipes', {});
```
```typescript
use_mcp_tool('grocy-api', 'get_recipe_fulfillment', {
"recipeId": 1,
"servings": 2
});
```
```typescript
use_mcp_tool('grocy-api', 'get_meal_plan', {
"date": "2024-07-01"
});
```
```typescript
use_mcp_tool('grocy-api', 'get_meal_plan_sections', {});
```
```typescript
use_mcp_tool('grocy-api', 'add_recipe_to_meal_plan', {
"recipeId": 1,
"day": "2024-07-01",
"servings": 2,
"section_id": 3
});
```
Note: Use get_meal_plan_sections to find valid section IDs for your Grocy instance.
```typescript
use_mcp_tool('grocy-api', 'delete_recipe_from_meal_plan', {
"date": "2024-07-01",
"meal_plan_entry_id": 123
});
```
Note: Use get_meal_plan to find the meal_plan_entry_id of the entry you want to remove.
```typescript
use_mcp_tool('grocy-api', 'consume_recipe', {
"recipeId": 1,
"servings": 2
});
```
```typescript
use_mcp_tool('grocy-api', 'get_chores', {});
```
```typescript
use_mcp_tool('grocy-api', 'track_chore_execution', {
"choreId": 1,
"executedBy": 1,
"tracked_time": "2024-06-30 15:30:00"
});
```
```typescript
use_mcp_tool('grocy-api', 'get_tasks', {});
```
```typescript
use_mcp_tool('grocy-api', 'complete_task', {
"taskId": 1,
"note": "Task completed successfully"
});
```
```typescript
use_mcp_tool('grocy-api', 'get_locations', {});
```
```typescript
use_mcp_tool('grocy-api', 'get_shopping_locations', {});
```
```typescript
use_mcp_tool('grocy-api', 'inventory_stock_entry_transfer', {
"productId": 1,
"amount": 1,
"locationIdFrom": 1,
"locationIdTo": 2,
"note": "Moving to kitchen"
});
```
If you need to access a Grocy API endpoint not covered by the specialized tools:
```typescript
use_mcp_tool('grocy-api', 'call_grocy_api', {
"endpoint": "objects/product_barcodes",
"method": "GET"
});
```
For detailed testing with full control over the request:
```typescript
use_mcp_tool('grocy-api', 'test_request', {
"method": "GET",
"endpoint": "/api/stock/products/by-barcode/1234567890",
"headers": {
"Accept-Language": "en-US"
}
});
```
This document provides a comprehensive reference of all available endpoints in the MCP Grocy API.
Retrieves a list of all recipes.
**Response:**
```json
[
{
"id": 1,
"name": "Pizza",
"description": "Homemade pizza recipe"
}
]
```
Retrieves details of a specific recipe by ID.
**Parameters:**
- `recipeId`: ID of the recipe to retrieve
**Response:**
```json
{
"id": 1,
"name": "Pizza",
"description": "Homemade pizza recipe",
"base_servings": 4,
"desired_servings": 4,
"preparation": "Mix ingredients and bake at 450°F"
}
- **GET** `/api/grocy/recipes/:recipeId/fulfillment`
- Returns fulfillment information for a specific recipe including:
- Whether ingredients are in stock
- Missing products count
- Costs
- Calories
- Due score
- **GET** `/api/grocy/recipes-fulfillment`
- Returns fulfillment information for all recipes including:
- Recipe ID
- Fulfillment status
- Missing products count
- Costs
- **POST** `/api/grocy/recipes/:recipeId/add-not-fulfilled-products-to-shoppinglist`
- Adds all missing ingredients for a recipe to the shopping list
- Returns the result of the operation
- **GET** `/api/grocy/stock`
- Returns a list of all stock items
- **GET** `/api/grocy/stock/:stockId`
- Returns details of a specific stock item
- **GET** `/api/grocy/chores`
- Returns a list of all chores
- **POST** `/api/grocy/chores/executions/:executionId/undo`
- Undoes a chore execution
- Returns the result of the operation
- **GET** `/api/grocy/batteries`
- Returns a list of all batteries
- **POST** `/api/grocy/batteries/charge-cycles/:chargeCycleId/undo`
- Undoes a battery charge cycle
- Returns the result of the operation
- **GET** `/api/grocy/tasks`
- Returns a list of all tasks
- **POST** `/api/grocy/tasks/:taskId/undo`
- Undoes a task completion
- Returns the result of the operation
- **POST** `/api/grocy/undo/:entityType/:id`
- Unified endpoint for undoing various actions
- `entityType` can be 'chores', 'batteries', or 'tasks'
- `id` is the ID of the execution, charge cycle, or task
- Returns the result of the undo operation
Before testing the API, you can create your own