Rohlik MCP Proxy

Rohlik MCP Proxy

Enables interaction with the Rohlik grocery delivery service through MCP by proxying requests with automatic authentication header injection.

Category
访问服务器

README

Rohlik MCP Proxy Server

A Docker-based proxy MCP (Model Context Protocol) server for the Rohlik MCP service that forwards requests to https://mcp.rohlik.cz/mcp while automatically injecting authentication headers from a base64url token in the URL path (or optional env fallback).

Features

  • Transparent Proxying: Forwards MCP protocol messages between clients and the Rohlik MCP server
  • Authentication Injection: Automatically injects rhl-email and rhl-pass headers from a base64url path token (env fallback optional)
  • SSE/Streaming Support: Streams GET responses for real-time MCP sessions
  • Docker-based: Easy deployment with Docker and Docker Compose
  • Health Monitoring: Built-in health check endpoint
  • CORS Enabled: Allows browser-based and desktop MCP clients to connect

Prerequisites

  • Docker and Docker Compose installed
  • Rohlik account credentials (email and password)

Quick Start

1. Generate a base64url token

Create a base64url-encoded token for email:password:

python - <<'PY'
import base64
print(base64.urlsafe_b64encode(b"email@gmail.com:password").decode())
PY

2. Build and Run with Docker Compose

Note: docker-compose.yml expects an external network named cloudflare. Create it with docker network create cloudflare or remove the networks section if you don't need it.

# Build and start the proxy server
docker-compose up -d

# View logs
docker-compose logs -f rohlik-mcp-proxy

# Stop the server
docker-compose down

The proxy server will be available at:

  • MCP Endpoint: http://localhost:8000/mcp/<base64url-token>
  • Health Check: http://localhost:8000/health
  • Info: http://localhost:8000/

3. Alternative: Run with Docker

# Build the image
docker build -t rohlik-mcp-proxy .

# Run the container
docker run -d \
  --name rohlik-mcp-proxy \
  -p 8000:8000 \
  rohlik-mcp-proxy

# View logs
docker logs -f rohlik-mcp-proxy

# Stop the container
docker stop rohlik-mcp-proxy
docker rm rohlik-mcp-proxy

Configuration

Environment Variables

Variable Required Default Description
RHL_EMAIL No - Optional fallback email (used when no path token is provided)
RHL_PASS No - Optional fallback password (used when no path token is provided)
ROHLIK_MCP_URL No https://mcp.rohlik.cz/mcp Rohlik MCP backend endpoint

Base64url Path Token

The proxy expects a URL path like /mcp/<base64url(email:password)>. Padding (=) is optional. If you set RHL_EMAIL and RHL_PASS, you can also use /mcp without a token.

MCP Client Configuration

Configure your MCP client (e.g., Claude Desktop, ChatGPT) to connect to the proxy. Use the base64url token in the URL path:

{
  "mcpServers": {
    "rohlik": {
      "url": "http://localhost:8000/mcp/<base64url-token>",
      "transport": "streamable-http"
    }
  }
}

Or for fastmcp client:

Or using MCP Inspector:

npx @modelcontextprotocol/inspector http://localhost:8000/mcp/<base64url-token>

Development

Local Development (Without Docker)

# Install uv package manager
pip install uv

# Install dependencies
uv pip install -e .

# Run the proxy server
python proxy_server.py

Project Structure

rohlik-mcp-proxy/
├── proxy_server.py       # Main proxy server implementation
├── pyproject.toml        # Python project configuration
├── Dockerfile            # Docker image definition
├── docker-compose.yml    # Docker Compose configuration
├── .env.example          # Environment variables template
├── .gitignore           # Git ignore rules
└── README.md            # This file

How It Works

  1. Client Connection: MCP client connects to the proxy at /mcp/<base64url-token> (GET for streaming, POST for calls)
  2. Request Forwarding: Proxy receives MCP requests from the client
  3. Header Injection: Proxy decodes the path token and adds authentication headers (rhl-email, rhl-pass)
  4. Backend Communication: Proxy forwards the authenticated request to Rohlik MCP server
  5. Response Handling: Proxy streams GET responses and returns POST/other responses
  6. Bidirectional Flow: Process repeats for all subsequent requests
┌─────────────┐         ┌──────────────────┐         ┌─────────────────┐
│             │         │                  │         │                 │
│ MCP Client  │ <-----> │  Rohlik Proxy    │ <-----> │ Rohlik MCP      │
│             │  HTTP   │  (adds headers)  │  HTTPS  │ Backend Server  │
│             │         │                  │         │                 │
└─────────────┘         └──────────────────┘         └─────────────────┘
                        Port 8000                    mcp.rohlik.cz

Health Check

The proxy includes a built-in health check endpoint:

curl http://localhost:8000/health
# Returns: OK

Docker Compose automatically monitors this endpoint and restarts the container if it becomes unhealthy.

Security Considerations

  • Credentials Storage: Never commit your .env file with real credentials to version control
  • Network Security: For production use, consider running the proxy behind a reverse proxy with HTTPS
  • Access Control: No additional authentication is enforced by the proxy; restrict access at the network or reverse proxy level
  • Password Safety: Credentials are passed via URL path and HTTP headers (ensure HTTPS and avoid logging full URLs in production)

Troubleshooting

Container won't start

# Check logs
docker-compose logs rohlik-mcp-proxy

# Common issues:
# - Port 8000 already in use
# - Invalid or missing base64 token in the URL path

Connection refused

# Verify the container is running
docker-compose ps

# Check if port is accessible
curl http://localhost:8000/health

Rohlik authentication errors

# Verify your base64url token decodes to email:password
python - <<'PY'
import base64
print(base64.urlsafe_b64decode(b"<base64url-token>").decode())
PY

License

This project is provided as-is for integration with the Rohlik MCP service.

Related Documentation

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选