@applogico/blipr-mcp 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/publish.js +7 -5
  2. package/package.json +1 -1
package/dist/publish.js CHANGED
@@ -2,16 +2,17 @@
2
2
  /**
3
3
  * Publish a message to a Blipr topic. Returns the resolved topic on success.
4
4
  *
5
- * Uses the JSON publish endpoint (`POST /api/notify`) rather than the
6
- * header-based one. The JSON body is UTF-8, so titles/messages with emoji or
7
- * accents work — HTTP headers are Latin-1 only and would corrupt or reject them.
5
+ * Posts to `POST /api/notify/{topic}` (topic in the URL) with a JSON body. JSON
6
+ * is UTF-8, so titles/messages with emoji or accents survive — HTTP headers are
7
+ * Latin-1 only and would corrupt or reject them.
8
8
  */
9
9
  export async function publish(opts, cfg) {
10
10
  const topic = (opts.topic ?? cfg.defaultTopic ?? "").trim();
11
11
  if (!topic) {
12
12
  throw new Error("No topic given and BLIPR_TOPIC is not set. Pass `topic`, or set the BLIPR_TOPIC env var.");
13
13
  }
14
- const payload = { topic, message: opts.message };
14
+ // Topic goes in the URL path; everything else is the JSON body.
15
+ const payload = { message: opts.message };
15
16
  if (opts.title)
16
17
  payload.title = opts.title;
17
18
  if (opts.priority)
@@ -21,9 +22,10 @@ export async function publish(opts, cfg) {
21
22
  if (opts.click)
22
23
  payload.click = opts.click;
23
24
  const base = cfg.bliprUrl.replace(/\/+$/, "");
25
+ const url = `${base}/api/notify/${encodeURIComponent(topic)}`;
24
26
  let res;
25
27
  try {
26
- res = await fetch(`${base}/api/notify`, {
28
+ res = await fetch(url, {
27
29
  method: "POST",
28
30
  headers: { "Content-Type": "application/json" },
29
31
  body: JSON.stringify(payload),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applogico/blipr-mcp",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "MCP server that lets AI agents send Blipr push alerts to your phone — your agent can page you.",
5
5
  "type": "module",
6
6
  "bin": {