baconipsum-mcp 1.0.4 → 1.0.6

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 CHANGED
@@ -19,4 +19,9 @@ node dist/index.js
19
19
 
20
20
  Data comes from the public Bacon Ipsum API.
21
21
 
22
+ ## Licence — no paywall
22
23
 
24
+ Every tool in this package is free: no licence key, no premium tier, no hosted
25
+ licence gateway. The paywall machinery this repo once carried (per-tool licence
26
+ checks and paid hosted endpoints) was removed repo-wide on 2026-10-17. Nothing
27
+ that this package installs or calls asks you to pay.
package/dist/api.js CHANGED
@@ -19,3 +19,41 @@ export async function generate(args) {
19
19
  // paragraph blocks the API can produce, in JSON, HTML or plain text, and refuses
20
20
  // a type the API would silently ignore.
21
21
  const TYPES = ['meat-and-filler', 'all-meat'];
22
+
23
+ const PARAGRAPH_TYPES = ['meat-and-filler', 'all-meat'];
24
+ const PARAGRAPH_FORMATS = ['json', 'html', 'text'];
25
+ export async function paragraphs(args = {}) {
26
+ const paras = Math.min(Math.max(Number(args?.paras ?? 3) || 3, 1), 10);
27
+ const type = String(args?.type ?? 'meat-and-filler').trim().toLowerCase();
28
+ if (!PARAGRAPH_TYPES.includes(type))
29
+ throw new Error(`Unknown type "${args?.type}". Use meat-and-filler or all-meat.`);
30
+ const format = String(args?.format ?? 'json').trim().toLowerCase();
31
+ if (!PARAGRAPH_FORMATS.includes(format))
32
+ throw new Error(`Unknown format "${args?.format}". Use json, html or text.`);
33
+ const qs = new URLSearchParams({ type, paras: String(paras), format });
34
+ if (args?.startWithLorem)
35
+ qs.set('start-with-lorem', '1');
36
+ const res = await fetch(`${BASE}?${qs}`, {
37
+ headers: { 'User-Agent': 'mrfentmen-baconipsum-mcp/1.0', Accept: 'text/plain, application/json' },
38
+ signal: AbortSignal.timeout(20000),
39
+ });
40
+ if (!res.ok)
41
+ throw new Error(`Bacon Ipsum returned ${res.status}`);
42
+ const body = await res.text();
43
+ if (format === 'json') {
44
+ let blocks;
45
+ try {
46
+ blocks = JSON.parse(body);
47
+ }
48
+ catch {
49
+ throw new Error('Bacon Ipsum returned unreadable JSON');
50
+ }
51
+ if (!Array.isArray(blocks) || !blocks.length)
52
+ throw new Error('Bacon Ipsum returned no paragraphs');
53
+ return blocks.map((b, i) => `${i + 1}. ${String(b).trim()}`).join('\n\n');
54
+ }
55
+ const trimmed = body.trim();
56
+ if (!trimmed)
57
+ throw new Error('Bacon Ipsum returned no paragraphs');
58
+ return trimmed;
59
+ }
package/dist/server.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { z } from "zod";
3
- import { generate } from "./api.js";
3
+ import { generate, paragraphs } from "./api.js";
4
4
  const text = (value) => ({ content: [{ type: "text", text: value }] });
5
5
  const textError = (t) => ({ content: [{ type: "text", text: t }], isError: true });
6
6
  const READ_ONLY = { readOnlyHint: true, openWorldHint: true };
@@ -26,9 +26,8 @@ export function createServer() {
26
26
  inputSchema: z.object({ paras: z.number().describe("How many paragraphs, 1-10. Defaults to 3.").optional(), type: z.string().describe("meat-and-filler or all-meat. Defaults to meat-and-filler.").optional(), startWithLorem: z.boolean().describe("Start with 'Bacon ipsum dolor amet' instead of random words.").optional(), format: z.string().describe("json, html or text. Defaults to json.").optional() }),
27
27
  annotations: READ_ONLY,
28
28
  }, async (args) => {
29
- // TODO: implement paragraphs locally (paywall removed)
30
29
  try {
31
- return textError("Not yet implemented: paragraphs");
30
+ return text(await paragraphs(args));
32
31
  }
33
32
  catch (e) {
34
33
  return textError(String(e));
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.4",
2
+ "version": "1.0.6",
3
3
  "type": "module",
4
4
  "repository": {
5
5
  "type": "git",
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/mrfentmen/baconipsum-mcp",
7
7
  "source": "github"
8
8
  },
9
- "version": "1.0.1",
9
+ "version": "1.0.6",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "baconipsum-mcp",
14
- "version": "1.0.1",
14
+ "version": "1.0.6",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  }