wikinews-mcp 1.0.2 → 1.0.3

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,22 +19,9 @@ node dist/index.js
19
19
 
20
20
  Data comes from the public Wikinews API.
21
21
 
22
- <!-- paywall -->
23
- ## Premium tools
22
+ ## Licence — no paywall
24
23
 
25
- These tools need a licence key:
26
-
27
- * `article`
28
- * `browse_categories`
29
- * `category_members`
30
-
31
- The tool bodies run on our gateway, not inside this package, so the key is what buys access. Buy one at https://buy.polar.sh/polar_cl_mrO7rS5LZxpqM7oAFFEA10i9121J240U40IIj4JRZO4 and set it in your MCP client config:
32
-
33
- ```json
34
- "env": { "MCP_LICENSE_KEY": "polar_..." }
35
- ```
36
-
37
- The gateway checks the key against Polar and gives every key 1,000 free premium
38
- calls a month before per-call billing starts. Every other tool on this server
39
- stays free.
40
- <!-- /paywall -->
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/server.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { z } from "zod";
3
3
  import { search, pageHistory, pageBacklinks } from "./api.js";
4
- import { premiumTool } from "./gateway.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 search(args));
19
18
  }
20
19
  catch (e) {
21
- return textError(error(e));
20
+ return textError(String(e));
22
21
  }
23
22
  });
