mcpField
P
pushnote

pushnote

本地服务
github.com/CloudCorpRecords通信协作01 周前更新

关于 pushnote

pushnote 是用于操作 Gotify 服务的命令行工具和 stdio MCP 服务。单个路由工具涵盖发送通知、读取消息、健康与版本检查,以及应用和客户端管理;删除操作需确认。

主要功能

  1. 01发送推送通知
  2. 02读取消息和服务器信息
  3. 03管理 Gotify 应用和客户端
  4. 04通过单个工具路由操作
  5. 05删除操作要求确认

适用场景

  1. 01通过 Gotify 发送通知
  2. 02检查 Gotify 状态或读取消息
  3. 03管理应用和客户端
  4. 04防止未确认的删除请求

MCP 相关

提供单个 `gotify` MCP 工具,用于路由通知、消息读取、服务器检查和管理操作。它使用环境变量中的令牌连接配置的 Gotify 服务;删除操作需要确认。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"cloudcorprecords-pushnote": {
"command": "npx",
"args": [
"-y",
"@reneturcios/pushnote"
]
}
}
}
启动命令npx -y @reneturcios/pushnote

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
npm@reneturcios/pushnote0.1.0
ocighcr.io/cloudcorprecords/pushnote:0.1.0

工具

1

收录的工具列表 · 更新于 1 周前

参数类型必填说明
idinteger否消息 ID,用于 delete_message 操作。
namestring否应用或客户端名称,用于创建和更新操作。
limitinteger否要返回的消息数上限,用于 messages 操作。
sinceinteger否仅返回 ID 大于此值的消息,用于 messages 操作。
titlestring否消息标题,用于 send 操作。
actionenum是要运行的操作: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_idinteger否应用 ID,用于 update_application 操作。
extrasobject否附加到消息的 extras 对象,用于 send 操作。
confirmboolean否必须为 true 才能确认删除消息等破坏性操作。
messagestring否消息文本,用于 send 操作。
priorityinteger否发送操作的消息优先级,整数。
client_idinteger否客户端 ID。
descriptionstring否用于 create_application 和 update_application 操作的应用描述。
default_priorityinteger否应用的默认消息优先级。

详细介绍

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——无(本地)
sendmessagetitle、priority、extras应用
create_applicationnamedescription、default_priority客户端
update_applicationapp_idname、description、default_priority客户端
create_clientname—客户端
delete_messageid、confirm—客户端
delete_all_messagesconfirm—客户端
delete_applicationapp_id、confirm—客户端
delete_clientclient_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。

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。