Skip to main content

A Click-based CLI to communicate with remote Frappe sites.

Project description

frappe-remote-cli

PyPI version Python License: MIT Tests

  ███████╗██████╗  █████╗ ██████╗ ██████╗ ███████╗     ██████╗██╗     ██╗
  ██╔════╝██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔════╝    ██╔════╝██║     ██║
  █████╗  ██████╔╝███████║██████╔╝██████╔╝█████╗      ██║     ██║     ██║
  ██╔══╝  ██╔══██╗██╔══██║██╔═══╝ ██╔═══╝ ██╔══╝      ██║     ██║     ██║
  ██║     ██║  ██║██║  ██║██║     ██║     ███████╗    ╚██████╗███████╗██║
  ╚═╝     ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝     ╚══════╝     ╚═════╝╚══════╝╚═╝

                     Frappe Remote CLI  ·  frappe-cli  ·  v0.1.7
              Query · Format · Merge · Automate — all via REST & MCP

A professional, feature-rich Python CLI and Model Context Protocol (MCP) server to query, inspect, and update remote Frappe sites directly from the terminal or your favorite AI agent.

Built with Python, Click, Requests, and Tabulate. Fully isolated, robustly tested, and developer-friendly.


Two Interfaces in One

┌─────────────────────────────────────────────────────────────────────┐
│                          frappe-cli                                 │
├──────────────────────────────┬──────────────────────────────────────┤
│   💻  TERMINAL CLI COMMANDS  │   🤖  MODEL CONTEXT PROTOCOL (MCP)   │
│                              │                                      │
│  config set/show/use/remove  │  doc_list / doc_get / doc_count      │
│  doc list/get/create/delete  │  get_schema / run_report / call_method│
│  doc count                   │  bulk_create / bulk_update / bulk_del│
│  bulk create/update/delete   │  stdio / background HTTP daemon      │
│  schema <doctype>            │  exposes all remote site tools to LLMs│
│  report <name>               │  seamless Cursor/Claude integration  │
└──────────────────────────────┴──────────────────────────────────────┘

Highlights

  • Multi-Profile Configuration Manager: Securely store connection credentials for multiple remote sites in ~/.frappe-cli.json (enforced with strict 0600 file permissions).
  • Regional Formatting Engine: Automatically formats date strings (us, french, german, plain) and float cells in terminal output tables on-the-fly.
  • Dynamic 3-Pass Schema Resolution: Fetches standard fields, splices in Custom Fields at their correct layout indices, and overrides Select dropdown choices using Property Setter data directly from the live database.
  • Sequential Client-Side Bulk Actions: Automate imports and mass deletions using JSON inline strings or @filepath references, featuring real-time spinner feedback and success tables.
  • Desk Reports in Terminal: Run server-side SQL query or script reports, zip matching columns, and output clean formatted tables.
  • Built-in PyPI Update Checker: Automatically checks for library upgrades once a day in the background, printing helpful upgrade instructions without slowing down commands.
  • Full Model Context Protocol (MCP) Server: Exposes 15 tools to AI coding agents (Claude Desktop, Cursor, etc.) via stdio or a detached HTTP/SSE background daemon.

Installation

Globally via uv (Recommended)

# Install tool globally
uv tool install frappe-remote-cli

# Verify installation
frappe-cli --help

Globally via pipx or standard pip

# Using pipx
pipx install frappe-remote-cli

# Using standard pip
pip install --user frappe-remote-cli

Local Development

To set up a local virtual environment for development or custom builds:

git clone https://github.com/vanbaopham160-clnp/frappe-remote-cli.git
cd frappe-remote-cli
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

Configuration

# Set up a new profile (prompts interactively for missing arguments)
frappe-cli config set --profile dev

# Set configuration with specific regional formatting layouts
frappe-cli config set \
  --site-url "https://my-frappe-site.com" \
  --api-key "ab12cd34ef56" \
  --api-secret "gh78ij90kl12" \
  --date-format french \
  --number-format german \
  --profile production

# List all configured profiles
frappe-cli config list

# Select default profile
frappe-cli config use staging

# Show configuration details (prints text, JSON, or YAML)
frappe-cli config show
frappe-cli config show --format json
frappe-cli config show --format yaml

# Verify remote site connection diagnostic
frappe-cli config check

# Remove a connection profile
frappe-cli config remove production

Supported Date Formats: plain (ISO default), us (MM/DD/YYYY), french (DD/MM/YYYY), german (DD.MM.YYYY)
Supported Number Formats: plain (1234567.89), us (1,234,567.89), french (1 234 567,89), german (1.234.567,89)


Usage Guide

1. Document CRUD Commands (doc)

