cocktail-recipes-mcp
A Dockerized Python MCP server that provides tools to manage cocktail recipes, ingredients, and related operations via the Aephir/cocktail-recipes REST API, with dry-run safety defaults and automatic re-authentication.
README
cocktail-recipes-mcp
Dockerized Python 3.11 MCP server for the Aephir/cocktail-recipes REST API.
This server is designed for Claude Desktop and other MCP clients. It authenticates against the cocktail app via session-cookie login (POST /api/auth/login) and uses REST-only calls.
Features
- Python 3.11 MCP server with typed models and validation
- Session-cookie auth with automatic re-login on
401 - Safe retries for idempotent calls (read-only and dry-run operations)
- No blind retries for non-idempotent apply calls
- Dry-run safety defaults for destructive tools
- Structured response and error schema
- Capability probing tool for backend endpoint readiness
- Operation log tool for recent MCP actions
Implemented Tools
list_recipesget_recipecreate_recipe(defaultsdry_run=true)update_recipe(defaultsdry_run=true)delete_recipe(defaultsdry_run=true)list_ingredientslist_toolsmerge_ingredients(dry_run=truedefault)merge_tools(dry_run=truedefault)recategorize_recipes(dry_run=truedefault)update_tags_bulk(dry_run=truedefault)operation_log_recentapi_capabilities
Safety Behavior
All destructive tools default to dry_run=true (create/update/delete/merge/recategorize/tag bulk).
To apply, pass explicit dry_run=false.
Each destructive tool returns:
- preview (
affectedIDs and count) apply_executedboolean- backend result payload
If backend admin endpoints are not available yet, tool responses return structured not_implemented with an actionable message.
Required Environment Variables
COCKTAIL_API_BASE_URLCOCKTAIL_API_USERNAMECOCKTAIL_API_PASSWORD
Optional variables are in .env.example.
Transport Modes
stdio(default in.env.example): process-local MCP over stdin/stdout, no published port.streamable-http: network-reachable MCP over HTTP, requires a published port or reverse proxy.
For Claude running on a different machine, use streamable-http.
Local Run
- Create env file:
cp .env.example .env
- Install dependencies and run:
python3.11 -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -e .[test]
python -m cocktail_recipes_mcp.main
Docker Run
Build image:
docker build -t cocktail-recipes-mcp:latest .
Run container:
docker run --rm -i --env-file .env cocktail-recipes-mcp:latest
Compose example:
docker compose up --build cocktail-recipes-mcp
Note: docker-compose.yml reads values from environment variables. For local CLI usage, export them or place them in a local .env file before running docker compose.
For remote clients, set MCP_TRANSPORT=streamable-http and publish MCP_HTTP_PUBLISH_PORT.
Portainer Deployment (Recommended)
Use this when you run both the cocktail app and this MCP server as containers.
- Deploy both services on the same Docker network.
- Set MCP environment variables in Portainer for the MCP service:
COCKTAIL_API_BASE_URLCOCKTAIL_API_USERNAMECOCKTAIL_API_PASSWORD
MCP_TRANSPORT=streamable-httpMCP_HTTP_HOST=0.0.0.0MCP_HTTP_PORT=8000MCP_HTTP_PATH=/mcpMCP_HTTP_PUBLISH_PORT=8000(or another host port)
- Use internal service URL for
COCKTAIL_API_BASE_URLwhen possible, for example:http://cocktail-app:3000
- Start the cocktail app first, then start the MCP service.
- In Claude, call
api_capabilitiesandlist_recipesto validate connectivity.
Portainer Error: .env not found
If you saw an error like env file /data/compose/<id>/.env not found, the stack was expecting a physical .env file inside Portainer's compose directory.
This repo now avoids that requirement by reading COCKTAIL_API_* from stack environment variables directly.
In Portainer Stack deployment:
- Add these variables in the Stack
Environment variablesUI:COCKTAIL_API_BASE_URLCOCKTAIL_API_USERNAMECOCKTAIL_API_PASSWORD
- Redeploy the stack.
Your example values are valid for this setup.
Portainer Error: pull access denied for cocktail-recipes-mcp
This happens when Portainer tries to pull cocktail-recipes-mcp:latest from a registry.
This project is intended to build from source in the stack, not pull from Docker Hub.
Resolution:
- Use the current compose file from this repo (it uses
buildandpull_policy: never). - In Portainer stack deployment, disable any "pull latest image" behavior for this stack.
- Redeploy the stack so the image is built locally on the Docker host.
FQDN vs Internal URL
- If MCP and cocktail app are in the same Docker network, prefer internal URL (
http://service-name:port). - If MCP is outside that network, use a reachable external URL/FQDN (for example
https://cocktails.example.com).
For MCP client access:
- Same LAN/VPN:
http://<host-ip>:<published-port><MCP_HTTP_PATH> - Internet-facing: put SWAG/Nginx in front and use
https://<fqdn><MCP_HTTP_PATH>
Example Portainer Stack Snippet
services:
cocktail-recipes-mcp:
image: cocktail-recipes-mcp:latest
build:
context: .
dockerfile: Dockerfile
environment:
COCKTAIL_API_BASE_URL: http://cocktail-app:3000
COCKTAIL_API_USERNAME: admin
COCKTAIL_API_PASSWORD: change-me
MCP_TRANSPORT: streamable-http
MCP_HTTP_HOST: 0.0.0.0
MCP_HTTP_PORT: 8000
MCP_HTTP_PATH: /mcp
ports:
- "8000:8000"
restart: unless-stopped
stdin_open: true
tty: true
networks:
- cocktail_net
networks:
cocktail_net:
external: true
Go-Live Checklist
- MCP and app containers share a network.
- MCP env vars are set in Portainer.
- Login endpoint is reachable from MCP (
POST /api/auth/login). api_capabilitiessucceeds.list_recipessucceeds.- For admin operations, run
dry_run=truefirst and apply only withdry_run=false.
Claude Desktop Connection
Add an MCP server entry to your Claude Desktop config.
Local Python command
{
"mcpServers": {
"cocktail-recipes": {
"command": "/absolute/path/to/cocktail-recipes-mcp/.venv/bin/python",
"args": ["-m", "cocktail_recipes_mcp.main"],
"env": {
"COCKTAIL_API_BASE_URL": "http://localhost:3000",
"COCKTAIL_API_USERNAME": "admin",
"COCKTAIL_API_PASSWORD": "change-me"
}
}
}
}
Docker command
{
"mcpServers": {
"cocktail-recipes": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--env-file",
"/absolute/path/to/cocktail-recipes-mcp/.env",
"cocktail-recipes-mcp:latest"
]
}
}
}
Remote HTTP MCP (different machine)
When running in Portainer with MCP_TRANSPORT=streamable-http, use your reachable URL:
- Direct host/port example:
http://10.0.30.51:8000/mcp - SWAG/FQDN example:
https://mcp.example.com/mcp
If your Claude client supports URL-based MCP servers, register this URL there.
Tests
Run minimal tests:
pytest
Example Transcript
See docs/example_transcripts.md for a dry_run/apply merge example (Cucumber vs cucumber).
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。