bark_send_notify
Send push notifications via Bark with customizable title, body, priority levels, and optional URL redirects for device alerts.
Instructions
通过Bark推送通知
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | 推送内容 | |
| title | No | 推送标题 | |
| subtitle | No | 推送副标题 | |
| device_key | No | 设备key,默认从环境变量获取 | |
| url | No | 点击推送时,跳转的URL ,支持URL Scheme 和 Universal Link | |
| icon | No | 自定义图标URL | |
| level | No | 推送中断级别。critical: 重要警告, 在静音模式下也会响铃active:默认值,系统会立即亮屏显示通知timeSensitive:时效性通知,可在专注状态下显示通知。passive:仅将通知添加到通知列表,不会亮屏提醒。 | active |
| volume | No | 重要警告的通知音量(0-10),默认为5 |
Implementation Reference
- mcp_notify/other.py:104-143 (handler)The @mcp.tool decorator and bark_send_notify function provide both the registration and handler logic for sending Bark push notifications. It constructs a POST request to the Bark API with provided parameters and returns the JSON response.@mcp.tool( title="Bark推送通知", description="通过Bark推送通知", ) def bark_send_notify( body: str = Field(description="推送内容"), title: str = Field("", description="推送标题"), subtitle: str = Field("", description="推送副标题"), device_key: str = Field("", description="设备key,默认从环境变量获取"), url: str = Field("", description="点击推送时,跳转的URL ,支持URL Scheme 和 Universal Link"), icon: str = Field("", description="自定义图标URL"), level: str = Field( "active", description="推送中断级别。" "critical: 重要警告, 在静音模式下也会响铃" "active:默认值,系统会立即亮屏显示通知" "timeSensitive:时效性通知,可在专注状态下显示通知。" "passive:仅将通知添加到通知列表,不会亮屏提醒。", ), volume: int = Field(5, description="重要警告的通知音量(0-10),默认为5"), ): """ https://bark.day.app/#/tutorial """ if not device_key: device_key = os.getenv("BARK_DEVICE_KEY", "") base = os.getenv("BARK_BASE_URL") or "https://api.day.app" res = requests.post( f"{base}/{device_key}", json={ "body": body, "title": title, "subtitle": subtitle, "url": url, "icon": icon, "level": level, "volume": volume, }, ) return res.json()
- mcp_notify/__init__.py:19-23 (registration)Top-level MCP server initialization where add_tools from other.py (containing bark_send_notify) is called to register the tool.wework.add_tools(mcp) tgbot.add_tools(mcp) other.add_tools(mcp) hass.add_tools(mcp) util.add_tools(mcp)
- mcp_notify/__init__.py:8-13 (registration)Imports the modules including other.py which defines the bark_send_notify tool.wework, tgbot, other, hass, util, )