mcp-grocy 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +23 -0
- package/README.md +285 -0
- package/build/api/client.js +154 -0
- package/build/config/environment.js +142 -0
- package/build/main.js +29 -0
- package/build/resources/CHANGELOG.md +352 -0
- package/build/resources/DOCS.md +62 -0
- package/build/resources/README.md +285 -0
- package/build/resources/api-reference.md +92 -0
- package/build/resources/config.md +282 -0
- package/build/resources/examples.md +319 -0
- package/build/resources/installation.md +117 -0
- package/build/resources/response-format.md +165 -0
- package/build/server/http-server.js +214 -0
- package/build/server/mcp-server.js +173 -0
- package/build/server/resources.js +60 -0
- package/build/tools/base.js +56 -0
- package/build/tools/index.js +494 -0
- package/build/tools/products/definitions.js +57 -0
- package/build/tools/products/handlers.js +78 -0
- package/build/tools/products/index.js +13 -0
- package/build/tools/recipes/definitions.js +191 -0
- package/build/tools/recipes/handlers.js +258 -0
- package/build/tools/recipes/index.js +18 -0
- package/build/tools/shopping/index.js +107 -0
- package/build/tools/stock/definitions.js +234 -0
- package/build/tools/stock/handlers.js +391 -0
- package/build/tools/stock/index.js +19 -0
- package/build/tools/system/index.js +230 -0
- package/build/tools/types.js +1 -0
- package/build/version.js +4 -0
- package/package.json +87 -0
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
# Grocy API Testing Examples
|
|
2
|
+
|
|
3
|
+
## Setting Up Your Private Demo Instance
|
|
4
|
+
|
|
5
|
+
Before testing the API, you can create your own private Grocy demo instance:
|
|
6
|
+
|
|
7
|
+
1. Visit [https://demo.grocy.info](https://demo.grocy.info).
|
|
8
|
+
2. Look for "Create a private demo instance" section
|
|
9
|
+
3. Create your personal instance which will remain available for testing
|
|
10
|
+
4. Use the provided API key and URL in your `.env` file:
|
|
11
|
+
```
|
|
12
|
+
GROCY_BASE_URL=https://your-name-xxxxx.demo.grocy.info
|
|
13
|
+
GROCY_APIKEY_VALUE=your-private-api-key
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
⚠️ IMPORTANT: Only provide the endpoint path - do not include full URLs. Your path will be automatically resolved to the full URL.
|
|
17
|
+
|
|
18
|
+
For example, if the base URL is `https://your-own-demo.grocy.info`:
|
|
19
|
+
✅ Correct: `"/api/objects/products"` → Resolves to: `https://your-own-demo.grocy.info/api/objects/products`
|
|
20
|
+
❌ Incorrect: `"https://your-own-demo.grocy.info/api/objects/products"` or `"www.grocy.example.com/api/objects/products"`
|
|
21
|
+
|
|
22
|
+
## Basic API Tools
|
|
23
|
+
|
|
24
|
+
### Get Current Stock
|
|
25
|
+
```typescript
|
|
26
|
+
use_mcp_tool('grocy-api', 'get_stock', {});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Get Volatile Stock Information
|
|
30
|
+
```typescript
|
|
31
|
+
use_mcp_tool('grocy-api', 'get_stock_volatile', {
|
|
32
|
+
"includeDetails": true
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Get All Products
|
|
37
|
+
```typescript
|
|
38
|
+
use_mcp_tool('grocy-api', 'get_products', {});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Get All Shopping List Items
|
|
42
|
+
```typescript
|
|
43
|
+
use_mcp_tool('grocy-api', 'get_shopping_list', {});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Add Item to Shopping List
|
|
47
|
+
```typescript
|
|
48
|
+
use_mcp_tool('grocy-api', 'add_shopping_list_item', {
|
|
49
|
+
"productId": 1,
|
|
50
|
+
"amount": 2,
|
|
51
|
+
"shoppingListId": 1,
|
|
52
|
+
"note": "Get the organic variety"
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Purchase a Product
|
|
57
|
+
```typescript
|
|
58
|
+
use_mcp_tool('grocy-api', 'purchase_product', {
|
|
59
|
+
"productId": 1,
|
|
60
|
+
"amount": 2,
|
|
61
|
+
"bestBeforeDate": "2024-12-31",
|
|
62
|
+
"price": 3.99,
|
|
63
|
+
"storeId": 1
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Consume a Product
|
|
68
|
+
```typescript
|
|
69
|
+
use_mcp_tool('grocy-api', 'consume_product', {
|
|
70
|
+
"productId": 1,
|
|
71
|
+
"amount": 1,
|
|
72
|
+
"spoiled": false
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Recipe and Meal Planning
|
|
77
|
+
|
|
78
|
+
### Get All Recipes
|
|
79
|
+
```typescript
|
|
80
|
+
use_mcp_tool('grocy-api', 'get_recipes', {});
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Check Recipe Fulfillment
|
|
84
|
+
```typescript
|
|
85
|
+
use_mcp_tool('grocy-api', 'get_recipe_fulfillment', {
|
|
86
|
+
"recipeId": 1,
|
|
87
|
+
"servings": 2
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Get Meal Plan for a Date
|
|
92
|
+
```typescript
|
|
93
|
+
use_mcp_tool('grocy-api', 'get_meal_plan', {
|
|
94
|
+
"date": "2024-07-01"
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Get Meal Plan Sections
|
|
99
|
+
```typescript
|
|
100
|
+
use_mcp_tool('grocy-api', 'get_meal_plan_sections', {});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Add Recipe to Meal Plan
|
|
104
|
+
```typescript
|
|
105
|
+
use_mcp_tool('grocy-api', 'add_recipe_to_meal_plan', {
|
|
106
|
+
"recipeId": 1,
|
|
107
|
+
"day": "2024-07-01",
|
|
108
|
+
"servings": 2,
|
|
109
|
+
"section_id": 3
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Note: Use get_meal_plan_sections to find valid section IDs for your Grocy instance.
|
|
114
|
+
|
|
115
|
+
### Delete Recipe from Meal Plan
|
|
116
|
+
```typescript
|
|
117
|
+
use_mcp_tool('grocy-api', 'delete_recipe_from_meal_plan', {
|
|
118
|
+
"date": "2024-07-01",
|
|
119
|
+
"meal_plan_entry_id": 123
|
|
120
|
+
});
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Note: Use get_meal_plan to find the meal_plan_entry_id of the entry you want to remove.
|
|
124
|
+
|
|
125
|
+
### Consume Recipe Ingredients
|
|
126
|
+
```typescript
|
|
127
|
+
use_mcp_tool('grocy-api', 'consume_recipe', {
|
|
128
|
+
"recipeId": 1,
|
|
129
|
+
"servings": 2
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Chores and Tasks
|
|
134
|
+
|
|
135
|
+
### Get All Chores
|
|
136
|
+
```typescript
|
|
137
|
+
use_mcp_tool('grocy-api', 'get_chores', {});
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Track Chore Execution
|
|
141
|
+
```typescript
|
|
142
|
+
use_mcp_tool('grocy-api', 'track_chore_execution', {
|
|
143
|
+
"choreId": 1,
|
|
144
|
+
"executedBy": 1,
|
|
145
|
+
"tracked_time": "2024-06-30 15:30:00"
|
|
146
|
+
});
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Get All Tasks
|
|
150
|
+
```typescript
|
|
151
|
+
use_mcp_tool('grocy-api', 'get_tasks', {});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Complete a Task
|
|
155
|
+
```typescript
|
|
156
|
+
use_mcp_tool('grocy-api', 'complete_task', {
|
|
157
|
+
"taskId": 1,
|
|
158
|
+
"note": "Task completed successfully"
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Locations and Organization
|
|
163
|
+
|
|
164
|
+
### Get All Locations
|
|
165
|
+
```typescript
|
|
166
|
+
use_mcp_tool('grocy-api', 'get_locations', {});
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Get All Shopping Locations (Stores)
|
|
170
|
+
```typescript
|
|
171
|
+
use_mcp_tool('grocy-api', 'get_shopping_locations', {});
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Transfer Product Between Locations
|
|
175
|
+
```typescript
|
|
176
|
+
use_mcp_tool('grocy-api', 'transfer_product', {
|
|
177
|
+
"productId": 1,
|
|
178
|
+
"amount": 1,
|
|
179
|
+
"locationIdFrom": 1,
|
|
180
|
+
"locationIdTo": 2,
|
|
181
|
+
"note": "Moving to kitchen"
|
|
182
|
+
});
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Advanced API Usage
|
|
186
|
+
|
|
187
|
+
### Custom API Call
|
|
188
|
+
If you need to access a Grocy API endpoint not covered by the specialized tools:
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
use_mcp_tool('grocy-api', 'call_grocy_api', {
|
|
192
|
+
"endpoint": "objects/product_barcodes",
|
|
193
|
+
"method": "GET"
|
|
194
|
+
});
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Raw API Testing
|
|
198
|
+
For detailed testing with full control over the request:
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
use_mcp_tool('grocy-api', 'test_request', {
|
|
202
|
+
"method": "GET",
|
|
203
|
+
"endpoint": "/api/stock/products/by-barcode/1234567890",
|
|
204
|
+
"headers": {
|
|
205
|
+
"Accept-Language": "en-US"
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
# MCP Grocy API - Endpoint Reference
|
|
211
|
+
|
|
212
|
+
This document provides a comprehensive reference of all available endpoints in the MCP Grocy API.
|
|
213
|
+
|
|
214
|
+
## Recipes
|
|
215
|
+
|
|
216
|
+
### GET `/api/grocy/recipes`
|
|
217
|
+
Retrieves a list of all recipes.
|
|
218
|
+
|
|
219
|
+
**Response:**
|
|
220
|
+
```json
|
|
221
|
+
[
|
|
222
|
+
{
|
|
223
|
+
"id": 1,
|
|
224
|
+
"name": "Pizza",
|
|
225
|
+
"description": "Homemade pizza recipe"
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### GET `/api/grocy/recipes/:recipeId`
|
|
231
|
+
Retrieves details of a specific recipe by ID.
|
|
232
|
+
|
|
233
|
+
**Parameters:**
|
|
234
|
+
- `recipeId`: ID of the recipe to retrieve
|
|
235
|
+
|
|
236
|
+
**Response:**
|
|
237
|
+
```json
|
|
238
|
+
{
|
|
239
|
+
"id": 1,
|
|
240
|
+
"name": "Pizza",
|
|
241
|
+
"description": "Homemade pizza recipe",
|
|
242
|
+
"base_servings": 4,
|
|
243
|
+
"desired_servings": 4,
|
|
244
|
+
"preparation": "Mix ingredients and bake at 450°F"
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
### Get Recipe Fulfillment
|
|
248
|
+
- **GET** `/api/grocy/recipes/:recipeId/fulfillment`
|
|
249
|
+
- Returns fulfillment information for a specific recipe including:
|
|
250
|
+
- Whether ingredients are in stock
|
|
251
|
+
- Missing products count
|
|
252
|
+
- Costs
|
|
253
|
+
- Calories
|
|
254
|
+
- Due score
|
|
255
|
+
|
|
256
|
+
### Get All Recipes Fulfillment
|
|
257
|
+
- **GET** `/api/grocy/recipes-fulfillment`
|
|
258
|
+
- Returns fulfillment information for all recipes including:
|
|
259
|
+
- Recipe ID
|
|
260
|
+
- Fulfillment status
|
|
261
|
+
- Missing products count
|
|
262
|
+
- Costs
|
|
263
|
+
|
|
264
|
+
### Add Not Fulfilled Products to Shopping List
|
|
265
|
+
- **POST** `/api/grocy/recipes/:recipeId/add-not-fulfilled-products-to-shoppinglist`
|
|
266
|
+
- Adds all missing ingredients for a recipe to the shopping list
|
|
267
|
+
- Returns the result of the operation
|
|
268
|
+
|
|
269
|
+
## Stock
|
|
270
|
+
|
|
271
|
+
### Get All Stock
|
|
272
|
+
- **GET** `/api/grocy/stock`
|
|
273
|
+
- Returns a list of all stock items
|
|
274
|
+
|
|
275
|
+
### Get Stock Item by ID
|
|
276
|
+
- **GET** `/api/grocy/stock/:stockId`
|
|
277
|
+
- Returns details of a specific stock item
|
|
278
|
+
|
|
279
|
+
## Chores
|
|
280
|
+
|
|
281
|
+
### Get All Chores
|
|
282
|
+
- **GET** `/api/grocy/chores`
|
|
283
|
+
- Returns a list of all chores
|
|
284
|
+
|
|
285
|
+
### Undo Chore Execution
|
|
286
|
+
- **POST** `/api/grocy/chores/executions/:executionId/undo`
|
|
287
|
+
- Undoes a chore execution
|
|
288
|
+
- Returns the result of the operation
|
|
289
|
+
|
|
290
|
+
## Batteries
|
|
291
|
+
|
|
292
|
+
### Get All Batteries
|
|
293
|
+
- **GET** `/api/grocy/batteries`
|
|
294
|
+
- Returns a list of all batteries
|
|
295
|
+
|
|
296
|
+
### Undo Battery Charge Cycle
|
|
297
|
+
- **POST** `/api/grocy/batteries/charge-cycles/:chargeCycleId/undo`
|
|
298
|
+
- Undoes a battery charge cycle
|
|
299
|
+
- Returns the result of the operation
|
|
300
|
+
|
|
301
|
+
## Tasks
|
|
302
|
+
|
|
303
|
+
### Get All Tasks
|
|
304
|
+
- **GET** `/api/grocy/tasks`
|
|
305
|
+
- Returns a list of all tasks
|
|
306
|
+
|
|
307
|
+
### Undo Task Completion
|
|
308
|
+
- **POST** `/api/grocy/tasks/:taskId/undo`
|
|
309
|
+
- Undoes a task completion
|
|
310
|
+
- Returns the result of the operation
|
|
311
|
+
|
|
312
|
+
## Generic Undo Endpoint
|
|
313
|
+
|
|
314
|
+
### Undo Action
|
|
315
|
+
- **POST** `/api/grocy/undo/:entityType/:id`
|
|
316
|
+
- Unified endpoint for undoing various actions
|
|
317
|
+
- `entityType` can be 'chores', 'batteries', or 'tasks'
|
|
318
|
+
- `id` is the ID of the execution, charge cycle, or task
|
|
319
|
+
- Returns the result of the undo operation
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
|
|
3
|
+
Instructions on how to install this project.
|
|
4
|
+
|
|
5
|
+
## Claude
|
|
6
|
+
|
|
7
|
+
Edit `claude_desktop_config.json`(for Claude Desktop) or `.cursor/mcp.json`(for Cursor):
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"mcpServers": {
|
|
12
|
+
"mcp-grocy": {
|
|
13
|
+
"command": "npx",
|
|
14
|
+
"args": [
|
|
15
|
+
"-y",
|
|
16
|
+
"miguelangel-nubla/mcp-grocy"
|
|
17
|
+
],
|
|
18
|
+
"env": {
|
|
19
|
+
"GROCY_BASE_URL": "",
|
|
20
|
+
"GROCY_APIKEY_VALUE": "",
|
|
21
|
+
"GROCY_ENABLE_SSL_VERIFY": "False",
|
|
22
|
+
"REST_RESPONSE_SIZE_LIMIT": "10000"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
Or you can use Docker:
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"mcpServers": {
|
|
32
|
+
"mcp-grocy": {
|
|
33
|
+
"command": "docker",
|
|
34
|
+
"args": [
|
|
35
|
+
"run",
|
|
36
|
+
"ghcr.io/miguelangel-nubla/mcp-grocy",
|
|
37
|
+
"tini",
|
|
38
|
+
"--",
|
|
39
|
+
"node",
|
|
40
|
+
"build/main.js"
|
|
41
|
+
],
|
|
42
|
+
"env": {
|
|
43
|
+
"GROCY_BASE_URL": "",
|
|
44
|
+
"GROCY_APIKEY_VALUE": "",
|
|
45
|
+
"GROCY_ENABLE_SSL_VERIFY": "False",
|
|
46
|
+
"REST_RESPONSE_SIZE_LIMIT": "10000"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Node.js
|
|
54
|
+
|
|
55
|
+
To install using Node.js, you will need to have Node.js and npm (or yarn) installed.
|
|
56
|
+
|
|
57
|
+
Clone the repository:
|
|
58
|
+
```bash
|
|
59
|
+
git clone -b main https://github.com/miguelangel-nubla/mcp-grocy.git
|
|
60
|
+
cd mcp-grocy
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Install dependencies:
|
|
64
|
+
```bash
|
|
65
|
+
npm install
|
|
66
|
+
# or
|
|
67
|
+
yarn install
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Then you can run the server:
|
|
71
|
+
```bash
|
|
72
|
+
npm start
|
|
73
|
+
# or
|
|
74
|
+
yarn start
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## npx
|
|
78
|
+
|
|
79
|
+
You can also run the server directly using npx (Node.js 12.x or newer):
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npx -y mcp-grocy
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Docker
|
|
86
|
+
|
|
87
|
+
To run using Docker, you first need to build the Docker image:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
docker build -t ghcr.io/miguelangel-nubla/mcp-grocy .
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Then run the container with tini:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
docker run -p mcp-grocy tini -- node build/main.js
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## HTTP/SSE Transport
|
|
100
|
+
|
|
101
|
+
The MCP Grocy API server supports the following transports:
|
|
102
|
+
|
|
103
|
+
- **stdio** (default, Context7 MCP protocol)
|
|
104
|
+
- **HTTP** (streamable, Context7-compatible, opt-in)
|
|
105
|
+
- **SSE** (Server-Sent Events, for backward compatibility)
|
|
106
|
+
|
|
107
|
+
To enable HTTP/SSE transport, set the following environment variable:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
ENABLE_HTTP_SERVER=true
|
|
111
|
+
HTTP_SERVER_PORT=8080 # (optional, default: 8080)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
- POST requests to `/mcp` for streamable HTTP (NDJSON or JSON)
|
|
115
|
+
- GET requests to `/mcp/sse` for SSE (Server-Sent Events)
|
|
116
|
+
|
|
117
|
+
All transports use the same MCP protocol and core logic.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Grocy API Response Format Documentation
|
|
2
|
+
|
|
3
|
+
The Grocy API testing tool (`test_request`) returns a comprehensive JSON response containing request details, response information, and validation results. Other specialized Grocy tools (e.g., `get_stock`, `add_shopping_list_item`) return the direct JSON response from the Grocy API, which is then stringified.
|
|
4
|
+
|
|
5
|
+
## `test_request` Tool Response Structure
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"request": {
|
|
10
|
+
"url": "https://your-own-demo.grocy.info/api/objects/products/1",
|
|
11
|
+
"method": "GET",
|
|
12
|
+
"headers": {
|
|
13
|
+
"GROCY-API-KEY": "[REDACTED]",
|
|
14
|
+
"Accept": "application/json",
|
|
15
|
+
"Content-Type": "application/json"
|
|
16
|
+
},
|
|
17
|
+
"body": null,
|
|
18
|
+
"authMethod": "apikey"
|
|
19
|
+
},
|
|
20
|
+
"response": {
|
|
21
|
+
"statusCode": 200,
|
|
22
|
+
"statusText": "OK",
|
|
23
|
+
"timing": "123ms",
|
|
24
|
+
"headers": {
|
|
25
|
+
"content-type": "application/json; charset=utf-8",
|
|
26
|
+
"date": "Mon, 01 Jul 2024 12:00:00 GMT"
|
|
27
|
+
},
|
|
28
|
+
"body": {
|
|
29
|
+
"id": "1",
|
|
30
|
+
"name": "Cookies",
|
|
31
|
+
"description": null,
|
|
32
|
+
"product_group_id": "1",
|
|
33
|
+
// ... other product fields ...
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"validation": {
|
|
37
|
+
"isError": false,
|
|
38
|
+
"messages": ["Request completed successfully"]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Setting Up Your Own Private Demo Instance
|
|
44
|
+
|
|
45
|
+
Before testing the API, you may want to set up your own private Grocy demo instance. This gives you a persistent environment for development and testing without having to install Grocy locally.
|
|
46
|
+
|
|
47
|
+
### Creating a Private Demo Instance
|
|
48
|
+
|
|
49
|
+
1. Visit [https://demo.grocy.info](https://demo.grocy.info)
|
|
50
|
+
2. At the top of the page, find the "Create a private demo instance" section
|
|
51
|
+
3. Fill in the form to create your personalized demo
|
|
52
|
+
4. Once created, you'll receive:
|
|
53
|
+
- A unique URL for your instance (e.g., `https://your-name-xxxxx.demo.grocy.info`)
|
|
54
|
+
- An API key for API access
|
|
55
|
+
- Login credentials (username/password) for web access
|
|
56
|
+
|
|
57
|
+
### Benefits of Private Demo Instances
|
|
58
|
+
|
|
59
|
+
- **Persistence**: Your data remains available for a longer period (compared to the temporary demo)
|
|
60
|
+
- **Privacy**: Only you have access to your instance
|
|
61
|
+
- **Testing**: Ideal for testing API integrations without affecting production data
|
|
62
|
+
- **No Installation**: No need to host Grocy on your own server
|
|
63
|
+
|
|
64
|
+
### Using Your Private Demo in API Requests
|
|
65
|
+
|
|
66
|
+
Configure your environment with the private demo details:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
GROCY_BASE_URL=https://your-name-xxxxx.demo.grocy.info
|
|
70
|
+
GROCY_APIKEY_VALUE=your-private-api-key
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
These values can be set in your `.env` file for local development or in your project configuration for production use.
|
|
74
|
+
|
|
75
|
+
## Response Fields for `test_request`
|
|
76
|
+
|
|
77
|
+
### Request Details (`request`)
|
|
78
|
+
- `url`: Full URL of the Grocy API endpoint called, including base URL and path.
|
|
79
|
+
- `method`: HTTP method used (e.g., GET, POST, PUT, DELETE).
|
|
80
|
+
- `headers`: Request headers sent to the Grocy API. Sensitive headers like `GROCY-API-KEY` will have their values redacted.
|
|
81
|
+
- `body`: Request body sent (if applicable, e.g., for POST/PUT requests).
|
|
82
|
+
- `authMethod`: Authentication method used. For Grocy, this will typically be `apikey` if `GROCY_APIKEY_VALUE` is configured, or `none`.
|
|
83
|
+
|
|
84
|
+
### Response Details (`response`)
|
|
85
|
+
- `statusCode`: HTTP status code returned by the Grocy API (e.g., 200, 400, 401).
|
|
86
|
+
- `statusText`: HTTP status message (e.g., "OK", "Bad Request").
|
|
87
|
+
- `timing`: Duration of the API request in milliseconds.
|
|
88
|
+
- `headers`: Response headers received from the Grocy API.
|
|
89
|
+
- `body`: Response body content from the Grocy API. This will be the JSON data returned by Grocy.
|
|
90
|
+
|
|
91
|
+
### Validation (`validation`)
|
|
92
|
+
- `isError`: Boolean, `true` if the HTTP status code is 400 or higher, indicating an error.
|
|
93
|
+
- `messages`: Array of messages, including success messages or error details.
|
|
94
|
+
- `truncated` (optional): If the response body exceeds `REST_RESPONSE_SIZE_LIMIT`, this object will contain details about the truncation.
|
|
95
|
+
- `originalSize`: The original size of the response body in bytes.
|
|
96
|
+
- `returnedSize`: The size of the truncated response body returned.
|
|
97
|
+
- `truncationPoint`: The byte offset where truncation occurred.
|
|
98
|
+
- `sizeLimit`: The configured `REST_RESPONSE_SIZE_LIMIT`.
|
|
99
|
+
|
|
100
|
+
## Specialized Grocy Tools Response Format
|
|
101
|
+
|
|
102
|
+
Tools like `get_stock`, `get_products`, `add_shopping_list_item`, etc., directly return the JSON response from the Grocy API, stringified within the MCP tool response content.
|
|
103
|
+
|
|
104
|
+
Example for `get_product` (if it existed as a specialized tool for a single product):
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"content": [
|
|
108
|
+
{
|
|
109
|
+
"type": "text",
|
|
110
|
+
"text": "{\n \"id\": \"1\",\n \"name\": \"Cookies\",\n \"description\": null,\n \"product_group_id\": \"1\",\n \"qu_id_purchase\": \"2\",\n \"qu_id_stock\": \"2\",\n \"qu_factor_purchase_to_stock\": \"1.0\",\n \"barcode\": null,\n \"min_stock_amount\": \"0\",\n \"default_best_before_days\": \"0\",\n \"default_best_before_days_after_open\": \"0\",\n \"default_best_before_days_after_freezing\": \"0\",\n \"default_best_before_days_after_thawing\": \"0\",\n \"picture_file_name\": null,\n \"allow_partial_units_in_stock\": \"0\",\n \"row_created_timestamp\": \"2023-01-01 10:00:00\",\n \"show_in_recipes_list\": \"1\",\n \"has_sub_products\": \"0\",\n \"active\": \"1\",\n \"calories\": null,\n \"cumulate_min_stock_amount_of_sub_products\": \"0\",\n \"due_type\": \"1\",\n \"quick_consume_amount\": \"1.0\",\n \"hide_on_stock_overview\": \"0\",\n \"default_stock_label_type\": \"0\",\n \"should_not_be_frozen\": \"0\",\n \"treat_opened_as_out_of_stock\": \"1\",
|
|
111
|
+
\"no_own_stock\": \"0\",
|
|
112
|
+
\"default_consume_location_id\": null,
|
|
113
|
+
\"move_on_open\": \"0\",
|
|
114
|
+
\"userfields\": null
|
|
115
|
+
}"
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
If an error occurs with a specialized tool, the response will typically look like:
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"content": [
|
|
125
|
+
{
|
|
126
|
+
"type": "text",
|
|
127
|
+
"text": "{\"error\": \"Failed to get stock: API error (401) Unauthorized - Please check your API key and permissions.\"}"
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"isError": true
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Error Response Example for `test_request`
|
|
135
|
+
|
|
136
|
+
If the `test_request` tool encounters an API error (e.g., authentication failure):
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"request": {
|
|
140
|
+
"url": "https://your-own-demo.grocy.info/api/objects/products",
|
|
141
|
+
"method": "GET",
|
|
142
|
+
"headers": {
|
|
143
|
+
"GROCY-API-KEY": "[REDACTED]"
|
|
144
|
+
},
|
|
145
|
+
"body": null,
|
|
146
|
+
"authMethod": "apikey"
|
|
147
|
+
},
|
|
148
|
+
"response": {
|
|
149
|
+
"statusCode": 401,
|
|
150
|
+
"statusText": "Unauthorized",
|
|
151
|
+
"timing": "50ms",
|
|
152
|
+
"headers": { /* ... headers ... */ },
|
|
153
|
+
"body": {
|
|
154
|
+
"error_message": "API key is missing or invalid."
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"validation": {
|
|
158
|
+
"isError": true,
|
|
159
|
+
"messages": [
|
|
160
|
+
"Request failed with status 401",
|
|
161
|
+
"API key is missing or invalid."
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|