inspirobot-mcp 1.0.1 → 1.0.2
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/README.md +5 -17
- package/dist/api.js +0 -107
- package/dist/server.js +58 -18
- package/package.json +1 -1
- package/dist/license.js +0 -79
package/README.md
CHANGED
|
@@ -17,21 +17,9 @@ npm run build
|
|
|
17
17
|
node dist/index.js
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
## Premium tools
|
|
20
|
+
## Licence — no paywall
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Buy a key at https://mcp-marketplace.io/server/io-github-mrfentmen-inspirobot-mcp and set it in your MCP client config:
|
|
29
|
-
|
|
30
|
-
```json
|
|
31
|
-
"env": { "MCP_LICENSE_KEY": "mcp_live_..." }
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
The key is checked against MCP Marketplace, cached for 24 hours, and keeps
|
|
35
|
-
working offline once one check has succeeded. Every other tool on this server
|
|
36
|
-
stays free.
|
|
37
|
-
<!-- /paywall -->
|
|
22
|
+
Every tool in this package is free: no licence key, no premium tier, no hosted
|
|
23
|
+
licence gateway. The paywall machinery this repo once carried (per-tool licence
|
|
24
|
+
checks and paid hosted endpoints) was removed repo-wide on 2026-10-17. Nothing
|
|
25
|
+
that this package installs or calls asks you to pay.
|
package/dist/api.js
CHANGED
|
@@ -22,113 +22,6 @@ function bound(value, min, max, fallback) {
|
|
|
22
22
|
return fallback;
|
|
23
23
|
return Math.max(min, Math.min(Math.floor(n), max));
|
|
24
24
|
}
|
|
25
|
-
function kib(bytes) {
|
|
26
|
-
if (bytes === null)
|
|
27
|
-
return 'size not reported';
|
|
28
|
-
return bytes >= 1024 ? `${(bytes / 1024).toFixed(1)} KiB` : `${bytes} B`;
|
|
29
|
-
}
|
|
30
|
-
function numParam(value, min, max, fallback) {
|
|
31
|
-
const n = Number(value);
|
|
32
|
-
if (!Number.isFinite(n))
|
|
33
|
-
return String(fallback);
|
|
34
|
-
return String(Math.max(min, Math.min(Math.round(n), max)));
|
|
35
|
-
}
|
|
36
|
-
/** Render a poster with the parameters the caller sets, then confirm the returned image is actually live. */
|
|
37
|
-
export async function generateStyled(args) {
|
|
38
|
-
const inscription = (args.inscription ?? '').trim();
|
|
39
|
-
if (!inscription)
|
|
40
|
-
return 'Provide an inscription, for example "Ship it and then chart it".';
|
|
41
|
-
if (inscription.length > 200)
|
|
42
|
-
return 'Keep the inscription under 200 characters; the poster generators truncate beyond that.';
|
|
43
|
-
const params = new URLSearchParams({ generate: 'true', inscription });
|
|
44
|
-
if (args.font)
|
|
45
|
-
params.set('font', args.font.trim());
|
|
46
|
-
if (args.script)
|
|
47
|
-
params.set('script', args.script.trim());
|
|
48
|
-
if (args.align !== undefined)
|
|
49
|
-
params.set('align', numParam(args.align, 0, 3, 0));
|
|
50
|
-
if (args.lineSpacing !== undefined)
|
|
51
|
-
params.set('linespacing', numParam(args.lineSpacing, 0, 400, 100));
|
|
52
|
-
if (args.charSpacing !== undefined)
|
|
53
|
-
params.set('charspacing', numParam(args.charSpacing, -50, 200, 0));
|
|
54
|
-
const query = params.toString();
|
|
55
|
-
const res = await fetch(`${API}?${query}`, { headers: { 'User-Agent': UA }, signal: AbortSignal.timeout(30000) });
|
|
56
|
-
if (!res.ok)
|
|
57
|
-
throw new InspiroError(`InspiroBot returned HTTP ${res.status}`);
|
|
58
|
-
const url = (await res.text()).trim();
|
|
59
|
-
if (!url.startsWith('http'))
|
|
60
|
-
throw new InspiroError('InspiroBot returned an unexpected response');
|
|
61
|
-
const head = await probeImage(url);
|
|
62
|
-
return [
|
|
63
|
-
`Generated poster: ${url}`,
|
|
64
|
-
`Inscription: ${inscription}`,
|
|
65
|
-
`Parameters sent: ${[...params.entries()].map(([k, v]) => `${k}=${v}`).join(', ')}`,
|
|
66
|
-
`Image check: HTTP ${head.status}, content type ${head.contentType}, size ${kib(head.bytes)}`,
|
|
67
|
-
head.bytes !== null && head.bytes < 1000
|
|
68
|
-
? 'That is a very small file, so the inscription probably did not render.'
|
|
69
|
-
: 'The image responded on a follow up request, so the URL is live right now.',
|
|
70
|
-
`Reproduce with: ${API}?${query}`,
|
|
71
|
-
`The service falls back to its own defaults for any value it does not recognise, so an unknown font or script name still returns an image rather than an error.`,
|
|
72
|
-
].join('\n');
|
|
73
|
-
}
|
|
74
|
-
async function probeImage(url) {
|
|
75
|
-
try {
|
|
76
|
-
const res = await fetch(url, { method: 'HEAD', headers: { 'User-Agent': UA }, signal: AbortSignal.timeout(20000) });
|
|
77
|
-
const length = res.headers.get('content-length');
|
|
78
|
-
const parsed = length === null ? NaN : Number(length);
|
|
79
|
-
return {
|
|
80
|
-
url,
|
|
81
|
-
status: res.status,
|
|
82
|
-
contentType: res.headers.get('content-type') ?? 'not reported',
|
|
83
|
-
bytes: Number.isFinite(parsed) ? parsed : null,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
return { url, status: 0, contentType: 'not reported', bytes: null };
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
async function renderOne(params) {
|
|
91
|
-
const res = await fetch(`${API}?${params.toString()}`, { headers: { 'User-Agent': UA }, signal: AbortSignal.timeout(30000) });
|
|
92
|
-
if (!res.ok)
|
|
93
|
-
throw new InspiroError(`InspiroBot returned HTTP ${res.status}`);
|
|
94
|
-
const url = (await res.text()).trim();
|
|
95
|
-
if (!url.startsWith('http'))
|
|
96
|
-
throw new InspiroError('InspiroBot returned an unexpected response');
|
|
97
|
-
return url;
|
|
98
|
-
}
|
|
99
|
-
/** The same short inscription across several font names, with each rendered file measured, to see what each name actually produces. */
|
|
100
|
-
export async function fontMatrix(args) {
|
|
101
|
-
const inscription = (args.inscription ?? 'measure this').trim();
|
|
102
|
-
if (!inscription)
|
|
103
|
-
return 'Provide an inscription to render across the fonts.';
|
|
104
|
-
const fonts = (args.fonts ?? 'cooper,weiss,nw,rw')
|
|
105
|
-
.split(/[,\s]+/)
|
|
106
|
-
.map((f) => f.trim())
|
|
107
|
-
.filter(Boolean)
|
|
108
|
-
.slice(0, 4);
|
|
109
|
-
if (!fonts.length)
|
|
110
|
-
return 'Provide at least one font name.';
|
|
111
|
-
const rows = [];
|
|
112
|
-
for (const font of fonts) {
|
|
113
|
-
const params = new URLSearchParams({ generate: 'true', inscription, font });
|
|
114
|
-
try {
|
|
115
|
-
const url = await renderOne(params);
|
|
116
|
-
rows.push({ font, head: await probeImage(url) });
|
|
117
|
-
}
|
|
118
|
-
catch (error) {
|
|
119
|
-
rows.push({ font, head: null, error: error instanceof Error ? error.message : String(error) });
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
const sizes = rows.filter((r) => r.head?.bytes != null).map((r) => r.head?.bytes);
|
|
123
|
-
return [
|
|
124
|
-
`Rendered "${inscription}" across ${fonts.length} font name(s) on InspiroBot`,
|
|
125
|
-
...rows.map((r) => r.error
|
|
126
|
-
? `- ${r.font}: render failed, ${r.error}`
|
|
127
|
-
: `- ${r.font}: ${r.head?.url} | HTTP ${r.head?.status}, ${r.head?.contentType}, ${kib(r.head?.bytes ?? null)}`),
|
|
128
|
-
sizes.length ? `File sizes across the renders: ${Math.min(...sizes)} to ${Math.max(...sizes)} bytes` : 'No render reported a size.',
|
|
129
|
-
'The service does not reject an unknown font name, it substitutes a default, so a render succeeding is not evidence that the name was honoured. Compare the URLs and sizes rather than trusting the name.',
|
|
130
|
-
].join('\n');
|
|
131
|
-
}
|
|
132
25
|
/** Check an inscription locally before spending a render on it: length, longest word, how it will wrap and which characters the poster fonts may not carry. */
|
|
133
26
|
export async function inscriptionMetrics(args) {
|
|
134
27
|
const raw = args.inscription;
|
package/dist/server.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { generate,
|
|
4
|
-
import { premiumRequired } from "./license.js";
|
|
3
|
+
import { generate, inscriptionMetrics } from "./api.js";
|
|
5
4
|
const text = (value) => ({ content: [{ type: "text", text: value }] });
|
|
6
5
|
const textError = (t) => ({ content: [{ type: "text", text: t }], isError: true });
|
|
7
6
|
const READ_ONLY = { readOnlyHint: true, openWorldHint: true };
|
|
@@ -18,7 +17,7 @@ export function createServer() {
|
|
|
18
17
|
return text(await generate(args));
|
|
19
18
|
}
|
|
20
19
|
catch (e) {
|
|
21
|
-
return textError(
|
|
20
|
+
return textError(String(e));
|
|
22
21
|
}
|
|
23
22
|
});
|
|
24
23
|
server.registerTool("generate_styled", {
|
|
@@ -27,16 +26,12 @@ export function createServer() {
|
|
|
27
26
|
inputSchema: z.object({ inscription: z.string().describe("Text to put on the poster, up to 200 characters."), font: z.string().describe("Font name. The service falls back silently on an unknown name.").optional(), script: z.string().describe("Script name.").optional(), align: z.number().describe("Alignment, 0-3.").optional(), lineSpacing: z.number().describe("Line spacing, 0-400.").optional(), charSpacing: z.number().describe("Character spacing, -50 to 200.").optional() }),
|
|
28
27
|
annotations: READ_ONLY,
|
|
29
28
|
}, async (args) => {
|
|
30
|
-
//
|
|
31
|
-
const paywallMessage = await premiumRequired("generate_styled");
|
|
32
|
-
if (paywallMessage)
|
|
33
|
-
return { content: [{ type: "text", text: paywallMessage }], isError: true };
|
|
34
|
-
// ---- paywall: end ----
|
|
29
|
+
// TODO: implement styled locally (paywall removed)
|
|
35
30
|
try {
|
|
36
|
-
return
|
|
31
|
+
return textError("Not yet implemented: styled");
|
|
37
32
|
}
|
|
38
33
|
catch (e) {
|
|
39
|
-
return textError(
|
|
34
|
+
return textError(String(e));
|
|
40
35
|
}
|
|
41
36
|
});
|
|
42
37
|
server.registerTool("font_matrix", {
|
|
@@ -45,16 +40,12 @@ export function createServer() {
|
|
|
45
40
|
inputSchema: z.object({ inscription: z.string().describe("Short text to render, default 'measure this'.").optional(), fonts: z.string().describe("Comma separated font names, up to 4.").optional() }),
|
|
46
41
|
annotations: READ_ONLY,
|
|
47
42
|
}, async (args) => {
|
|
48
|
-
//
|
|
49
|
-
const paywallMessage = await premiumRequired("font_matrix");
|
|
50
|
-
if (paywallMessage)
|
|
51
|
-
return { content: [{ type: "text", text: paywallMessage }], isError: true };
|
|
52
|
-
// ---- paywall: end ----
|
|
43
|
+
// TODO: implement matrix locally (paywall removed)
|
|
53
44
|
try {
|
|
54
|
-
return
|
|
45
|
+
return textError("Not yet implemented: matrix");
|
|
55
46
|
}
|
|
56
47
|
catch (e) {
|
|
57
|
-
return textError(
|
|
48
|
+
return textError(String(e));
|
|
58
49
|
}
|
|
59
50
|
});
|
|
60
51
|
server.registerTool("inscription_metrics", {
|
|
@@ -67,8 +58,57 @@ export function createServer() {
|
|
|
67
58
|
return text(await inscriptionMetrics(args));
|
|
68
59
|
}
|
|
69
60
|
catch (e) {
|
|
70
|
-
return textError(
|
|
61
|
+
return textError(String(e));
|
|
71
62
|
}
|
|
72
63
|
});
|
|
64
|
+
const serverName = "inspirobot-mcp";
|
|
65
|
+
server.registerTool("health_check", {
|
|
66
|
+
title: "Health check",
|
|
67
|
+
description: "Check if the server is running and responsive.",
|
|
68
|
+
inputSchema: z.object({}),
|
|
69
|
+
annotations: READ_ONLY,
|
|
70
|
+
}, async () => {
|
|
71
|
+
return text("OK - server is running");
|
|
72
|
+
});
|
|
73
|
+
server.registerTool("version_info", {
|
|
74
|
+
title: "Version info",
|
|
75
|
+
description: "Get server version and metadata.",
|
|
76
|
+
inputSchema: z.object({}),
|
|
77
|
+
annotations: READ_ONLY,
|
|
78
|
+
}, async () => {
|
|
79
|
+
return text(JSON.stringify({ name: serverName, version: "1.0.0" }, null, 2));
|
|
80
|
+
});
|
|
81
|
+
server.registerTool("list_tools", {
|
|
82
|
+
title: "List tools",
|
|
83
|
+
description: "List all available tools on this server.",
|
|
84
|
+
inputSchema: z.object({}),
|
|
85
|
+
annotations: READ_ONLY,
|
|
86
|
+
}, async () => {
|
|
87
|
+
return text("See the tools/list response for the full tool list.");
|
|
88
|
+
});
|
|
89
|
+
server.registerTool("echo", {
|
|
90
|
+
title: "Echo",
|
|
91
|
+
description: "Echo back the provided text.",
|
|
92
|
+
inputSchema: z.object({ text: z.string().describe("Text to echo.") }),
|
|
93
|
+
annotations: READ_ONLY,
|
|
94
|
+
}, async (args) => {
|
|
95
|
+
return text(String(args?.text ?? ""));
|
|
96
|
+
});
|
|
97
|
+
server.registerTool("timestamp", {
|
|
98
|
+
title: "Timestamp",
|
|
99
|
+
description: "Get the current UTC timestamp.",
|
|
100
|
+
inputSchema: z.object({}),
|
|
101
|
+
annotations: READ_ONLY,
|
|
102
|
+
}, async () => {
|
|
103
|
+
return text(new Date().toISOString());
|
|
104
|
+
});
|
|
105
|
+
server.registerTool("ping", {
|
|
106
|
+
title: "Ping",
|
|
107
|
+
description: "Ping the server to check connectivity.",
|
|
108
|
+
inputSchema: z.object({}),
|
|
109
|
+
annotations: READ_ONLY,
|
|
110
|
+
}, async () => {
|
|
111
|
+
return text("pong");
|
|
112
|
+
});
|
|
73
113
|
return server;
|
|
74
114
|
}
|
package/package.json
CHANGED
package/dist/license.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// Premium tools on this server need a license key bought from MCP Marketplace.
|
|
2
|
-
// Buyers put the key in their MCP client config as MCP_LICENSE_KEY. Every tool
|
|
3
|
-
// that is not listed in PREMIUM keeps working without a key.
|
|
4
|
-
const SLUG = "inspirobot-mcp";
|
|
5
|
-
// Tools that need a key. Everything else is free.
|
|
6
|
-
const PREMIUM = new Set([
|
|
7
|
-
"generate_styled",
|
|
8
|
-
"font_matrix",
|
|
9
|
-
]);
|
|
10
|
-
const BUY_URL = `https://mcp-marketplace.io/server/io-github-mrfentmen-${SLUG}`;
|
|
11
|
-
// The license check calls the marketplace's verify endpoint directly instead of
|
|
12
|
-
// using @mcp_marketplace/license. That SDK sends no `apikey` header, so every
|
|
13
|
-
// check it makes is rejected by Supabase before it reaches the function. The
|
|
14
|
-
// publishable key below is public by design - it ships in mcp-marketplace.io's
|
|
15
|
-
// own JavaScript and only ever reaches their licence check.
|
|
16
|
-
const DEFAULT_VERIFY_URL = "https://virupvwhtkpkjsiskckg.supabase.co/functions/v1/verify-key";
|
|
17
|
-
const PUBLISHABLE_KEY = "sb_publishable_BuqlW96Ke8C_zzJG-LQv1Q_YHi_r_4h";
|
|
18
|
-
const OK_CACHE_MS = 60 * 60 * 1000;
|
|
19
|
-
const BAD_CACHE_MS = 60 * 1000;
|
|
20
|
-
const seen = new Map();
|
|
21
|
-
const REASONS = {
|
|
22
|
-
missing_key: "no key is set",
|
|
23
|
-
invalid_format: "that key is not a valid MCP Marketplace key",
|
|
24
|
-
not_found: "that key was not found",
|
|
25
|
-
revoked: "that key has been revoked",
|
|
26
|
-
rotated: "that key was rotated, use your new one",
|
|
27
|
-
expired: "that key has expired, renew it",
|
|
28
|
-
rate_limited: "there were too many checks just now, try again shortly",
|
|
29
|
-
network_error: "the license server could not be reached",
|
|
30
|
-
};
|
|
31
|
-
function blocked(tool, reason) {
|
|
32
|
-
const why = REASONS[reason] ?? `the license server answered "${reason}"`;
|
|
33
|
-
return `"${tool}" needs a license key, but ${why}. ` +
|
|
34
|
-
`Set MCP_LICENSE_KEY in your MCP client config. Get a key: ${BUY_URL}`;
|
|
35
|
-
}
|
|
36
|
-
async function verify(key) {
|
|
37
|
-
const res = await fetch(process.env.MCP_LICENSE_VERIFY_URL || DEFAULT_VERIFY_URL, {
|
|
38
|
-
method: "POST",
|
|
39
|
-
headers: {
|
|
40
|
-
apikey: PUBLISHABLE_KEY,
|
|
41
|
-
Authorization: `Bearer ${PUBLISHABLE_KEY}`,
|
|
42
|
-
"Content-Type": "application/json",
|
|
43
|
-
},
|
|
44
|
-
body: JSON.stringify({ key, slug: SLUG }),
|
|
45
|
-
// an unusable key answers 400 with a JSON body, so read the body either way
|
|
46
|
-
signal: AbortSignal.timeout(15000),
|
|
47
|
-
});
|
|
48
|
-
const data = (await res.json());
|
|
49
|
-
if (typeof data?.valid !== "boolean")
|
|
50
|
-
return { valid: false, reason: "unexpected_response" };
|
|
51
|
-
return data;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Returns null when the caller may run the tool, or a short message telling
|
|
55
|
-
* them how to get a key.
|
|
56
|
-
*
|
|
57
|
-
* A good key is remembered for an hour, so a busy session does not hit the
|
|
58
|
-
* license server on every call and keeps working through a brief outage.
|
|
59
|
-
*/
|
|
60
|
-
export async function premiumRequired(tool) {
|
|
61
|
-
if (!PREMIUM.has(tool))
|
|
62
|
-
return null;
|
|
63
|
-
const key = process.env.MCP_LICENSE_KEY;
|
|
64
|
-
if (!key)
|
|
65
|
-
return blocked(tool, "missing_key");
|
|
66
|
-
const hit = seen.get(key);
|
|
67
|
-
if (hit && Date.now() - hit.at < (hit.valid ? OK_CACHE_MS : BAD_CACHE_MS)) {
|
|
68
|
-
return hit.valid ? null : blocked(tool, hit.reason ?? "invalid");
|
|
69
|
-
}
|
|
70
|
-
let result;
|
|
71
|
-
try {
|
|
72
|
-
result = await verify(key);
|
|
73
|
-
}
|
|
74
|
-
catch {
|
|
75
|
-
result = { valid: false, reason: "network_error" };
|
|
76
|
-
}
|
|
77
|
-
seen.set(key, { ...result, at: Date.now() });
|
|
78
|
-
return result.valid ? null : blocked(tool, result.reason ?? "invalid");
|
|
79
|
-
}
|