Read-only CLI for querying MarkLogic Server via REST API
Project description
marklogic-tool
A read-only command-line tool for querying MarkLogic Server over its REST API.
Invoked as marklogic-tool, it is built for exploring databases, servers, and
hosts, retrieving documents, running ad-hoc XQuery/JavaScript, and debugging
deployments — without touching a full deployment toolchain.
marklogic-tool is intended for exploration, debugging, and lightweight administration. It is not a data-loading, deployment, or CI/CD tool.
Installation
pip install marklogic-tool
This installs the marklogic-tool console script. Python 3.13+ is required.
Quick Start
marklogic-tool db list # list all databases
marklogic-tool server list # list all app servers
marklogic-tool host list # list cluster hosts
marklogic-tool doc get /path/doc.xml # retrieve a document
marklogic-tool search -d my-database "term" # search documents in a database
marklogic-tool eval "xdmp:hosts()" # run an XQuery expression
marklogic-tool eval -j "xdmp.hosts()" # run a JavaScript expression
marklogic-tool config list # show available connection profiles
Argument ordering
For search and eval, options must come before the positional argument
(the query or code). Options placed after the positional argument are
interpreted as subcommands and will fail:
marklogic-tool search -d MyDB -n 5 "term" # correct
marklogic-tool eval -d MyDB "xdmp:hosts()" # correct
marklogic-tool search "term" -n 5 # wrong — '-n' is read as a command
Commands
Discovery
marklogic-tool db list # list databases
marklogic-tool db show <name> # forests, indices, settings
marklogic-tool server list # list app servers
marklogic-tool server show <name> # port, root, modules, auth type
marklogic-tool host list # list hosts
marklogic-tool host show [<name>] # host details
marklogic-tool group list # list groups
marklogic-tool group show <name> # group details
Documents
marklogic-tool doc get <uri> [-d database] [-f xml|json|text|binary] [--metadata]
marklogic-tool search [-d database] [-c collection] [-n pageLength] <query>
Always pass -d <database> to search — the default database is typically
empty.
Code execution
marklogic-tool eval "<code>" # XQuery (default)
marklogic-tool eval -j "<code>" # JavaScript
marklogic-tool eval -f script.xqy # read code from a file
marklogic-tool eval -d my-database "<code>" # target a specific database
marklogic-tool eval --vars '{"x":1}' "<code>" # pass external variables
eval defaults to the App-Services database, so pass -d <database> when you
need to run against a specific content database.
Configuration
Connection settings are resolved from layered sources, in order of increasing precedence:
- TOML config profiles — the base layer
- Environment variables — override individual profile values
- CLI flags — override per invocation (highest precedence)
Config file and profiles
Profiles live in a TOML file at ~/.config/marklogic-tool/config.toml. Copy the
bundled config.example.toml to that location and edit it:
default_profile = "local"
[profiles.local]
host = "localhost"
port = 8000
manage_port = 8002
username = "admin"
password = "admin"
auth_method = "digest"
timeout = 30
default_group = "Default"
# [profiles.staging]
# host = "ml-staging.example.com"
# port = 8000
# username = "reader"
# password = "change-me"
# auth_method = "digest"
Select a profile per command with -P / --profile (accepted at any position):
marklogic-tool -P staging db list
marklogic-tool config list # list all configured profiles
marklogic-tool config show # show the active profile's details
Environment variables
| Variable | Overrides |
|---|---|
MARKLOGIC_CONFIG |
Path to the config file (overrides the default above) |
ML_PROFILE |
Profile name (overrides default_profile) |
ML_HOST |
Host |
ML_PORT |
Port |
ML_USERNAME |
Username |
ML_PASSWORD |
Password |
Global options
| Flag | Purpose |
|---|---|
-P, --profile |
Select a connection profile |
-o, --output |
Output format: json, table, or raw |
-v, --verbose |
Enable debug logging |
-q, --quiet |
Suppress warning messages |
-V, --version |
Print the version and exit |
Output auto-detects when -o is omitted: table for an interactive terminal,
json when piped.
Telemetry
marklogic-tool sends anonymous error and performance data to a hosted Sentry project by default, which helps surface crashes and regressions. No document content or credentials are collected.
To opt out, set the MARKLOGIC_TOOL_DISABLE_TELEMETRY environment variable to a
truthy value (1, true, or yes):
export MARKLOGIC_TOOL_DISABLE_TELEMETRY=1
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
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 marklogic_tool-0.0.1.tar.gz.
File metadata
- Download URL: marklogic_tool-0.0.1.tar.gz
- Upload date:
- Size: 65.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ceddc97974fccd97d792831f6c3670740f083a1e9752901ba9c85a098113d400
|
|
| MD5 |
94dfe07f85df661c7ef8226675b08ebb
|
|
| BLAKE2b-256 |
04f7158816dcbf835a584d2b6fa488b9635da68edb1bfd1aab08fa07d608b943
|
File details
Details for the file marklogic_tool-0.0.1-py3-none-any.whl.
File metadata
- Download URL: marklogic_tool-0.0.1-py3-none-any.whl
- Upload date:
- Size: 28.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c540a59207586bae253c8e99a6d1a934daa722cfd5ea25cfb2872c28b4a95f2e
|
|
| MD5 |
c855fdd7d2b17e33f535ef907a58c20c
|
|
| BLAKE2b-256 |
9e2fd6acafeb52c832442643597476e1cf2a63e4a41fd6799617024f42dfc62f
|