关于 pushnote
pushnote 是用于操作 Gotify 服务的命令行工具和 stdio MCP 服务。单个路由工具涵盖发送通知、读取消息、健康与版本检查,以及应用和客户端管理;删除操作需确认。
主要功能
- 01发送推送通知
- 02读取消息和服务器信息
- 03管理 Gotify 应用和客户端
- 04通过单个工具路由操作
- 05删除操作要求确认
适用场景
- 01通过 Gotify 发送通知
- 02检查 Gotify 状态或读取消息
- 03管理应用和客户端
- 04防止未确认的删除请求
MCP 相关
提供单个 `gotify` MCP 工具,用于路由通知、消息读取、服务器检查和管理操作。它使用环境变量中的令牌连接配置的 Gotify 服务;删除操作需要确认。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
1收录的工具列表 · 更新于 1 周前
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | integer | 否 | 消息 ID,用于 delete_message 操作。 |
| name | string | 否 | 应用或客户端名称,用于创建和更新操作。 |
| limit | integer | 否 | 要返回的消息数上限,用于 messages 操作。 |
| since | integer | 否 | 仅返回 ID 大于此值的消息,用于 messages 操作。 |
| title | string | 否 | 消息标题,用于 send 操作。 |
| action | enum | 是 | 要运行的操作:health、version、me、messages、applications、clients、status、send、create_application、update_application、create_client 或 delete_message。health | version | me | messages | applications | clients | status | send | create_application | update_application | create_client | delete_message | delete_all_messages | delete_application | delete_client | help |
| app_id | integer | 否 | 应用 ID,用于 update_application 操作。 |
| extras | object | 否 | 附加到消息的 extras 对象,用于 send 操作。 |
| confirm | boolean | 否 | 必须为 true 才能确认删除消息等破坏性操作。 |
| message | string | 否 | 消息文本,用于 send 操作。 |
| priority | integer | 否 | 发送操作的消息优先级,整数。 |
| client_id | integer | 否 | 客户端 ID。 |
| description | string | 否 | 用于 create_application 和 update_application 操作的应用描述。 |
| default_priority | integer | 否 | 应用的默认消息优先级。 |
详细介绍
pushnote
pushnote 可与 Gotify 服务通信:它可以发送推送通知,
读取消息、服务健康状态和版本,并管理通知流经的
Gotify 应用和客户端。所有功能都通过一个操作路由工具 gotify 暴露,
可通过命令行界面和 stdio MCP 服务使用,两者由同一个
二进制文件提供。
它由三个环境变量配置。GOTIFY_URL 是你的 Gotify 服务的
基础 URL,且为必需项——未设置时,除本地 help 外的所有操作
都会在发出任何请求之前失败。
GOTIFY_CLIENT_TOKEN 是用于读取和管理(当前用户、消息、应用、客户端)的
Gotify 客户端令牌。
GOTIFY_APP_TOKEN 是仅供 send 操作使用的 Gotify 应用令牌。令牌仅从环境变量中读取;
绝不会作为工具参数传入。
安装
npx @reneturcios/pushnote health
也可以运行容器镜像:
docker run -i ghcr.io/cloudcorprecords/pushnote
容器默认启动 MCP 服务(见下文)。传入 CLI 参数即可将其用作 CLI。
CLI
每个命令都对应一个路由操作。多词命令既接受此处展示的连字符形式,也接受
下划线操作名称
(例如 create-application 或 create_application)。
export GOTIFY_URL=https://gotify.example.com
export GOTIFY_CLIENT_TOKEN=<client token>
export GOTIFY_APP_TOKEN=<app token>
pushnote health
pushnote version
pushnote me
pushnote messages --limit 25 --since 40
pushnote messages --app-id 7
pushnote applications
pushnote clients
pushnote status
pushnote send "deploy finished" --title CI --priority 5
pushnote create-application alerts --description "Alert channel" --default-priority 4
pushnote update-application 3 --name renamed
pushnote create-client phone
pushnote delete-message 9 --confirm
pushnote delete-all-messages --confirm
pushnote delete-application 4 --confirm
pushnote delete-client 5 --confirm
pushnote help
pushnote --version
成功的命令会打印上游 JSON 载荷(status 和
help 则打印本地输出)。退出码:成功时为 0,
调用失败时为 1(包括上游 API 错误或
拒绝执行破坏性操作),用法错误时为 2。
破坏性命令——四个 delete-* 命令——只有传入 --confirm 才会执行。
否则,它们会在任何请求到达 Gotify 服务之前失败。
MCP 服务
mcp 子命令会启动 stdio MCP 服务:
npx -y @reneturcios/pushnote mcp
MCP 客户端配置:
{
"mcpServers": {
"pushnote": {
"command": "npx",
"args": ["-y", "@reneturcios/pushnote", "mcp"],
"env": {
"GOTIFY_URL": "https://gotify.example.com",
"GOTIFY_CLIENT_TOKEN": "<client token>",
"GOTIFY_APP_TOKEN": "<app token>"
}
}
}
}
工具
一个名为 gotify 的工具,它需要一个必填的 action 参数,并将该操作所需的
参数作为可选的顶层参数:
| 操作 | 必填 | 可选 | 令牌 |
|---|---|---|---|
health | — | — | 无 |
version | — | — | 无 |
me | — | — | 客户端 |
messages | — | app_id、limit、since | 客户端 |
applications | — | — | 客户端 |
clients | — | — | 客户端 |
status | — | — | 无(本地) |
send | message | title、priority、extras | 应用 |
create_application | name | description、default_priority | 客户端 |
update_application | app_id | name、description、default_priority | 客户端 |
create_client | name | — | 客户端 |
delete_message | id、confirm | — | 客户端 |
delete_all_messages | confirm | — | 客户端 |
delete_application | app_id、confirm | — | 客户端 |
delete_client | client_id、confirm | — | 客户端 |
help | — | — | 无(本地) |
所有四个删除操作都必须在 confirm 为 true 时才会执行,
并且会在发出任何请求之前进行检查。status 会返回
本地快照(Gotify URL、已配置的令牌类型、操作数量),绝不包含令牌值。
help 会在本地返回操作文档。
开发
npm install
npm run build # tsc -> dist/
npm test # node test runner over test/*.test.ts, no network (fake fetch fixtures)
npm run dev # run the CLI from source via tsx
许可证
MIT — 参见 LICENSE。
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。