Agent-first CLI for fetching Confluence Cloud page context as Markdown or JSON.
Project description
confluence-fetch
confluence-fetch fetches Confluence Cloud pages and turns them into agent-friendly output for CLI tools like Codex CLI and Claude Code.
It is designed for:
- Fetching page context from a Confluence URL
- Returning clean Markdown by default
- Returning structured JSON when needed
- Keeping secrets out of config files
Why
This tool exists to bring Confluence context into local agent workflows.
The primary use case is:
- Set a token in an environment variable
- Set your Confluence account email in config
- Run
confluence-fetch fetch <confluence-url> - Feed the result into an agent
Install
Target public install path:
uvx confluence-fetch --help
For local development, the repo will also keep a PEP 723 script entry point for uv run.
Quick Start
Set your Confluence token:
$env:CONFLUENCE_TOKEN = "<your-token>"
Set your Confluence account email:
uvx confluence-fetch config set-email "you@example.com"
Fetch a page as Markdown:
uvx confluence-fetch fetch "https://your-domain.atlassian.net/wiki/spaces/ENG/pages/123456789/Example+Page"
Fetch the same page as JSON:
uvx confluence-fetch fetch --format json "https://your-domain.atlassian.net/wiki/spaces/ENG/pages/123456789/Example+Page"
Write output to a file:
uvx confluence-fetch fetch -o page.md "https://your-domain.atlassian.net/wiki/spaces/ENG/pages/123456789/Example+Page"
Include comments:
uvx confluence-fetch fetch --comments "https://your-domain.atlassian.net/wiki/spaces/ENG/pages/123456789/Example+Page"
Comment order defaults to best-effort document order. Inline comments with anchor text are rendered top-to-bottom by the first matching occurrence in the page body. Comments whose anchors cannot be matched are rendered at the end in created order.
Use a time-based order when you prefer an unambiguous chronological list:
uvx confluence-fetch fetch --comments --comment-order created "https://your-domain.atlassian.net/wiki/spaces/ENG/pages/123456789/Example+Page"
uvx confluence-fetch fetch --comments --comment-order updated "https://your-domain.atlassian.net/wiki/spaces/ENG/pages/123456789/Example+Page"
Config
Optional user config lives at:
~/.confluence-fetch/config.toml
The config stores only environment variable names, never secret token values.
Example:
[defaults]
token_env_var = "CONFLUENCE_TOKEN"
email = "you@example.com"
[domains."sona-systems.atlassian.net"]
token_env_var = "SONA_CONFLUENCE_TOKEN"
[domains."example.atlassian.net"]
token_env_var = "EXAMPLE_CONFLUENCE_TOKEN"
Resolution order:
--token-env ENV_VAR- domain-specific config match from the requested Confluence URL
[defaults].token_env_var- built-in default
CONFLUENCE_TOKEN
Email resolution order:
[defaults].emailCONFLUENCE_EMAIL- compatibility fallback
confluence_email
Config commands:
confluence-fetch config show
confluence-fetch config set-default-token-env ENV_VAR
confluence-fetch config set-email EMAIL
confluence-fetch config clear-email
confluence-fetch config set-domain-token-env DOMAIN ENV_VAR
confluence-fetch config remove-domain DOMAIN
Example:
uvx confluence-fetch config set-domain-token-env sona-systems.atlassian.net SONA_CONFLUENCE_TOKEN
config show displays the effective token env var names, whether they are set or missing, and the configured default email. It never prints token values.
Output
confluence-fetch supports:
--format markdown--format json--comment-order document--comment-order created--comment-order updated
Markdown is the default.
Diagnostics go to stderr. Payload output goes to stdout unless --output is used.
Development
Implementation target:
- Python
>=3.11 - installable PyPI package
- PEP 723 wrapper for
uv run
Auth
confluence-fetch uses Basic auth with a Confluence account email plus API token.
Secrets are not written to config.
Scoped API Token Permissions
For scoped Confluence API tokens, grant only the scopes needed for the features you use:
| Feature | Required scope |
|---|---|
| Fetch page Markdown or JSON | read:page:confluence |
Include comments with --comments |
read:comment:confluence |
Download image assets with --download-images |
read:attachment:confluence |
| Resolve comment author display names | read:user:confluence |
Recommended full token for all current features:
read:page:confluence
read:comment:confluence
read:attachment:confluence
read:user:confluence
If read:user:confluence is missing, comments still render, but author names fall back to stable account IDs when Confluence does not include display names in the comment payload.
License
MIT. See LICENSE.
Status
This repo is currently being built around an agent-first v2 spec.
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 confluence_fetch-0.14.0.tar.gz.
File metadata
- Download URL: confluence_fetch-0.14.0.tar.gz
- Upload date:
- Size: 33.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ff05917dfd6f6ec96595fbbd624774e37ce2771ceb0f31cec8f71172d9f62c4
|
|
| MD5 |
93e0cb4959dbfb20f22198e486c26148
|
|
| BLAKE2b-256 |
cca591b0b6c5a3fe01fc1a7df99a95b0e2451e3f4bcfd8dd362d21e4ce4715a6
|
File details
Details for the file confluence_fetch-0.14.0-py3-none-any.whl.
File metadata
- Download URL: confluence_fetch-0.14.0-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e22d4c8b79a1578a0dcc473d657e302d120d3cee397e46da88d034da551126df
|
|
| MD5 |
552a7a89d42f81fe9b44c09b9a7663fa
|
|
| BLAKE2b-256 |
42b655a53201700d75524434ddf073bf6f4f3b8b55cd82e82c2903f994bafb20
|