@bn-shortner/shortener-mcp 0.0.0-stage → 1.0.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BroadNet Technologies LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,43 @@
1
- # Temporary Holding Version
1
+ # BN Shortener MCP server
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Lets AI assistants work with your [BN Shortener](https://b1.lc) account: create and change short links, read
4
+ click statistics, run Launch Check before a campaign, see links that need attention, make QR codes and bio pages.
5
+
6
+ ## Hosted (recommended)
7
+
8
+ Add `https://b1.lc/mcp` as a remote MCP server / custom connector. You sign in to BN Shortener and choose what the
9
+ assistant may do; disconnect it any time in **Settings → Security → Connected Apps**.
10
+
11
+ - Claude (claude.ai, desktop): Settings → Connectors → Add custom connector → `https://b1.lc/mcp`
12
+ - Claude Code: `claude mcp add --transport http bn-shortener https://b1.lc/mcp`
13
+ - VS Code / Cursor and others: a server of type `http` with URL `https://b1.lc/mcp`
14
+
15
+ ## Local (stdio), for clients that only start local servers
16
+
17
+ ```json
18
+ {
19
+ "mcpServers": {
20
+ "bn-shortener": {
21
+ "command": "npx",
22
+ "args": ["-y", "@bn-shortner/shortener-mcp"],
23
+ "env": { "BN_API_KEY": "bn_live_..." }
24
+ }
25
+ }
26
+ }
27
+ ```
28
+
29
+ It forwards to the hosted server with the API key (dashboard: **API Portal → API keys**); the key's permissions
30
+ decide what the assistant can do. Node 20+.
31
+
32
+ ## Tools
33
+
34
+ create_link, list_links, get_link, update_link, archive_link, delete_link (to Trash, 30 days), get_link_stats,
35
+ bulk_create_links, run_launch_check, get_link_health, check_url_safety, create_qr_code (returns the image),
36
+ list_qr_codes, get_qr_code_image, get_qr_code_stats, create_bio_page, add_bio_page_link, list_bio_pages,
37
+ get_account_usage, list_campaigns, create_campaign, add_links_to_campaign, get_campaign_stats, list_utm_presets,
38
+ add_smart_rule, start_ab_test, get_ab_test_results,
39
+ list_domains.
40
+
41
+ ## License
42
+
43
+ MIT
package/bin/bn-mcp.js ADDED
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env node
2
+ // BN Shortener MCP server over stdio, for MCP clients that only start local servers. It forwards every JSON-RPC
3
+ // message to the hosted server (https://b1.lc/mcp) with your API key, so the tools are always the current ones.
4
+ // BN_API_KEY=bn_live_... npx -y @bn-shortner/shortener-mcp
5
+ // Clients that support remote servers can connect to https://b1.lc/mcp directly (sign in with OAuth, no key).
6
+ 'use strict';
7
+ const readline = require('node:readline');
8
+
9
+ const VERSION = '1.0.0';
10
+ const URL_ = process.env.BN_MCP_URL || 'https://b1.lc/mcp';
11
+ const KEY = process.env.BN_API_KEY || '';
12
+ const TIMEOUT_MS = Number(process.env.BN_MCP_TIMEOUT_MS || 120000);
13
+
14
+ const write = (msg) => process.stdout.write(JSON.stringify(msg) + '\n');
15
+ const log = (...a) => process.stderr.write(`[bn-mcp] ${a.join(' ')}\n`);
16
+ const errorFor = (msg, code, message) => (msg && msg.id !== undefined && msg.method ? { jsonrpc: '2.0', id: msg.id, error: { code, message } } : null);
17
+
18
+ async function forward(line) {
19
+ let msg;
20
+ try {
21
+ msg = JSON.parse(line);
22
+ } catch {
23
+ write({ jsonrpc: '2.0', id: null, error: { code: -32700, message: 'Parse error' } });
24
+ return;
25
+ }
26
+ if (!KEY) {
27
+ const e = errorFor(msg, -32001, 'Set BN_API_KEY to a BN Shortener API key (dashboard: API Portal, API keys).');
28
+ if (e) write(e);
29
+ return;
30
+ }
31
+ const ctrl = new AbortController();
32
+ const timer = setTimeout(() => ctrl.abort(), TIMEOUT_MS);
33
+ try {
34
+ const resp = await fetch(URL_, {
35
+ method: 'POST', signal: ctrl.signal,
36
+ headers: { 'Content-Type': 'application/json', Accept: 'application/json, text/event-stream', Authorization: `Bearer ${KEY}`,
37
+ 'User-Agent': `bn-shortener-mcp/${VERSION}` },
38
+ body: line,
39
+ });
40
+ const text = await resp.text();
41
+ if (resp.status === 202 || !text) return; // notification accepted
42
+ if (resp.status === 401) {
43
+ const e = errorFor(msg, -32001, 'BN Shortener refused the API key (BN_API_KEY): it is wrong, revoked or expired.');
44
+ if (e) write(e);
45
+ return;
46
+ }
47
+ let body;
48
+ try {
49
+ body = JSON.parse(text);
50
+ } catch {
51
+ const e = errorFor(msg, -32603, `BN Shortener answered HTTP ${resp.status}`);
52
+ if (e) write(e);
53
+ return;
54
+ }
55
+ if (body && (body.jsonrpc || Array.isArray(body))) {
56
+ write(body);
57
+ } else {
58
+ const e = errorFor(msg, -32603, (body && (body.detail || body.title || body.error_description)) || `HTTP ${resp.status}`);
59
+ if (e) write(e);
60
+ }
61
+ } catch (err) {
62
+ const e = errorFor(msg, -32603, `Could not reach ${URL_}: ${err && err.name === 'AbortError' ? 'timed out' : err.message}`);
63
+ if (e) write(e);
64
+ } finally {
65
+ clearTimeout(timer);
66
+ }
67
+ }
68
+
69
+ if (!KEY) log('BN_API_KEY is not set: every request will fail. Create a key in the dashboard (API Portal, API keys).');
70
+ const rl = readline.createInterface({ input: process.stdin, terminal: false });
71
+ let chain = Promise.resolve(); // answer in order
72
+ rl.on('line', (line) => {
73
+ if (line.trim()) chain = chain.then(() => forward(line));
74
+ });
75
+ rl.on('close', () => chain.then(() => process.exit(0)));
package/package.json CHANGED
@@ -1,6 +1,39 @@
1
1
  {
2
2
  "name": "@bn-shortner/shortener-mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "BN Shortener (b1.lc) MCP server for AI assistants: short links, statistics, Launch Check, QR codes, bio pages",
5
+ "license": "MIT",
6
+ "author": {
7
+ "name": "BroadNet Technologies LLC",
8
+ "email": "support@broadnet.me",
9
+ "url": "https://b1.lc"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/BN-Shortner/bn-shortener-mcp.git"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/BN-Shortner/bn-shortener-mcp/issues",
17
+ "email": "support@broadnet.me"
18
+ },
19
+ "homepage": "https://b1.lc/docs/tools/mcp/",
20
+ "keywords": [
21
+ "mcp",
22
+ "model context protocol",
23
+ "url shortener",
24
+ "qr codes",
25
+ "b1.lc",
26
+ "broadnet"
27
+ ],
28
+ "bin": {
29
+ "bn-mcp": "bin/bn-mcp.js"
30
+ },
31
+ "files": [
32
+ "bin",
33
+ "README.md",
34
+ "LICENSE"
35
+ ],
36
+ "engines": {
37
+ "node": ">=20"
38
+ }
39
+ }