@applogico/blipr-mcp 0.1.2 → 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 +18 -7
  2. package/package.json +1 -1
package/dist/publish.js CHANGED
@@ -1,24 +1,35 @@
1
1
  /** Blipr publish client — the one piece of real logic, kept pure for testing. */
2
- /** POST a message to a Blipr topic. Returns the resolved topic on success. */
2
+ /**
3
+ * Publish a message to a Blipr topic. Returns the resolved topic on success.
4
+ *
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
+ */
3
9
  export async function publish(opts, cfg) {
4
10
  const topic = (opts.topic ?? cfg.defaultTopic ?? "").trim();
5
11
  if (!topic) {
6
12
  throw new Error("No topic given and BLIPR_TOPIC is not set. Pass `topic`, or set the BLIPR_TOPIC env var.");
7
13
  }
8
- const headers = { "Content-Type": "text/plain" };
14
+ // Topic goes in the URL path; everything else is the JSON body.
15
+ const payload = { message: opts.message };
9
16
  if (opts.title)
10
- headers["X-Title"] = opts.title;
17
+ payload.title = opts.title;
11
18
  if (opts.priority)
12
- headers["X-Priority"] = String(opts.priority);
19
+ payload.priority = opts.priority;
13
20
  if (opts.tags?.length)
14
- headers["X-Tags"] = opts.tags.join(",");
21
+ payload.tags = opts.tags;
15
22
  if (opts.click)
16
- headers["X-Click"] = opts.click;
23
+ payload.click = opts.click;
17
24
  const base = cfg.bliprUrl.replace(/\/+$/, "");
18
25
  const url = `${base}/api/notify/${encodeURIComponent(topic)}`;
19
26
  let res;
20
27
  try {
21
- res = await fetch(url, { method: "POST", headers, body: opts.message });
28
+ res = await fetch(url, {
29
+ method: "POST",
30
+ headers: { "Content-Type": "application/json" },
31
+ body: JSON.stringify(payload),
32
+ });
22
33
  }
23
34
  catch (e) {
24
35
  throw new Error(`Could not reach Blipr at ${base}: ${e.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applogico/blipr-mcp",
3
- "version": "0.1.2",
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": {