Perform operations on individual document records. Toggle table output with --table / -t.

# List documents with filtering, field subsetting, and sorting
frappe-cli doc list Customer --fields "name,customer_name,creation" --table

# Get document count matching filters
frappe-cli doc count Customer -q '[["disabled", "=", "0"]]'

# Fetch specific document detail
frappe-cli doc get Customer CUST-0001 --table

# Create a new document record
frappe-cli doc create Customer -d '{"customer_name": "Alice", "customer_type": "Individual"}'

# Update fields on a document
frappe-cli doc update Customer CUST-0001 -d '{"phone": "+1234567890"}'

# Delete a document record
frappe-cli doc delete Customer CUST-0001

2. Client-Side Bulk Operations (bulk)

Create, update, or delete batches of documents sequentially with progress spinners.

# Bulk create from inline JSON
frappe-cli bulk create ToDo -d '[
  {"description": "Task A", "priority": "High"},
  {"description": "Task B", "priority": "Medium"}
]'

# Bulk create from a local JSON file path
frappe-cli bulk create ToDo -d @tasks.json

# Bulk update (each record must contain the 'name' field)
frappe-cli bulk update ToDo -d @updates.json

# Bulk delete by list of document names
frappe-cli bulk delete ToDo --names '["TD-0001", "TD-0002"]'

3. Server Reports Execution (report)

Execute whitelisted Frappe query or script reports.

# Run report with multiple key-value parameters and output table
frappe-cli report "Accounts Payable" \
  -p company "My Company" \
  -p report_date "2026-05-31" \
  --table

4. Live Schema Introspection (schema)

Query the live merged fields dictionary of a DocType.

# Display formatted fields schema table (standard + custom fields + property setters)
frappe-cli schema Customer --table

# Output complete raw JSON schema response
frappe-cli schema Customer --full

5. Remote RPC Execution (call)

Invoke whitelisted Python method APIs on the site:

frappe-cli call frappe.auth.get_logged_user --table
frappe-cli call my_app.api.calculate -p a 10 -p b 20

6. CLI Self-Upgrade (update)

Check for package updates and upgrade the local installation directly in place:

# Check if a new version is available on PyPI
frappe-cli update --check

# Upgrade the CLI to the latest version immediately (without confirmation prompt)
frappe-cli update --yes

Model Context Protocol (MCP) Server Setup

Bridge your Frappe sites to LLM environments seamlessly.

Stdio Transport Mode (Claude Desktop, Cursor)

Expose tools via standard input/output. Add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "frappe": {
      "command": "frappe-cli",
      "args": ["mcp", "start"]
    }
  }
}

Detached HTTP Daemon Mode

Run a persistent server in the background for remote HTTP SSE clients:

# Start background server daemon on port 8765
frappe-cli mcp start --transport http --port 8765 --detach

# Check daemon PID, port, logs, and uptime
frappe-cli mcp status

# Shut down the background process group cleanly
frappe-cli mcp stop

Daemon configuration and pid states are written to ~/.config/frappe-cli/mcp.json.


Running Tests

Run the full pytest suite (unit tests + request mocking):

# Run all tests
pytest

# Verbose test runner
pytest -v

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

frappe_remote_cli-0.1.7.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

frappe_remote_cli-0.1.7-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

Details for the file frappe_remote_cli-0.1.7.tar.gz.

File metadata

  • Download URL: frappe_remote_cli-0.1.7.tar.gz
  • Upload date:
  • Size: 30.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for frappe_remote_cli-0.1.7.tar.gz
Algorithm Hash digest
SHA256 ae7fe254fe35078d7d2fbf6d8acb2eae288b76aee80c580b516501aec257a7e7
MD5 34b1184c051fde8a61451437b0ca2511
BLAKE2b-256 25c90af32bc6c583edff1f38d3e215387371a0a2296c59e75ced203f1f59977a

See more details on using hashes here.

Provenance

The following attestation bundles were made for frappe_remote_cli-0.1.7.tar.gz:

Publisher: publish.yml on vanbaopham160-clnp/frappe-remote-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file frappe_remote_cli-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for frappe_remote_cli-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 71df38e999100eb9c3aa3868adf49e824546df52463bf5c8afc55cfce4bde426
MD5 76e6b850b97e34385513334717b050d9
BLAKE2b-256 cd7b423ee98bad3b76a293334a8cca699fc9e2bb38e3c33d0419c642a0ed8913

See more details on using hashes here.

Provenance

The following attestation bundles were made for frappe_remote_cli-0.1.7-py3-none-any.whl:

Publisher: publish.yml on vanbaopham160-clnp/frappe-remote-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page