mcp-grocy-api
Version:
Model Context Protocol (MCP) wrapper for grocy API
117 lines (93 loc) • 2.22 kB
Markdown
# Installation
Instructions on how to install this project.
## Claude
Edit `claude_desktop_config.json`(for Claude Desktop) or `.cursor/mcp.json`(for Cursor):
```json
{
"mcpServers": {
"mcp-grocy-api": {
"command": "npx",
"args": [
"-y",
"saya6k/mcp-grocy-api"
],
"env": {
"GROCY_BASE_URL": "",
"GROCY_APIKEY_VALUE": "",
"GROCY_ENABLE_SSL_VERIFY": "False",
"REST_RESPONSE_SIZE_LIMIT": "10000"
}
}
}
}
```
Or you can use Docker:
```json
{
"mcpServers": {
"mcp-grocy-api": {
"command": "docker",
"args": [
"run",
"ghcr.io/saya6k/mcp-grocy-api",
"tini",
"--",
"node",
"build/index.js"
],
"env": {
"GROCY_BASE_URL": "",
"GROCY_APIKEY_VALUE": "",
"GROCY_ENABLE_SSL_VERIFY": "False",
"REST_RESPONSE_SIZE_LIMIT": "10000"
}
}
}
}
```
## Node.js
To install using Node.js, you will need to have Node.js and npm (or yarn) installed.
Clone the repository:
```bash
git clone -b main https://github.com/saya6k/mcp-grocy-api.git
cd mcp-grocy-api
```
Install dependencies:
```bash
npm install
# or
yarn install
```
Then you can run the server:
```bash
npm start
# or
yarn start
```
## npx
You can also run the server directly using npx (Node.js 12.x or newer):
```bash
npx -y mcp-grocy-api
```
## Docker
To run using Docker, you first need to build the Docker image:
```bash
docker build -t ghcr.io/saya6k/mcp-grocy-api .
```
Then run the container with tini:
```bash
docker run -p mcp-grocy-api tini -- node build/index.js
```
## HTTP/SSE Transport
The MCP Grocy API server supports the following transports:
- **stdio** (default, Context7 MCP protocol)
- **HTTP** (streamable, Context7-compatible, opt-in)
- **SSE** (Server-Sent Events, for backward compatibility)
To enable HTTP/SSE transport, set the following environment variable:
```bash
ENABLE_HTTP_SERVER=true
HTTP_SERVER_PORT=8080 # (optional, default: 8080)
```
- POST requests to `/mcp` for streamable HTTP (NDJSON or JSON)
- GET requests to `/mcp/sse` for SSE (Server-Sent Events)
All transports use the same MCP protocol and core logic.