Logpush MCP
MCP server for reading Cloudflare Workers logpush data from R2 buckets.
Features
- List available log dates by environment (production/staging)
- Browse and read individual log files
- Search logs with filters (worker, status code, outcome, text)
- Get aggregated statistics
- Quick access to errors and exceptions
- Get latest logs with one command
Installation
# Using uv (recommended)
uv pip install -e .
# Or with pip
pip install -e .
Configuration
Set these environment variables (or create a .env file):
R2_ACCOUNT_ID=your_account_id
R2_ACCESS_KEY_ID=your_access_key_id
R2_SECRET_ACCESS_KEY=your_secret_access_key
R2_BUCKET_NAME=your-bucket-name
Get R2 API credentials from: Cloudflare Dashboard > R2 > Manage R2 API Tokens
Usage
Run locally
uv run logpush-mcp
Claude Desktop Configuration
Add to your Claude Desktop config (~/.config/claude/claude_desktop_config.json):
{
"mcpServers": {
"logpush": {
"command": "uv",
"args": ["run", "logpush-mcp"],
"cwd": "/path/to/arross-cf-mcp",
"env": {
"R2_ACCOUNT_ID": "your_account_id",
"R2_ACCESS_KEY_ID": "your_access_key_id",
"R2_SECRET_ACCESS_KEY": "your_secret_access_key",
"R2_BUCKET_NAME": "your-bucket-name"
}
}
}
}
MCP Tools
list_log_dates
List available date folders in the bucket.
environment: production, staging, or omit for alllimit: max dates to return (default 30)
list_log_files
List log files for a specific date.
date: YYYYMMDD formatenvironment: production or staginglimit: max files (default 50)cursor: pagination token
read_log_file
Read contents of a specific log file.
path: full object keylimit: max entries (default 100)
search_logs
Search logs with filters.
date: YYYYMMDD formatenvironment: production or stagingscript_name: filter by worker namestatus_code: exact status codestatus_gte: status >= value (e.g., 400)status_lt: status < valueoutcome: "ok" or "exception"search_text: search in URL and log messageslimit: max entries (default 50)
get_log_stats
Get aggregated statistics for a date.
date: YYYYMMDD formatenvironment: production or staging
get_errors
Get error logs and exceptions.
date: YYYYMMDD formatenvironment: production or stagingscript_name: optional filterlimit: max entries (default 50)
get_latest
Get the most recent log entries.
environment: production or stagingscript_name: optional filterlimit: max entries (default 50)
Log Structure
Expects Cloudflare Workers Trace Events logpush format:
bucket/
├── production/YYYYMMDD/*.log.gz
└── staging/YYYYMMDD/*.log.gz
Files are NDJSON with Cloudflare's workers_trace_events schema.
Deployment to FastMCP Cloud
Step 1: Sign up at FastMCP Cloud
- Go to fastmcp.cloud
- Sign in with your GitHub account
Step 2: Create a new project
- Click "Create Project"
- Select this repository (
logpush-mcp) - FastMCP will auto-detect the
pyproject.tomlentry point
Step 3: Configure environment variables
In the FastMCP Cloud dashboard, add these environment variables:
| Variable | Description |
|---|---|
R2_ACCOUNT_ID | Your Cloudflare account ID |
R2_ACCESS_KEY_ID | R2 API token access key ID |
R2_SECRET_ACCESS_KEY | R2 API token secret access key |
R2_BUCKET_NAME | Name of your logpush R2 bucket |
Step 4: Deploy
Click "Deploy" - FastMCP handles the rest automatically.
Step 5: Connect to your MCP client
FastMCP Cloud provides a URL like https://your-project.fastmcp.cloud/mcp
For Claude Desktop, add to your config:
{
"mcpServers": {
"logpush": {
"command": "npx",
"args": ["mcp-remote", "https://your-project.fastmcp.cloud/mcp"]
}
}
}
Getting R2 API Credentials
- Go to Cloudflare Dashboard → R2 → Manage R2 API Tokens
- Create a new API token with:
- Permissions: Object Read & Write
- Scope: Specific bucket (your logpush bucket)
- Copy the Access Key ID and Secret Access Key
License
MIT
