discord-cli
Headless, JSON-first Discord CLI for AI agents, shell scripts, cron jobs, and CI/CD.
Current release: 1.9.0 (PyPI)
64 commands across 13 groups — manage channels, categories, roles, permissions, members, messages, threads, webhooks, invites, search, and JSON/CSV exports from one command-line binary. No long-running bot daemon. No MCP tool-schema context bloat.
Why discord-cli?
- Built for AI coding agents without MCP overhead — ships with a prompt-injection-hardened
skills.shskill for Claude Code, Codex, Cursor, and GitHub Copilot. Load instructions on demand instead of injecting dozens of tool schemas into every turn. - JSON-first by default, human tables on demand — every command returns
{"ok": true, "data": ...}(or{"ok": false, "error": {...}}with exit code1) for cleanjqpipelines and agent parsing. Add--humanfor Rich terminal tables. - Headless & fire-and-exit — authenticates with a Discord bot token, executes one command, prints the payload, and exits. Drop it straight into GitHub Actions, cron jobs, or shell scripts.
- Extensible & offline-documented — add custom command groups via Python entry-point plugins (
discord_cli.plugins), and read the full auto-generated reference offline withman discord-cli.
Example output
$ discord-cli guild info
{
"ok": true,
"data": {
"id": 123456789012345678,
"name": "Engineering HQ",
"member_count": 42,
"channel_count": 18,
"role_count": 9,
"verification_level": "medium"
}
}
Pipe directly into jq:
# Find the ID of #announcements and post a release message
CHANNEL_ID=$(discord-cli channel list | jq -r '.data.channels[] | select(.name == "announcements") | .id')
discord-cli message send "$CHANNEL_ID" --content "v1.4.0 deployed to production"
Install
Package vs. command name: The PyPI distribution is
discordcli-agents; the installed executable isdiscord-cli.
Recommended (isolated CLI install)
# Using uv (fastest)
uv tool install discordcli-agents
# Or using pipx
pipx install discordcli-agents
# Or standard pip
pip install discordcli-agents
Homebrew (macOS / Linux)
brew install 1solomonwakhungu/tap/discordcli-agents
Windows (Scoop manual manifest)
A CI-synced Scoop manifest is provided in packaging/scoop/ for local/manual installs.
Offline manual page
A man page ships with the Python package:
man discord-cli
If your virtualenv prefix is not on MANPATH:
man "$(python -c 'import sysconfig; print(sysconfig.get_path("data"))')/share/man/man1/discord-cli.1"
Use with AI Agents (Claude Code, Codex, Cursor, Copilot)
Install the bundled discord-cli-server-management skill via the open skills CLI:
npx skills add 1solomonwakhungu/discord-cli --skill discord-cli-server-management
Once installed (with DISCORD_BOT_TOKEN in your environment or .env), ask your agent things like:
- "Audit channel permission overwrites across the server and flag anything open to
@everyone." - "Create a
Releasescategory with#changelogand#alertschannels, and post today's release notes." - "Export the last 500 messages from
#supportto JSON and summarize recurring user issues."
The published skill includes explicit prompt-injection guardrails instructing agents to treat retrieved Discord messages, usernames, topics, and embeds as untrusted data. See docs/ai-agents.md for full integration patterns.
Quick setup (2 minutes)
- Create an application and bot in the Discord Developer Portal and copy the Bot Token.
- Under Bot → Privileged Gateway Intents, enable Server Members Intent and Message Content Intent if you use member listing/search or message search/export. (Non-privileged commands automatically fall back if privileged intents are disabled.)
- Invite the bot to your server with the permissions your workflows need.
- Provide your token via environment variable or a local
.envfile:
export DISCORD_BOT_TOKEN="your-bot-token-here"
# Optional: default server when the bot is in multiple guilds
export DISCORD_GUILD_ID="123456789012345678"
Verify connectivity:
discord-cli --human guild info
Quick start
# Inspect server & channels (JSON by default; pass --human before the subcommand for Rich tables)
discord-cli guild info
discord-cli --human channel list
# Create a category and a channel inside it
CAT_ID=$(discord-cli category create "Releases" | jq -r '.data.created.id')
discord-cli channel create "announcements" --type text --category "$CAT_ID" --topic "Release updates"
# Send a plain or embed message
discord-cli message send 123456789012345678 --content "Deploy finished!"
discord-cli message send 123456789012345678 --embed-json '{"title":"Release v1.4.0","color":5763719}'
# Search messages or members (positional query)
discord-cli search messages "deployment" --channel-id 123456789012345678 --limit 25
discord-cli search members "alice"
# Export channel history to JSON or extract CSV
discord-cli export channel 123456789012345678 --limit 500 --format json > history.json
discord-cli export channel 123456789012345678 --limit 500 --format csv | jq -r '.data.data' > history.csv
# Create a role and assign channel permission overwrites
ROLE_ID=$(discord-cli role create "Ops" --color "#3498db" --mentionable --hoist | jq -r '.data.created.id')
discord-cli permissions set --channel 123456789012345678 --role "$ROLE_ID" --allow "view_channel,send_messages"
# Preview inactive member pruning safely (dry-run defaults to true)
discord-cli guild prune --days 30
Command reference (64 commands, 13 groups)
Global options (placed before the command group): --token TEXT, --guild INTEGER, --human, --version.
| Group | Commands | What it covers |
|---|---|---|
channel |
list, create, delete, edit, move, info |
Text, voice, stage, and forum channels |
category |
list, create, delete, edit |
Channel category organization |
role |
list, create, delete, edit, assign, remove, info |
Server roles, colors, permissions, assignments |
member |
list, info, kick, ban, unban, timeout, untimeout, nickname, roles |
Member lookup and moderation |
message |
list, send, edit, delete, purge, fetch, pin, unpin, react |
Messaging, embeds, reactions, bulk purge |
guild |
info, edit, emojis {list,create,delete}, stickers list, bans list, regions, prune |
Server profile, emojis, stickers, bans, pruning |
permissions |
list, set, reset |
Per-channel role/member permission overwrites |
webhook |
list, create, delete, info |
Channel webhook management |
invites |
list, create, delete |
Server invite links with max-age/max-uses/temporary |
threads |
list, create, delete, archive, unarchive, members |
Public/private threads and thread membership |
search |
messages, members |
Substring search across channel history or members |
export |
channel |
Export channel history as JSON or CSV |
plugins |
list |
Inspect loaded third-party discord_cli.plugins |
Recipes & Automation
Copy-paste workflows in docs/recipes.md:
- GitHub Actions deployment & release notifications
- Cron nightly server snapshots and channel exports
- Bulk role & permission provisioning scripts
- Claude Code / Codex terminal-agent shell and Python wrappers
Extending with Plugins
Third-party Python packages can register new top-level command groups via the discord_cli.plugins entry-point group. Broken plugins log a warning and never crash built-in commands. See docs/plugins.md and examples/plugin-hello/.
Documentation
man discord-cli— complete auto-generated CLI reference (docs/man/discord-cli.1)- Practical recipes
- AI agent integration guide
- Plugin development guide
- Contributing guide · Security policy
License
MIT License — see LICENSE.
Metadata
Release files for discordcli-agents 1.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| discordcli_agents-1.9.0.tar.gz | 162.0 kB | With provenance | Details for discordcli_agents-1.9.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| discordcli_agents-1.9.0-py3-none-any.whl | Python 3 | none | any | Details for discordcli_agents-1.9.0-py3-none-any.whl |
Total release size: 270.4 kB
Release files / discordcli_agents-1.9.0.tar.gz
| Download URL | discordcli_agents-1.9.0.tar.gz |
|---|---|
| Size | 162.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
645389a758b62edd04fabfcfddb5650627df4d36a4b38fd96adb873784231caf
|
|
BLAKE2b-256 checksum How to use checksums |
025146267ca8b1b672951a339063fd894ab8c9f0d89a0332a7cbb21a6f72e70b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logRelease files / discordcli_agents-1.9.0-py3-none-any.whl
| Download URL | discordcli_agents-1.9.0-py3-none-any.whl |
|---|---|
| Size | 108.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5773b3893e719cd1522d03f3f7b5330a64e76bc7f7e066651a18342f8229182c
|
|
BLAKE2b-256 checksum How to use checksums |
eec9a6a54ae38f050c1b73db9fdc73100d7eb140105d8e96fce1f46d841924c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logSecurity for discordcli-agents 1.9.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for discordcli_agents-1.9.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.