| index 7fc5c2c..d9764e6 100644 | ||
| --- a/plugin.json | ||
| +++ b/plugin.json | ||
| @@ -6,7 +6,7 @@ | ||
| 6 | 6 | "title": "ntfy Push & Pub/Sub Channel Connector", |
| 7 | 7 | "summary": "Zero-dependency ntfy connector with two faces: an MCP tool (ntfy_send) so the agent can push alerts and report summaries to your phone, and a supervised channel daemon that subscribes to a topic's NDJSON stream, holds every unknown sender in a default-deny pairing queue, forwards only approved senders' messages to a SCORPIOX BOT session through POST /inbox, and publishes the agent's newest reply back to the publish topic. Setup, pairing approval and a live daemon log live behind node authentication; TLS verification is fail-closed against a bundled root store with an SPKI pin option for self-hosted relays.", |
| 8 | 8 | "category": "network", |
| 9 | - "version": "1.0.0", | |
| 9 | + "version": "1.0.1", | |
| 10 | 10 | "license": "MIT", |
| 11 | 11 | "kind": "hybrid", |
| 12 | 12 | "mcp": true, |
| index e2fe8bf..cdddcd5 100644 | ||
| --- a/src/plugin_ntfy.c | ||
| +++ b/src/plugin_ntfy.c | ||
| @@ -100,7 +100,7 @@ | ||
| 100 | 100 | |
| 101 | 101 | #define PLUGIN_SLUG "ntfy" |
| 102 | 102 | #define PLUGIN_ID "plugin_ntfy" |
| 103 | -#define PLUGIN_VER "1.0.0" | |
| 103 | +#define PLUGIN_VER "1.0.1" | |
| 104 | 104 | #define SELF_SOURCE_ID "scorpiox-bot-plugin-ntfy" |
| 105 | 105 | |
| 106 | 106 | /* The tag every notification THIS plugin publishes carries. A second, |
| @@ -550,9 +550,20 @@ static int mode_mcp(void) | ||
| 550 | 550 | if (has_id) { char b[64]; snprintf(b, sizeof b, "{\"jsonrpc\":\"2.0\",\"id\":%lld,\"result\":{}}", id); mcp_send_raw(b); } |
| 551 | 551 | } else if (!strcmp(method, "tools/list")) { |
| 552 | 552 | if (has_id) { |
| 553 | + /* +64 for the id digits and the closing brace. The closing | |
| 554 | + * brace of the *outer* object is ours to emit: MCP_TOOLS_JSON | |
| 555 | + * is the value of "result", so without it the frame is one | |
| 556 | + * brace short. yyjson then rejects the line, the router | |
| 557 | + * (scorpiox-connector-mcp proc_request) skips it as "noise on | |
| 558 | + * stdout", reads again, hits EOF and reports | |
| 559 | + * "tools/list failed for ntfy: no response" -- the tool would | |
| 560 | + * be invisible to every agent. A substring grep in the suite | |
| 561 | + * passed on the broken frame; the assertion that catches this | |
| 562 | + * now parses every emitted frame. */ | |
| 553 | 563 | char *buf = malloc(strlen(MCP_TOOLS_JSON) + 64); |
| 554 | 564 | if (buf) { |
| 555 | - sprintf(buf, "{\"jsonrpc\":\"2.0\",\"id\":%lld,\"result\":%s", id, MCP_TOOLS_JSON); | |
| 565 | + sprintf(buf, "{\"jsonrpc\":\"2.0\",\"id\":%lld,\"result\":%s}", | |
| 566 | + id, MCP_TOOLS_JSON); | |
| 556 | 567 | mcp_send_raw(buf); |
| 557 | 568 | free(buf); |
| 558 | 569 | } |
| index 75e317e..3349313 100755 | ||
| --- a/tests/run.sh | ||
| +++ b/tests/run.sh | ||
| @@ -268,6 +268,34 @@ MOUT=$(printf '%s\n%s\n%s\n' \ | ||
| 268 | 268 | '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' | $BIN --mcp) |
| 269 | 269 | INIT=$(printf '%s\n' "$MOUT" | head -1) |
| 270 | 270 | json_ok "initialize answers" "$INIT" "d['result']['serverInfo']['name']=='plugin_ntfy' and 'protocolVersion' in d['result']" |
| 271 | +# Every frame the MCP server prints must be parseable JSON. This is not | |
| 272 | +# pedantry: scorpiox-connector-mcp's proc_request() treats an unparseable line | |
| 273 | +# as "noise on stdout", keeps reading, hits EOF and reports | |
| 274 | +# `tools/list failed for ntfy: no response` - a connector whose tools the | |
| 275 | +# agent can simply never see. A substring grep passes happily on a frame no | |
| 276 | +# parser will accept, so the tools/list frame is validated the way the router | |
| 277 | +# will actually consume it (the first cut of this handler emitted the result | |
| 278 | +# object without its closing brace and passed every grep). | |
| 279 | +MJSON=$(printf '%s\n' "$MOUT" | python3 -c ' | |
| 280 | +import sys, json | |
| 281 | +lines = [l for l in sys.stdin.read().splitlines() if l.strip()] | |
| 282 | +assert lines, "no frames at all" | |
| 283 | +parsed = [json.loads(l) for l in lines] | |
| 284 | +tl = [p for p in parsed if "result" in p and "tools" in p["result"]] | |
| 285 | +assert tl, "no tools/list response among %d frames" % len(parsed) | |
| 286 | +tools = tl[0]["result"]["tools"] | |
| 287 | +assert tools, "tools/list returned an empty list" | |
| 288 | +assert any(t.get("name") == "ntfy_send" for t in tools), [t.get("name") for t in tools] | |
| 289 | +for t in tools: | |
| 290 | + assert t.get("description"), "tool without a description" | |
| 291 | + assert isinstance(t.get("inputSchema"), dict), "tool without an inputSchema" | |
| 292 | + assert t["inputSchema"].get("type") == "object", t["inputSchema"].get("type") | |
| 293 | + assert "message" in t["inputSchema"].get("properties", {}), "no message param" | |
| 294 | + assert "message" in t["inputSchema"].get("required", []), "message not required" | |
| 295 | +print("ok") | |
| 296 | +' 2>&1) | |
| 297 | +[ "$MJSON" = "ok" ] && pass "every --mcp frame parses and the tool schema is complete" \ | |
| 298 | + || fail "every --mcp frame parses and the tool schema is complete" "$MJSON" | |
| 271 | 299 | check "tools/list offers ntfy_send" 'ntfy_send' "$MOUT" |
| 272 | 300 | check "the tool schema has message" '"message"' "$MOUT" |
| 273 | 301 | check "the tool schema has priority" '"priority"' "$MOUT" |
| 274 | 302 |
| index 7fc5c2c..d9764e6 100644 | index 7fc5c2c..d9764e6 100644 | ||
| --- a/plugin.json | --- a/plugin.json | ||
| +++ b/plugin.json | +++ b/plugin.json | ||
| @@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
| 6 | "title": "ntfy Push & Pub/Sub Channel Connector", | 6 | "title": "ntfy Push & Pub/Sub Channel Connector", |
| 7 | "summary": "Zero-dependency ntfy connector with two faces: an MCP tool (ntfy_send) so the agent can push alerts and report summaries to your phone, and a supervised channel daemon that subscribes to a topic's NDJSON stream, holds every unknown sender in a default-deny pairing queue, forwards only approved senders' messages to a SCORPIOX BOT session through POST /inbox, and publishes the agent's newest reply back to the publish topic. Setup, pairing approval and a live daemon log live behind node authentication; TLS verification is fail-closed against a bundled root store with an SPKI pin option for self-hosted relays.", | 7 | "summary": "Zero-dependency ntfy connector with two faces: an MCP tool (ntfy_send) so the agent can push alerts and report summaries to your phone, and a supervised channel daemon that subscribes to a topic's NDJSON stream, holds every unknown sender in a default-deny pairing queue, forwards only approved senders' messages to a SCORPIOX BOT session through POST /inbox, and publishes the agent's newest reply back to the publish topic. Setup, pairing approval and a live daemon log live behind node authentication; TLS verification is fail-closed against a bundled root store with an SPKI pin option for self-hosted relays.", |
| 8 | "category": "network", | 8 | "category": "network", |
| 9 | - "version": "1.0.0", | 9 | + "version": "1.0.1", |
| 10 | "license": "MIT", | 10 | "license": "MIT", |
| 11 | "kind": "hybrid", | 11 | "kind": "hybrid", |
| 12 | "mcp": true, | 12 | "mcp": true, |
| index e2fe8bf..cdddcd5 100644 | index e2fe8bf..cdddcd5 100644 | ||
| --- a/src/plugin_ntfy.c | --- a/src/plugin_ntfy.c | ||
| +++ b/src/plugin_ntfy.c | +++ b/src/plugin_ntfy.c | ||
| @@ -100,7 +100,7 @@ | @@ -100,7 +100,7 @@ | ||
| 100 | 100 | ||
| 101 | #define PLUGIN_SLUG "ntfy" | 101 | #define PLUGIN_SLUG "ntfy" |
| 102 | #define PLUGIN_ID "plugin_ntfy" | 102 | #define PLUGIN_ID "plugin_ntfy" |
| 103 | -#define PLUGIN_VER "1.0.0" | 103 | +#define PLUGIN_VER "1.0.1" |
| 104 | #define SELF_SOURCE_ID "scorpiox-bot-plugin-ntfy" | 104 | #define SELF_SOURCE_ID "scorpiox-bot-plugin-ntfy" |
| 105 | 105 | ||
| 106 | /* The tag every notification THIS plugin publishes carries. A second, | 106 | /* The tag every notification THIS plugin publishes carries. A second, |
| @@ -550,9 +550,20 @@ static int mode_mcp(void) | @@ -550,9 +550,20 @@ static int mode_mcp(void) | ||
| 550 | if (has_id) { char b[64]; snprintf(b, sizeof b, "{\"jsonrpc\":\"2.0\",\"id\":%lld,\"result\":{}}", id); mcp_send_raw(b); } | 550 | if (has_id) { char b[64]; snprintf(b, sizeof b, "{\"jsonrpc\":\"2.0\",\"id\":%lld,\"result\":{}}", id); mcp_send_raw(b); } |
| 551 | } else if (!strcmp(method, "tools/list")) { | 551 | } else if (!strcmp(method, "tools/list")) { |
| 552 | if (has_id) { | 552 | if (has_id) { |
| 553 | + /* +64 for the id digits and the closing brace. The closing | ||
| 554 | + * brace of the *outer* object is ours to emit: MCP_TOOLS_JSON | ||
| 555 | + * is the value of "result", so without it the frame is one | ||
| 556 | + * brace short. yyjson then rejects the line, the router | ||
| 557 | + * (scorpiox-connector-mcp proc_request) skips it as "noise on | ||
| 558 | + * stdout", reads again, hits EOF and reports | ||
| 559 | + * "tools/list failed for ntfy: no response" -- the tool would | ||
| 560 | + * be invisible to every agent. A substring grep in the suite | ||
| 561 | + * passed on the broken frame; the assertion that catches this | ||
| 562 | + * now parses every emitted frame. */ | ||
| 553 | char *buf = malloc(strlen(MCP_TOOLS_JSON) + 64); | 563 | char *buf = malloc(strlen(MCP_TOOLS_JSON) + 64); |
| 554 | if (buf) { | 564 | if (buf) { |
| 555 | - sprintf(buf, "{\"jsonrpc\":\"2.0\",\"id\":%lld,\"result\":%s", id, MCP_TOOLS_JSON); | 565 | + sprintf(buf, "{\"jsonrpc\":\"2.0\",\"id\":%lld,\"result\":%s}", |
| 566 | + id, MCP_TOOLS_JSON); | ||
| 556 | mcp_send_raw(buf); | 567 | mcp_send_raw(buf); |
| 557 | free(buf); | 568 | free(buf); |
| 558 | } | 569 | } |
| index 75e317e..3349313 100755 | index 75e317e..3349313 100755 | ||
| --- a/tests/run.sh | --- a/tests/run.sh | ||
| +++ b/tests/run.sh | +++ b/tests/run.sh | ||
| @@ -268,6 +268,34 @@ MOUT=$(printf '%s\n%s\n%s\n' \ | @@ -268,6 +268,34 @@ MOUT=$(printf '%s\n%s\n%s\n' \ | ||
| 268 | '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' | $BIN --mcp) | 268 | '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' | $BIN --mcp) |
| 269 | INIT=$(printf '%s\n' "$MOUT" | head -1) | 269 | INIT=$(printf '%s\n' "$MOUT" | head -1) |
| 270 | json_ok "initialize answers" "$INIT" "d['result']['serverInfo']['name']=='plugin_ntfy' and 'protocolVersion' in d['result']" | 270 | json_ok "initialize answers" "$INIT" "d['result']['serverInfo']['name']=='plugin_ntfy' and 'protocolVersion' in d['result']" |
| 271 | +# Every frame the MCP server prints must be parseable JSON. This is not | ||
| 272 | +# pedantry: scorpiox-connector-mcp's proc_request() treats an unparseable line | ||
| 273 | +# as "noise on stdout", keeps reading, hits EOF and reports | ||
| 274 | +# `tools/list failed for ntfy: no response` - a connector whose tools the | ||
| 275 | +# agent can simply never see. A substring grep passes happily on a frame no | ||
| 276 | +# parser will accept, so the tools/list frame is validated the way the router | ||
| 277 | +# will actually consume it (the first cut of this handler emitted the result | ||
| 278 | +# object without its closing brace and passed every grep). | ||
| 279 | +MJSON=$(printf '%s\n' "$MOUT" | python3 -c ' | ||
| 280 | +import sys, json | ||
| 281 | +lines = [l for l in sys.stdin.read().splitlines() if l.strip()] | ||
| 282 | +assert lines, "no frames at all" | ||
| 283 | +parsed = [json.loads(l) for l in lines] | ||
| 284 | +tl = [p for p in parsed if "result" in p and "tools" in p["result"]] | ||
| 285 | +assert tl, "no tools/list response among %d frames" % len(parsed) | ||
| 286 | +tools = tl[0]["result"]["tools"] | ||
| 287 | +assert tools, "tools/list returned an empty list" | ||
| 288 | +assert any(t.get("name") == "ntfy_send" for t in tools), [t.get("name") for t in tools] | ||
| 289 | +for t in tools: | ||
| 290 | + assert t.get("description"), "tool without a description" | ||
| 291 | + assert isinstance(t.get("inputSchema"), dict), "tool without an inputSchema" | ||
| 292 | + assert t["inputSchema"].get("type") == "object", t["inputSchema"].get("type") | ||
| 293 | + assert "message" in t["inputSchema"].get("properties", {}), "no message param" | ||
| 294 | + assert "message" in t["inputSchema"].get("required", []), "message not required" | ||
| 295 | +print("ok") | ||
| 296 | +' 2>&1) | ||
| 297 | +[ "$MJSON" = "ok" ] && pass "every --mcp frame parses and the tool schema is complete" \ | ||
| 298 | + || fail "every --mcp frame parses and the tool schema is complete" "$MJSON" | ||
| 271 | check "tools/list offers ntfy_send" 'ntfy_send' "$MOUT" | 299 | check "tools/list offers ntfy_send" 'ntfy_send' "$MOUT" |
| 272 | check "the tool schema has message" '"message"' "$MOUT" | 300 | check "the tool schema has message" '"message"' "$MOUT" |
| 273 | check "the tool schema has priority" '"priority"' "$MOUT" | 301 | check "the tool schema has priority" '"priority"' "$MOUT" |
| 274 | 302 |