Skip to content
←  Home 日本語

CLI & API

Overview

Mimicry ships with the mimicry CLI tool, so you can search, analyze, and generate mocks from traffic logs right in your terminal. It also exposes a REST API on port 19852, giving AI tools and automation scripts programmatic access to every feature.

Prerequisite: The CLI / REST API are available only while the Mimicry GUI app is running and the proxy is active. If the app is not running, start it with open -a Mimicry.

Setup

Install with Homebrew (recommended)

When installed with Homebrew, the CLI is added to your PATH automatically.

brew tap kusumotoa/tap
brew install --cask mimicry

When installed manually from the DMG

The CLI binary is bundled in the app. Create a symbolic link with the following command to put it on your PATH.

sudo ln -sf /Applications/Mimicry.app/Contents/Resources/mimicry /usr/local/bin/mimicry

Verify the installation

mimicry status

Command reference

CommandDescription
mimicry statusCheck proxy status and log count
mimicry domainsList captured domains and their request counts
mimicry endpoints <domain>List endpoints for a specific domain
mimicry logsList recent logs (filter with --domain, --method, --status-code, --url, --limit)
mimicry logs clearClear all logs
mimicry log <id>Show request details (add --body to show the response body)
mimicry save <path>Save logs to a .har file (filter with --domain, --url)
mimicry mockAuto-generate mock rules from traffic logs (narrow by domain with --domain)
mimicry curl <id>Output a curl command that reproduces the request
mimicry logs --watchContinuously show new logs (tail -f mode)
mimicry logs --reverseShow logs in oldest-first order
mimicry logs --count-onlyOutput the count only
mimicry logs --fields <fields>Select output fields (e.g. method,status,url)
mimicry completions <shell>Generate a shell completion script (bash / zsh / fish)
mimicry serveStart a standalone proxy server without the GUI (configure with --rules, --port, --recording)

Example: Debugging API responses

A two-step approach: get a log ID, then inspect the response details.

# Narrow down logs for the target domain to find the ID
mimicry logs --domain api.example.com --limit 10

# Check the headers and details
mimicry log abc-123-...

# Show the response body
mimicry log abc-123-... --body

Example: Auto-generating mock rules

Auto-generate mock rules from real traffic and import them into the Mimicry GUI.

# Check the domains
mimicry domains

# Generate mock rules (outputs a JSON file to the Desktop)
mimicry mock --domain api.example.com

# → Import the output file path into the Mimicry GUI to activate it

Example: Investigating endpoints

Check which endpoints your app is using.

$ mimicry endpoints api.example.com

ENDPOINT                    METHODS   REQUESTS
/user/profile               GET       15
/user/settings              POST      3
/items/list                 GET       42

Recording commands

Start, stop, replay, and modify Time Travel recordings from the CLI.

# Start recording
mimicry recording start --name "login-flow"

# Record only a specific domain
mimicry recording start --domain api.example.com

# Record with screen capture
mimicry recording start --video-device <device-id>

# List recordable devices
mimicry recording list-devices

# Stop recording
mimicry recording stop

# Check recording status
mimicry recording status

# List recordings
mimicry recording list

# Show recording details
mimicry recording show <id>

# Replay a recording
mimicry recording play <id>

# Check playback status
mimicry recording playback-status

# Stop playback
mimicry recording stop-playback

# Delete a recording
mimicry recording delete <id>

# Generate a derived recording
mimicry recording mutate <id> --rules rules.json --name "500-error"

Standalone server

Start a proxy server without the GUI. Replay from mock rules or recording files straight from the command line.

# Start a server with mock rules
mimicry serve --rules ./rules.json --port 8080

# Replay server from a recording file
mimicry serve --rules ./rules.json --recording ./recording.mimicry

# Start with automatic iOS Simulator configuration
mimicry serve --rules ./rules/ --configure-simulator --verbose

REST API

Mimicry exposes a REST API on port 19852, giving AI tools and automation scripts access to every feature.

EndpointDescription
GET /api/statusProxy status
GET /api/logsSearch traffic logs
GET /api/logs/{id}Request details
GET /api/logs/{id}/bodyResponse body
POST /api/logs/clearClear logs
GET /api/domainsList domains
GET /api/domains/{domain}/endpointsList endpoints
POST /api/saveSave logs
POST /api/mockGenerate mock rules
GET /api/recordingsList recordings
POST /api/recordingsStart recording
GET /api/recordings/statusRecording status
POST /api/recordings/current/stopStop recording
GET /api/recordings/playbackPlayback status
POST /api/recordings/playback/stopStop playback
GET /api/recordings/devicesList recordable devices
GET /api/recordings/{id}Recording details
DELETE /api/recordings/{id}Delete recording
POST /api/recordings/{id}/playPlay recording
POST /api/recordings/{id}/mutateGenerate derived recording
GET /api/recordings/{id}/videoGet recording video

