A Click-based CLI to communicate with remote Frappe sites.
Project description
Frappe Remote CLI Tool
A Python command-line utility built with Click and Requests to communicate with a remote Frappe site (v15).
Features
- Local Configuration: Securely store connection URLs and API credentials locally in
~/.frappe-cli.json(permissions enforced at0600). Supports multiple site profiles. - Regional Formatting: Output dates and numbers in locale-specific formats — US, French, German, or plain ISO.
- Interactive Prompts: Prompts you for configuration parameters when setting up connection configs if options are omitted.
- SSL Verification Control: Bypass SSL certificate validation using the
--no-verifyoption for local or development environments. - Remote RPC Executions: Call any remote whitelisted Python methods on the site via
frappe.call. - REST DocType CRUD: Query, fetch, insert, update, or delete DocType records using clean subcommand interfaces.
- Document Count: Count documents matching any filter set without fetching all records.
- Bulk Operations: Create, update, or delete multiple documents in a single command call with a progress summary table.
- Metadata Listings: List all available DocTypes or Reports visible to the current user.
- Report Execution: Run Frappe query or script reports by name with optional filter parameters.
- Dynamic Schema Resolution: Fetch the fully merged field schema for any DocType — base fields, custom fields, and property setter overrides — in a single command.
- MCP Server: Expose all CLI operations as native Model Context Protocol (MCP) tools for AI agent integration — via stdio or a detached HTTP daemon.
- Rich Formatting: Display API responses in raw JSON format by default (ideal for scripting/piping), with an optional
-t/--tabletoggle flag to print formatted human-readable ASCII tables. - Robust Exception Handling: Clean terminal error formatting without raw stack traces.
Installation
Ensure you have Python 3.10+ installed.
Global Installation (Recommended)
The easiest way to run the CLI globally is using uv or pipx:
# Install with uv
uv tool install frappe-remote-cli
# Or install with pipx
pipx install frappe-remote-cli
Alternatively, you can install it using standard pip:
pip install frappe-remote-cli
For Local Development
If you want to modify or contribute to the codebase:
- Clone this repository.
- Initialize virtual environment and install dependencies in editable mode:
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
Usage
Verify the CLI is registered in your path:
frappe-cli --help
Global Options
You can specify these options before any subcommand:
--profile <name>: Run the command against a specific profile configuration.--no-verify: Disable SSL certificate verification (useful for self-signed certificates).
1. Configuration Setup
# Set connection parameters (prompts interactively for missing arguments)
frappe-cli config set \
--site-url "https://my-frappe-site.com" \
--api-key "ab12cd34ef56" \
--api-secret "gh78ij90kl12" \
--profile production
# Set connection with regional formatting preferences
frappe-cli config set \
--site-url "https://my-frappe-site.com" \
--api-key "ab12cd34ef56" \
--api-secret "gh78ij90kl12" \
--date-format french \
--number-format german
# List all configured profiles
frappe-cli config list
# Switch default profile
frappe-cli config use staging
# Inspect active profile (text, json, or yaml output)
frappe-cli config show
frappe-cli config show --format json
frappe-cli config show --format yaml
# Remove a profile
frappe-cli config remove staging
# Run connection diagnostic for active profile
frappe-cli config check
Supported format values: plain (ISO default), us, french, german
2. Method Execution (call)
Trigger any remote method decorated with @frappe.whitelist():
# Check logged-in user
frappe-cli call frappe.auth.get_logged_user
# Execute method with key-value parameters
frappe-cli call my_app.api.add -p a 10 -p b 20
# Format output as table instead of default JSON
frappe-cli call frappe.auth.get_logged_user --table
3. Document CRUD (doc)
List records:
frappe-cli doc list Customer --fields "name,customer_name,creation" --table
Count records:
# Count all customers
frappe-cli doc count Customer
# Count with filters
frappe-cli doc count Customer -q '[["disabled","=","0"]]'
Get record:
frappe-cli doc get Customer CUST-0001 --table
Create record:
frappe-cli doc create Customer -d '{"customer_name": "Alice", "customer_type": "Individual"}'
Update record:
frappe-cli doc update Customer CUST-0001 -d '{"phone": "+1234567890"}'
Delete record:
frappe-cli doc delete Customer CUST-0001
4. Bulk Operations (bulk)
Operate on multiple documents in a single call. Results are displayed as a summary table with per-record status.
# Bulk create from a JSON array
frappe-cli bulk create Customer -d '[
{"customer_name": "Alice", "customer_type": "Individual"},
{"customer_name": "Bob", "customer_type": "Company"}
]'
# Bulk create from a JSON file
frappe-cli bulk create Customer -d @customers.json
# Bulk update (each record must include 'name')
frappe-cli bulk update Customer -d '[
{"name": "CUST-0001", "phone": "123"},
{"name": "CUST-0002", "phone": "456"}
]'
# Bulk delete by name list
frappe-cli bulk delete Customer -n '["CUST-0001", "CUST-0002"]'
frappe-cli bulk delete Customer -n @names.json
5. Metadata (meta)
# List all DocTypes
frappe-cli meta doctypes --table
# List with filters
frappe-cli meta doctypes -q '[["module","=","Selling"]]' --table
# List all Reports
frappe-cli meta reports --table
6. Report Execution (report)
# Run a report (JSON output by default)
frappe-cli report "General Ledger"
# Run with filters and show as table
frappe-cli report "Sales Order Summary" -p company "My Company" --table
# Multiple filter parameters
frappe-cli report "Accounts Payable" \
-p company "My Company" \
-p report_date "2024-12-31" \
--table
7. Schema Resolution (schema)
Fetch the merged schema for a DocType — base fields, custom fields (injected at their correct positions), and Property Setter overrides (e.g. Select option changes) — all in one command.
# Compact view (default): key field attributes only
frappe-cli schema Customer --table
# Full view: all field attributes
frappe-cli schema Customer --full --table
# JSON output for scripting
frappe-cli schema Customer
8. MCP Server
Expose all CLI operations as Model Context Protocol tools for use with AI assistants (e.g. Claude Desktop, Cursor, etc.).
Available MCP Tools (15):
doc_list, doc_get, doc_create, doc_update, doc_delete, doc_count, call, meta_doctypes, meta_reports, run_report, get_schema, bulk_create, bulk_update, bulk_delete, check_connection
Stdio transport (for AI agent integration):
# Start MCP server on stdio (blocking — used by AI assistants directly)
frappe-cli mcp start
frappe-cli mcp start --transport stdio
Example MCP config for Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"frappe": {
"command": "frappe-cli",
"args": ["mcp", "start"]
}
}
}
HTTP daemon transport:
# Start as a background HTTP daemon (port 8765 by default)
frappe-cli mcp start --transport http --detach
# Check daemon status
frappe-cli mcp status
# Stop the daemon
frappe-cli mcp stop
Daemon state is persisted to ~/.config/frappe-cli/mcp.json.
Running Tests
Run the full test suite (unit + integration):
pytest
# Unit tests only
pytest tests/unit/
# With verbose output
pytest -v
Configuration File Format
The config file is stored at ~/.frappe-cli.json:
{
"default_profile": "production",
"profiles": {
"production": {
"site_url": "https://my-frappe-site.com",
"api_key": "...",
"api_secret": "...",
"verify": true,
"date_format": "french",
"number_format": "german"
},
"staging": {
"site_url": "https://staging.my-frappe-site.com",
"api_key": "...",
"api_secret": "...",
"verify": false
}
}
}
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file frappe_remote_cli-0.1.6.tar.gz.
File metadata
- Download URL: frappe_remote_cli-0.1.6.tar.gz
- Upload date:
- Size: 28.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
205d449779168c18a92391e6f250b7cedb93643924943a4dfd66c34fb287b001
|
|
| MD5 |
517a6e813a8ce5ff965f8c6bc404f364
|
|
| BLAKE2b-256 |
1f49c98b0d159a1e7ec75662a61a11944eda06e4aadf39b65f409dcb175bde22
|
Provenance
The following attestation bundles were made for frappe_remote_cli-0.1.6.tar.gz:
Publisher:
publish.yml on vanbaopham160-clnp/frappe-remote-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
frappe_remote_cli-0.1.6.tar.gz -
Subject digest:
205d449779168c18a92391e6f250b7cedb93643924943a4dfd66c34fb287b001 - Sigstore transparency entry: 1663824321
- Sigstore integration time:
-
Permalink:
vanbaopham160-clnp/frappe-remote-cli@825072b8a51253dd81ae72ee352573ac9f6eda3c -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/vanbaopham160-clnp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@825072b8a51253dd81ae72ee352573ac9f6eda3c -
Trigger Event:
release
-
Statement type:
File details
Details for the file frappe_remote_cli-0.1.6-py3-none-any.whl.
File metadata
- Download URL: frappe_remote_cli-0.1.6-py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d992df12247eb78ef01018c87b85e52276c88d87280361607c1b6917de9d74a
|
|
| MD5 |
c9c365ce95095301436a57d73a5f8333
|
|
| BLAKE2b-256 |
b017c97ad198782b781638a394a58930d5e96623f1c6d171dd1bf4e20c7714f8
|
Provenance
The following attestation bundles were made for frappe_remote_cli-0.1.6-py3-none-any.whl:
Publisher:
publish.yml on vanbaopham160-clnp/frappe-remote-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
frappe_remote_cli-0.1.6-py3-none-any.whl -
Subject digest:
1d992df12247eb78ef01018c87b85e52276c88d87280361607c1b6917de9d74a - Sigstore transparency entry: 1663824603
- Sigstore integration time:
-
Permalink:
vanbaopham160-clnp/frappe-remote-cli@825072b8a51253dd81ae72ee352573ac9f6eda3c -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/vanbaopham160-clnp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@825072b8a51253dd81ae72ee352573ac9f6eda3c -
Trigger Event:
release
-
Statement type: