paragraph-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseParagraph CLI
Paragraph CLI
CLI for Paragraph — a web3 publishing and newsletter platform. Use it to manage posts, publications, subscribers, and coins.
For direct HTTP or SDK access without installing anything, see the paragraph-api skill instead.
适用于Paragraph的CLI——一个Web3发布和新闻通讯平台。可用于管理帖子、出版物、订阅者和代币。
如果无需安装即可直接通过HTTP或SDK访问,请改用paragraph-api技能。
MCP Server (recommended for MCP-compatible clients)
MCP服务器(推荐给兼容MCP的客户端)
If your client supports MCP, use the Paragraph MCP server instead of the CLI for a more integrated experience.
如果你的客户端支持MCP,请使用Paragraph MCP服务器而非CLI,以获得更集成的体验。
Remote server (recommended)
远程服务器(推荐)
Use the hosted server at — no installation or API key management required. Authenticates via your Paragraph account in the browser.
mcp.paragraph.combash
claude mcp add paragraph --transport http https://mcp.paragraph.com/mcpFor other clients, add as a server URL in your MCP configuration.
https://mcp.paragraph.com/mcp使用托管在的服务器——无需安装或管理API密钥。通过浏览器中的Paragraph账户进行身份验证。
mcp.paragraph.combash
claude mcp add paragraph --transport http https://mcp.paragraph.com/mcp对于其他客户端,在MCP配置中添加作为服务器URL。
https://mcp.paragraph.com/mcpLocal server
本地服务器
If you prefer to run the server locally (requires Node.js 18+):
bash
claude mcp add paragraph -- npx @paragraph-com/mcpLocal mode requires an API key via env var or from the CLI.
PARAGRAPH_API_KEYparagraph loginThe MCP server exposes 18 tools (posts, publications, subscribers, coins, search, feed, users) and shares authentication with the CLI. See full docs.
如果你偏好本地运行服务器(需要Node.js 18+):
bash
claude mcp add paragraph -- npx @paragraph-com/mcp本地模式需要通过环境变量或CLI的命令提供API密钥。
PARAGRAPH_API_KEYparagraph loginMCP服务器提供18种工具(帖子、出版物、订阅者、代币、搜索、订阅源、用户),并与CLI共享身份验证。查看完整文档。
CLI Setup
CLI设置
Install globally:
bash
npm install -g @paragraph-com/cliAuthenticate — login persists the key to :
~/.paragraph/config.jsonbash
paragraph login --token <api-key>
echo "$PARAGRAPH_API_KEY" | paragraph login --with-tokenOr skip login and pass the key per-command via env var:
bash
PARAGRAPH_API_KEY=<api-key> paragraph post list --jsonVerify:
paragraph whoami --json全局安装:
bash
npm install -g @paragraph-com/cli身份验证——登录后密钥将保存到:
~/.paragraph/config.jsonbash
paragraph login --token <api-key>
echo "$PARAGRAPH_API_KEY" | paragraph login --with-token或者跳过登录,通过环境变量为每个命令传递密钥:
bash
PARAGRAPH_API_KEY=<api-key> paragraph post list --json验证:
paragraph whoami --jsonWorking agreement
使用约定
- Always use for parseable output. Data goes to stdout, status/errors to stderr.
--json - Always use on
--yesto skip confirmation prompts.delete - Use before
--dry-run,delete, andpublishto preview what will happen.archive - Use flags, not just positional args. Every identifier accepts so you can chain commands.
--id - Pipe content via stdin when creating or updating posts from files:
cat draft.md | paragraph post create --title "My Post" - Paginate with and
--limit. The JSON response includes--cursorandpagination.cursor.pagination.hasMore - Do not use interactive login. Use or
--tokenfor non-interactive auth.--with-token - Check auth before running commands. Run to verify credentials are valid.
paragraph whoami --json - Do not publish without explicit user approval. Publishing sends content live and optionally emails subscribers.
- Default to draft. creates drafts. Only call
post createwhen the user asks.post publish - Respect rate limits. If you get , wait and retry. Avoid tight loops between paginated requests.
RATE_LIMITED
- **始终使用**以获得可解析的输出。数据输出到stdout,状态/错误输出到stderr。
--json - **删除操作始终使用**以跳过确认提示。
--yes - **在执行、
delete和publish前使用archive**预览操作结果。--dry-run - 使用标志而非仅位置参数。每个标识符都支持,以便你可以链式执行命令。
--id - 通过stdin管道传输内容从文件创建或更新帖子:
cat draft.md | paragraph post create --title "My Post" - 使用和
--limit进行分页。JSON响应包含--cursor和pagination.cursor。pagination.hasMore - 不要使用交互式登录。使用或
--token进行非交互式身份验证。--with-token - 执行命令前检查身份验证。运行验证凭据是否有效。
paragraph whoami --json - 未经用户明确批准不要发布。发布操作会将内容上线,并可能向订阅者发送邮件。
- 默认创建草稿。创建草稿。仅在用户要求时调用
post create。post publish - 遵守速率限制。如果收到,请等待并重试。避免在分页请求之间使用紧密循环。
RATE_LIMITED
Commands
命令
Posts
帖子
bash
undefinedbash
undefinedCreate a draft
创建草稿
paragraph post create --title "My Post" --file ./post.md --tags "web3,defi" --json
paragraph post create --title "My Post" --text "# Hello World" --subtitle "A subtitle" --json
cat content.md | paragraph post create --title "My Post" --json
paragraph post create --title "My Post" --file ./post.md --tags "web3,defi" --json
paragraph post create --title "My Post" --text "# Hello World" --subtitle "A subtitle" --json
cat content.md | paragraph post create --title "My Post" --json
List
列出
paragraph post list --json
paragraph post list --status draft --limit 20 --json
paragraph post list --status scheduled --json
paragraph post list --publication <slug-or-id> --json
paragraph post list --json
paragraph post list --status draft --limit 20 --json
paragraph post list --status scheduled --json
paragraph post list --publication <slug-or-id> --json
Get (by ID, URL, or @pub/slug)
获取(通过ID、URL或@pub/slug)
paragraph post get --id <post-id> --json
paragraph post get @my-blog/post-slug --json
paragraph post get --id <post-id> --json
paragraph post get @my-blog/post-slug --json
Extract a single field
提取单个字段
paragraph post get --id <post-id> --field markdown > post.md
paragraph post get --id <post-id> --field title
paragraph post get --id <post-id> --field markdown > post.md
paragraph post get --id <post-id> --field title
Update
更新
paragraph post update --id <id-or-slug> --title "New Title" --json
paragraph post update --id <id-or-slug> --text "Updated content" --subtitle "New subtitle" --json
paragraph post update --id <id-or-slug> --file ./updated.md --tags "new,tags" --json
paragraph post update --id <id-or-slug> --title "New Title" --json
paragraph post update --id <id-or-slug> --text "Updated content" --subtitle "New subtitle" --json
paragraph post update --id <id-or-slug> --file ./updated.md --tags "new,tags" --json
Publish
发布
paragraph post publish --id <id-or-slug> --json
paragraph post publish --id <id-or-slug> --newsletter --json
paragraph post publish --id <id-or-slug> --json
paragraph post publish --id <id-or-slug> --newsletter --json
Revert to draft
恢复为草稿
paragraph post draft --id <id-or-slug> --json
paragraph post draft --id <id-or-slug> --json
Archive
归档
paragraph post archive --id <id-or-slug> --json
paragraph post archive --id <id-or-slug> --json
Schedule a post for future publication
安排帖子未来发布
paragraph post schedule --id <id-or-slug> --at "2026-05-01T09:00:00Z" --json
paragraph post schedule --id <id-or-slug> --at "2026-05-01T09:00:00Z" --newsletter --json
paragraph post schedule --id <id-or-slug> --at "2026-05-01T09:00:00Z" --json
paragraph post schedule --id <id-or-slug> --at "2026-05-01T09:00:00Z" --newsletter --json
Cancel a scheduled publication
取消已安排的发布
paragraph post unschedule --id <id-or-slug> --json
paragraph post unschedule --id <id-or-slug> --json
Create and schedule in one step
一步创建并安排发布
paragraph post create --title "Launch Day" --file ./post.md --schedule-at "2026-05-01T09:00:00Z" --newsletter --json
paragraph post create --title "Launch Day" --file ./post.md --schedule-at "2026-05-01T09:00:00Z" --newsletter --json
Preview destructive actions
预览破坏性操作
paragraph post delete --id <id-or-slug> --dry-run --json
paragraph post publish --id <id-or-slug> --dry-run --json
paragraph post delete --id <id-or-slug> --dry-run --json
paragraph post publish --id <id-or-slug> --dry-run --json
Delete
删除
paragraph post delete --id <id-or-slug> --yes --json
paragraph post delete --id <id-or-slug> --yes --json
Send test newsletter email
发送测试新闻通讯邮件
paragraph post test-email --id <post-id> --json
paragraph post test-email --id <post-id> --json
Browse
浏览
paragraph post feed --limit 10 --json
paragraph post by-tag --tag web3 --limit 20 --json
undefinedparagraph post feed --limit 10 --json
paragraph post by-tag --tag web3 --limit 20 --json
undefinedPublications
出版物
bash
paragraph publication get --id <slug-or-id-or-domain> --jsonbash
paragraph publication get --id <slug-or-id-or-domain> --jsonSearch
搜索
bash
paragraph search post --query "ethereum" --json
paragraph search blog --query "web3" --jsonbash
paragraph search post --query "ethereum" --json
paragraph search blog --query "web3" --jsonSubscribers
订阅者
bash
paragraph subscriber list --limit 100 --json
paragraph subscriber count --publication <id> --json
paragraph subscriber add --email user@example.com --json
paragraph subscriber add --wallet 0x1234...abcd --json
paragraph subscriber import --csv ./subscribers.csv --jsonbash
paragraph subscriber list --limit 100 --json
paragraph subscriber count --publication <id> --json
paragraph subscriber add --email user@example.com --json
paragraph subscriber add --wallet 0x1234...abcd --json
paragraph subscriber import --csv ./subscribers.csv --jsonCoins
代币
bash
paragraph coin get --id <id-or-address> --json
paragraph coin popular --limit 10 --json
paragraph coin search --query "ethereum" --json
paragraph coin holders --id <id-or-address> --limit 50 --json
paragraph coin quote --id <id-or-address> --amount <wei> --jsonbash
paragraph coin get --id <id-or-address> --json
paragraph coin popular --limit 10 --json
paragraph coin search --query "ethereum" --json
paragraph coin holders --id <id-or-address> --limit 50 --json
paragraph coin quote --id <id-or-address> --amount <wei> --jsonUsers
用户
bash
paragraph user get --id <user-id-or-wallet> --jsonbash
paragraph user get --id <user-id-or-wallet> --jsonAuth
身份验证
bash
paragraph login --token <api-key>
echo "<api-key>" | paragraph login --with-token
paragraph whoami --json
paragraph logoutbash
paragraph login --token <api-key>
echo "<api-key>" | paragraph login --with-token
paragraph whoami --json
paragraph logoutJSON response shapes
JSON响应格式
Paginated list (note: the CLI wraps items under ; the REST API and SDK use instead):
dataitemsjson
{
"data": [{ "id": "...", "title": "..." }],
"pagination": { "cursor": "abc123", "hasMore": true }
}Single item:
json
{ "id": "...", "title": "...", "markdown": "..." }Mutation:
json
{ "id": "...", "status": "published" }Error (on stderr):
json
{ "error": "Not found.", "code": "NOT_FOUND", "status": 404 }Error codes: UNAUTHORIZED, FORBIDDEN, NOT_FOUND, RATE_LIMITED, SERVER_ERROR, REQUEST_FAILED, CLIENT_ERROR, UNKNOWN.
分页列表(注意:CLI将项目包裹在下;REST API和SDK使用):
dataitemsjson
{
"data": [{ "id": "...", "title": "..." }],
"pagination": { "cursor": "abc123", "hasMore": true }
}单个项目:
json
{ "id": "...", "title": "...", "markdown": "..." }变更操作:
json
{ "id": "...", "status": "published" }错误(输出到stderr):
json
{ "error": "Not found.", "code": "NOT_FOUND", "status": 404 }错误代码:UNAUTHORIZED、FORBIDDEN、NOT_FOUND、RATE_LIMITED、SERVER_ERROR、REQUEST_FAILED、CLIENT_ERROR、UNKNOWN。
Common patterns
常见模式
Create and publish in one flow
一步创建并发布
bash
ID=$(paragraph post create --title "My Post" --file ./post.md --json | jq -r '.id')
paragraph post publish --id "$ID" --newsletter --jsonbash
ID=$(paragraph post create --title "My Post" --file ./post.md --json | jq -r '.id')
paragraph post publish --id "$ID" --newsletter --jsonExport all posts as markdown
将所有帖子导出为markdown
bash
paragraph post list --limit 100 --json | jq -r '.data[].id' | while read id; do
SLUG=$(paragraph post get --id "$id" --json | jq -r '.slug')
paragraph post get --id "$id" --field markdown > "${SLUG}.md"
donebash
paragraph post list --limit 100 --json | jq -r '.data[].id' | while read id; do
SLUG=$(paragraph post get --id "$id" --json | jq -r '.slug')
paragraph post get --id "$id" --field markdown > "${SLUG}.md"
donePaginate through all subscribers
分页遍历所有订阅者
bash
CURSOR=""
while true; do
RESULT=$(paragraph subscriber list --limit 100 ${CURSOR:+--cursor "$CURSOR"} --json)
echo "$RESULT" | jq '.data[]'
CURSOR=$(echo "$RESULT" | jq -r '.pagination.cursor // empty')
HAS_MORE=$(echo "$RESULT" | jq '.pagination.hasMore')
[ "$HAS_MORE" = "true" ] || break
donebash
CURSOR=""
while true; do
RESULT=$(paragraph subscriber list --limit 100 ${CURSOR:+--cursor "$CURSOR"} --json)
echo "$RESULT" | jq '.data[]'
CURSOR=$(echo "$RESULT" | jq -r '.pagination.cursor // empty')
HAS_MORE=$(echo "$RESULT" | jq '.pagination.hasMore')
[ "$HAS_MORE" = "true" ] || break
doneEnvironment variables
环境变量
| Variable | Purpose |
|---|---|
| PARAGRAPH_API_KEY | API key (skip login) |
| PARAGRAPH_API_URL | Custom API base URL |
| PARAGRAPH_NON_INTERACTIVE | Set to 1 to force CLI mode |
| CI | Set to true to force CLI mode |
| 变量 | 用途 |
|---|---|
| PARAGRAPH_API_KEY | API密钥(跳过登录) |
| PARAGRAPH_API_URL | 自定义API基础URL |
| PARAGRAPH_NON_INTERACTIVE | 设置为1以强制CLI模式 |
| CI | 设置为true以强制CLI模式 |
Troubleshooting
故障排除
Authentication errors
身份验证错误
If commands fail with :
UNAUTHORIZEDbash
undefined如果命令返回失败:
UNAUTHORIZEDbash
undefinedCheck if logged in
检查是否已登录
paragraph whoami --json
paragraph whoami --json
Re-authenticate
重新验证
paragraph login --token <api-key>
The CLI auto-clears stored credentials on 401. Re-login if credentials were revoked.paragraph login --token <api-key>
CLI会在收到401时自动清除存储的凭据。如果凭据被撤销,请重新登录。Rate limiting
速率限制
If you get , wait and retry. The error includes a status code. Avoid tight loops — add a delay between paginated requests.
RATE_LIMITED429如果收到,请等待并重试。错误包含状态码。避免紧密循环——在分页请求之间添加延迟。
RATE_LIMITED429Command hangs
命令挂起
If a command appears to hang, it may be waiting for stdin. Ensure you're passing content via , , or piping to stdin. The CLI times out after 30 seconds if stdin is piped but no data arrives.
--text--file如果命令看似挂起,可能是在等待stdin输入。确保你通过、或管道将内容传递到stdin。如果stdin被管道连接但未收到数据,CLI会在30秒后超时。
--text--fileCLI not found after install
安装后找不到CLI
bash
npm install -g @paragraph-com/clibash
npm install -g @paragraph-com/cliVerify
验证
npx paragraph --version
undefinednpx paragraph --version
undefined