--json makes the CLI output JSON as well, which is convenient for processing in pipelines.

AI tool integration

Place the following skill file at ~/.claude/skills/mimicry/SKILL.md, and Claude Code automatically calls the mimicry CLI to analyze traffic when you ask about HTTP traffic.

Requests like "find out which APIs are being called," "find requests returning 404," or "create a mock for this domain" automatically trigger the skill. Other AI coding tools can drive it the same way via the REST API / CLI.

---
name: mimicry
description: >
  Operate the Mimicry HTTP/HTTPS proxy tool via the CLI.
  Automate traffic inspection and analysis, mock rule generation, and log saving during iOS/Android app development.
  Actively use this skill for requests about HTTP traffic or proxy logs, such as
  "check the traffic in Mimicry", "find out which APIs are being called", "create a mock from the logs",
  "show me the response body", "what are the endpoints for this domain?", "investigate requests returning 404", and so on.
  Apply it to investigation requests about an app's traffic, API responses, and network logs
  even when the user does not explicitly say "Mimicry".
user-invocable: false
---

# Mimicry CLI Guide

Mimicry is a proxy tool that captures HTTP/HTTPS traffic while an app is running.
Using the CLI (`mimicry`), you can automate traffic inspection, log search, and mock generation without touching the GUI.

**Prerequisite**: The Mimicry GUI app must already be running.
If it is not running, prompt to start it with `open -a Mimicry` before proceeding.

## Command reference

```bash
# Status & overview
mimicry status                              # Check proxy status and log count
mimicry domains                             # List captured domains
mimicry endpoints <domain>                  # List endpoints for a specific domain

# Log search
mimicry logs                                # List the 50 most recent entries
mimicry logs --domain <domain>              # Filter by domain
mimicry logs --method POST --limit 20       # Filter by HTTP method
mimicry logs --status-code 404              # Filter by status code
mimicry logs --url "*/users/*"              # Filter by URL pattern (glob)
mimicry logs clear                          # Clear all logs

# Inspect details (use an ID from logs)
mimicry log <id>                            # Request/response headers and details
mimicry log <id> --body                     # Show the response body

# Save & generate mocks
mimicry save <output-path>.har              # Save logs to a .har file
mimicry save <output-path>.har --domain <domain>
mimicry mock                                # Generate mock rules from all logs
mimicry mock --domain <domain>              # Generate mock rules for one domain

# Generate a curl command
mimicry curl <id>                           # Output a curl command that reproduces the request

# Extra log options
mimicry logs --watch                        # Tail new logs (tail -f mode)
mimicry logs --reverse                      # Show in oldest-first order
mimicry logs --count-only                   # Output the count only
mimicry logs --fields method,status,url     # Select output fields

# Extra recording commands
mimicry recording list-devices              # List recordable devices
mimicry recording start --video-device <id> # Record with screen capture
mimicry recording status                    # Check recording status
mimicry recording show <id>                 # Recording details
mimicry recording delete <id>               # Delete a recording
mimicry recording playback-status           # Check playback status

# Shell completion
mimicry completions <shell>                 # Generate a shell completion script (bash/zsh/fish)

# Standalone server
mimicry serve --rules <file> [options]      # Start a proxy server without the GUI
```

## Workflows by goal

### Get an overview of all traffic

```bash
mimicry status
mimicry domains
mimicry endpoints <domain>
```

### Inspect an API response

```bash
mimicry logs --domain <domain> --limit 10
mimicry log <id>
mimicry log <id> --body
```

### Track down errors

```bash
mimicry logs --status-code 500
mimicry logs --url "*/auth/*" --status-code 401
```

### Create a mock for testing

```bash
mimicry mock --domain <domain>
# → Import the generated file into the Mimicry GUI
```

## Troubleshooting

| Symptom | Fix |
|------|------|
| Cannot connect to Mimicry app. | Start it with `open -a Mimicry` |
| No logs (0 entries) | Interact with the app, then retry |
| The specified ID is not found | Check the latest ID with `mimicry logs` |