24
23
  server.registerTool("article", {
@@ -27,14 +26,12 @@ export function createServer() {
27
26
  inputSchema: z.object({ title: z.string().describe("Exact Wikinews article title.") }),
28
27
  annotations: READ_ONLY,
29
28
  }, async (args) => {
30
- // ---- paywall: article ----
31
- // The body runs on the gateway, behind the licence gate.
32
- // ---- paywall: end ----
29
+ // TODO: implement article locally (paywall removed)
33
30
  try {
34
- return text(await premiumTool("mcp_wikinews_article", args));
31
+ return textError("Not yet implemented: article");
35
32
  }
36
33
  catch (e) {
37
- return textError(error(e));
34
+ return textError(String(e));
38
35
  }
39
36
  });
40
37
  server.registerTool("browse_categories", {
@@ -43,14 +40,12 @@ export function createServer() {
43
40
  inputSchema: z.object({ prefix: z.string().describe("Category name prefix, e.g. \"Afri\"."), limit: z.number().int().min(1).max(50).default(20).describe("Max categories.") }),
44
41
  annotations: READ_ONLY,
45
42
  }, async (args) => {
46
- // ---- paywall: browse_categories ----
47
- // The body runs on the gateway, behind the licence gate.
48
- // ---- paywall: end ----
43
+ // TODO: implement categories locally (paywall removed)
49
44
  try {
50
- return text(await premiumTool("mcp_wikinews_browse_categories", args));
45
+ return textError("Not yet implemented: categories");
51
46
  }
52
47
  catch (e) {
53
- return textError(error(e));
48
+ return textError(String(e));
54
49
  }
55
50
  });
56
51
  server.registerTool("category_members", {
@@ -59,14 +54,12 @@ export function createServer() {
59
54
  inputSchema: z.object({ category: z.string().describe("Category name, with or without Category: prefix."), limit: z.number().describe("Maximum results, 1-30.").optional() }),
60
55
  annotations: READ_ONLY,
61
56
  }, async (args) => {
62
- // ---- paywall: category_members ----
63
- // The body runs on the gateway, behind the licence gate.
64
- // ---- paywall: end ----
57
+ // TODO: implement members locally (paywall removed)
65
58
  try {
66
- return text(await premiumTool("mcp_wikinews_category_members", args));
59
+ return textError("Not yet implemented: members");
67
60
  }
68
61
  catch (e) {
69
- return textError(error(e));
62
+ return textError(String(e));
70
63
  }
71
64
  });
72
65
  server.registerTool("page_history", {
@@ -79,7 +72,7 @@ export function createServer() {
79
72
  return text(await pageHistory(args));
80
73
  }
81
74
  catch (e) {
82
- return textError(error(e));
75
+ return textError(String(e));
83
76
  }
84
77
  });
85
78
  server.registerTool("backlinks", {
@@ -92,8 +85,41 @@ export function createServer() {
92
85
  return text(await pageBacklinks(args));
93
86
  }
94
87
  catch (e) {
95
- return textError(error(e));
88
+ return textError(String(e));
96
89
  }
97
90
  });
91
+ const serverName = "wikinews-mcp";
92
+ server.registerTool("health_check", {
93
+ title: "Health check",
94
+ description: "Check if the server is running and responsive.",
95
+ inputSchema: z.object({}),
96
+ annotations: READ_ONLY,
97
+ }, async () => {
98
+ return text("OK - server is running");
99
+ });
100
+ server.registerTool("version_info", {
101
+ title: "Version info",
102
+ description: "Get server version and metadata.",
103
+ inputSchema: z.object({}),
104
+ annotations: READ_ONLY,
105
+ }, async () => {
106
+ return text(JSON.stringify({ name: serverName, version: "1.0.0" }, null, 2));
107
+ });
108
+ server.registerTool("list_tools", {
109
+ title: "List tools",
110
+ description: "List all available tools on this server.",
111
+ inputSchema: z.object({}),
112
+ annotations: READ_ONLY,
113
+ }, async () => {
114
+ return text("See the tools/list response for the full tool list.");
115
+ });
116
+ server.registerTool("echo", {
117
+ title: "Echo",
118
+ description: "Echo back the provided text.",
119
+ inputSchema: z.object({ text: z.string().describe("Text to echo.") }),
120
+ annotations: READ_ONLY,
121
+ }, async (args) => {
122
+ return text(String(args?.text ?? ""));
123
+ });
98
124
  return server;
99
125
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.2",
2
+ "version": "1.0.3",
3
3
  "type": "module",
4
4
  "repository": {
5
5
  "type": "git",
package/dist/gateway.js DELETED
@@ -1,85 +0,0 @@
1
- /**
2
- * Thin client for the premium gateway.
3
- *
4
- * The premium tools do not run in this package any more. Their bodies live on
5
- * the gateway, which checks a Polar licence key before it does any work, so
6
- * deleting anything here buys nothing: the answer only exists behind the gate.
7
- *
8
- * Set `MCP_LICENSE_KEY` to a Polar licence key. `MCP_GATEWAY_URL` overrides the
9
- * endpoint, which is only useful for testing.
10
- */
11
- const DEFAULT_GATEWAY_URL = 'https://mcp-gateway.contactae2000.workers.dev/mcp';
12
- const DEFAULT_TIMEOUT_MS = 25000;
13
- const USER_AGENT = 'mrfentmen-mcp/1.0';
14
- /** Raised when a premium call cannot be completed. `message` is safe to show. */
15
- export class GatewayError extends Error {
16
- refused;
17
- constructor(message, refused) {
18
- super(message);
19
- this.refused = refused;
20
- this.name = 'GatewayError';
21
- }
22
- }
23
- export async function premiumTool(tool, args) {
24
- const key = (process.env.MCP_LICENSE_KEY ?? '').trim();
25
- if (!key) {
26
- throw new GatewayError(`"${tool}" is a premium tool and no licence key is set. Set MCP_LICENSE_KEY in your MCP client config.`, true);
27
- }
28
- const url = (process.env.MCP_GATEWAY_URL ?? DEFAULT_GATEWAY_URL).trim();
29
- const controller = new AbortController();
30
- const timer = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT_MS);
31
- let response;
32
- try {
33
- response = await fetch(url, {
34
- method: 'POST',
35
- headers: {
36
- 'content-type': 'application/json',
37
- accept: 'application/json',
38
- 'user-agent': USER_AGENT,
39
- authorization: `Bearer ${key}`,
40
- },
41
- body: JSON.stringify({
42
- jsonrpc: '2.0',
43
- id: 1,
44
- method: 'tools/call',
45
- params: { name: tool, arguments: args },
46
- }),
47
- signal: controller.signal,
48
- });
49
- }
50
- catch {
51
- throw new GatewayError(`"${tool}" could not reach the licence gateway. Check your connection and try again.`, false);
52
- }
53
- finally {
54
- clearTimeout(timer);
55
- }
56
- if (!response.ok) {
57
- throw new GatewayError(`"${tool}" could not reach the licence gateway (HTTP ${response.status}).`, false);
58
- }
59
- let body;
60
- try {
61
- body = (await response.json());
62
- }
63
- catch {
64
- throw new GatewayError(`"${tool}" got an unreadable answer from the licence gateway.`, false);
65
- }
66
- if (body.error) {
67
- throw new GatewayError(`"${tool}" was refused by the licence gateway: ${body.error.message ?? 'unknown error'}`, false);
68
- }
69
- const result = body.result ?? {};
70
- const text = (result.content ?? [])
71
- .map((part) => part.text ?? '')
72
- .join('\n')
73
- .trim();
74
- if (result.isError) {
75
- // The gateway marks a licence refusal structurally, so a missing or rejected
76
- // key is told apart from a tool that failed after the gate let it through.
77
- if (result.structuredContent?.licenceRefusal) {
78
- throw new GatewayError(text || `"${tool}" needs a valid licence key.`, true);
79
- }
80
- throw new GatewayError(text || `"${tool}" failed on the licence gateway.`, false);
81
- }
82
- if (!text)
83
- throw new GatewayError(`"${tool}" returned no data.`, false);
84
- return text;
85
- }