@xiedada/nodemw-mcp-server 0.0.1 → 0.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.
Files changed (195) hide show
  1. package/LICENSE +24 -166
  2. package/README.md +124 -145
  3. package/dist/index.js +36 -63
  4. package/dist/index.js.map +7 -1
  5. package/package.json +5 -11
  6. package/dist/common/nodemwBot.d.ts +0 -21
  7. package/dist/common/nodemwBot.d.ts.map +0 -1
  8. package/dist/common/nodemwBot.js +0 -62
  9. package/dist/common/nodemwBot.js.map +0 -1
  10. package/dist/common/utils.d.ts +0 -7
  11. package/dist/common/utils.d.ts.map +0 -1
  12. package/dist/common/utils.js +0 -38
  13. package/dist/common/utils.js.map +0 -1
  14. package/dist/index.d.ts +0 -3
  15. package/dist/index.d.ts.map +0 -1
  16. package/dist/server.d.ts +0 -4
  17. package/dist/server.d.ts.map +0 -1
  18. package/dist/server.js +0 -9
  19. package/dist/server.js.map +0 -1
  20. package/dist/tools/editing/add-flow-topic.d.ts +0 -3
  21. package/dist/tools/editing/add-flow-topic.d.ts.map +0 -1
  22. package/dist/tools/editing/add-flow-topic.js +0 -25
  23. package/dist/tools/editing/add-flow-topic.js.map +0 -1
  24. package/dist/tools/editing/append.d.ts +0 -3
  25. package/dist/tools/editing/append.d.ts.map +0 -1
  26. package/dist/tools/editing/append.js +0 -26
  27. package/dist/tools/editing/append.js.map +0 -1
  28. package/dist/tools/editing/create-account.d.ts +0 -3
  29. package/dist/tools/editing/create-account.d.ts.map +0 -1
  30. package/dist/tools/editing/create-account.js +0 -24
  31. package/dist/tools/editing/create-account.js.map +0 -1
  32. package/dist/tools/editing/delete.d.ts +0 -3
  33. package/dist/tools/editing/delete.d.ts.map +0 -1
  34. package/dist/tools/editing/delete.js +0 -25
  35. package/dist/tools/editing/delete.js.map +0 -1
  36. package/dist/tools/editing/edit.d.ts +0 -3
  37. package/dist/tools/editing/edit.d.ts.map +0 -1
  38. package/dist/tools/editing/edit.js +0 -27
  39. package/dist/tools/editing/edit.js.map +0 -1
  40. package/dist/tools/editing/move.d.ts +0 -3
  41. package/dist/tools/editing/move.d.ts.map +0 -1
  42. package/dist/tools/editing/move.js +0 -26
  43. package/dist/tools/editing/move.js.map +0 -1
  44. package/dist/tools/editing/prepend.d.ts +0 -3
  45. package/dist/tools/editing/prepend.d.ts.map +0 -1
  46. package/dist/tools/editing/prepend.js +0 -26
  47. package/dist/tools/editing/prepend.js.map +0 -1
  48. package/dist/tools/editing/protect.d.ts +0 -3
  49. package/dist/tools/editing/protect.d.ts.map +0 -1
  50. package/dist/tools/editing/protect.js +0 -37
  51. package/dist/tools/editing/protect.js.map +0 -1
  52. package/dist/tools/editing/purge.d.ts +0 -3
  53. package/dist/tools/editing/purge.d.ts.map +0 -1
  54. package/dist/tools/editing/purge.js +0 -23
  55. package/dist/tools/editing/purge.js.map +0 -1
  56. package/dist/tools/editing/send-email.d.ts +0 -3
  57. package/dist/tools/editing/send-email.d.ts.map +0 -1
  58. package/dist/tools/editing/send-email.js +0 -25
  59. package/dist/tools/editing/send-email.js.map +0 -1
  60. package/dist/tools/editing/upload-by-url.d.ts +0 -3
  61. package/dist/tools/editing/upload-by-url.d.ts.map +0 -1
  62. package/dist/tools/editing/upload-by-url.js +0 -26
  63. package/dist/tools/editing/upload-by-url.js.map +0 -1
  64. package/dist/tools/editing/upload.d.ts +0 -3
  65. package/dist/tools/editing/upload.d.ts.map +0 -1
  66. package/dist/tools/editing/upload.js +0 -27
  67. package/dist/tools/editing/upload.js.map +0 -1
  68. package/dist/tools/index.d.ts +0 -3
  69. package/dist/tools/index.d.ts.map +0 -1
  70. package/dist/tools/index.js +0 -105
  71. package/dist/tools/index.js.map +0 -1
  72. package/dist/tools/ro/expand-templates.d.ts +0 -3
  73. package/dist/tools/ro/expand-templates.d.ts.map +0 -1
  74. package/dist/tools/ro/expand-templates.js +0 -28
  75. package/dist/tools/ro/expand-templates.js.map +0 -1
  76. package/dist/tools/ro/get-all-pages.d.ts +0 -3
  77. package/dist/tools/ro/get-all-pages.d.ts.map +0 -1
  78. package/dist/tools/ro/get-all-pages.js +0 -30
  79. package/dist/tools/ro/get-all-pages.js.map +0 -1
  80. package/dist/tools/ro/get-article-categories.d.ts +0 -3
  81. package/dist/tools/ro/get-article-categories.d.ts.map +0 -1
  82. package/dist/tools/ro/get-article-categories.js +0 -27
  83. package/dist/tools/ro/get-article-categories.js.map +0 -1
  84. package/dist/tools/ro/get-article-info.d.ts +0 -3
  85. package/dist/tools/ro/get-article-info.d.ts.map +0 -1
  86. package/dist/tools/ro/get-article-info.js +0 -35
  87. package/dist/tools/ro/get-article-info.js.map +0 -1
  88. package/dist/tools/ro/get-article-properties.d.ts +0 -3
  89. package/dist/tools/ro/get-article-properties.d.ts.map +0 -1
  90. package/dist/tools/ro/get-article-properties.js +0 -26
  91. package/dist/tools/ro/get-article-properties.js.map +0 -1
  92. package/dist/tools/ro/get-article-revisions.d.ts +0 -3
  93. package/dist/tools/ro/get-article-revisions.d.ts.map +0 -1
  94. package/dist/tools/ro/get-article-revisions.js +0 -29
  95. package/dist/tools/ro/get-article-revisions.js.map +0 -1
  96. package/dist/tools/ro/get-article.d.ts +0 -3
  97. package/dist/tools/ro/get-article.d.ts.map +0 -1
  98. package/dist/tools/ro/get-article.js +0 -54
  99. package/dist/tools/ro/get-article.js.map +0 -1
  100. package/dist/tools/ro/get-backlinks.d.ts +0 -3
  101. package/dist/tools/ro/get-backlinks.d.ts.map +0 -1
  102. package/dist/tools/ro/get-backlinks.js +0 -27
  103. package/dist/tools/ro/get-backlinks.js.map +0 -1
  104. package/dist/tools/ro/get-categories.d.ts +0 -3
  105. package/dist/tools/ro/get-categories.d.ts.map +0 -1
  106. package/dist/tools/ro/get-categories.js +0 -27
  107. package/dist/tools/ro/get-categories.js.map +0 -1
  108. package/dist/tools/ro/get-external-links.d.ts +0 -3
  109. package/dist/tools/ro/get-external-links.d.ts.map +0 -1
  110. package/dist/tools/ro/get-external-links.js +0 -27
  111. package/dist/tools/ro/get-external-links.js.map +0 -1
  112. package/dist/tools/ro/get-image-info.d.ts +0 -3
  113. package/dist/tools/ro/get-image-info.d.ts.map +0 -1
  114. package/dist/tools/ro/get-image-info.js +0 -29
  115. package/dist/tools/ro/get-image-info.js.map +0 -1
  116. package/dist/tools/ro/get-image-usage.d.ts +0 -3
  117. package/dist/tools/ro/get-image-usage.d.ts.map +0 -1
  118. package/dist/tools/ro/get-image-usage.js +0 -27
  119. package/dist/tools/ro/get-image-usage.js.map +0 -1
  120. package/dist/tools/ro/get-images-from-article.d.ts +0 -3
  121. package/dist/tools/ro/get-images-from-article.d.ts.map +0 -1
  122. package/dist/tools/ro/get-images-from-article.js +0 -27
  123. package/dist/tools/ro/get-images-from-article.js.map +0 -1
  124. package/dist/tools/ro/get-images.d.ts +0 -3
  125. package/dist/tools/ro/get-images.d.ts.map +0 -1
  126. package/dist/tools/ro/get-images.js +0 -43
  127. package/dist/tools/ro/get-images.js.map +0 -1
  128. package/dist/tools/ro/get-log.d.ts +0 -3
  129. package/dist/tools/ro/get-log.d.ts.map +0 -1
  130. package/dist/tools/ro/get-log.js +0 -46
  131. package/dist/tools/ro/get-log.js.map +0 -1
  132. package/dist/tools/ro/get-mediawiki-version.d.ts +0 -3
  133. package/dist/tools/ro/get-mediawiki-version.d.ts.map +0 -1
  134. package/dist/tools/ro/get-mediawiki-version.js +0 -20
  135. package/dist/tools/ro/get-mediawiki-version.js.map +0 -1
  136. package/dist/tools/ro/get-pages-by-prefix.d.ts +0 -3
  137. package/dist/tools/ro/get-pages-by-prefix.d.ts.map +0 -1
  138. package/dist/tools/ro/get-pages-by-prefix.js +0 -27
  139. package/dist/tools/ro/get-pages-by-prefix.js.map +0 -1
  140. package/dist/tools/ro/get-pages-in-category.d.ts +0 -3
  141. package/dist/tools/ro/get-pages-in-category.d.ts.map +0 -1
  142. package/dist/tools/ro/get-pages-in-category.js +0 -29
  143. package/dist/tools/ro/get-pages-in-category.js.map +0 -1
  144. package/dist/tools/ro/get-pages-in-namespace.d.ts +0 -3
  145. package/dist/tools/ro/get-pages-in-namespace.d.ts.map +0 -1
  146. package/dist/tools/ro/get-pages-in-namespace.js +0 -27
  147. package/dist/tools/ro/get-pages-in-namespace.js.map +0 -1
  148. package/dist/tools/ro/get-pages-transcluding.d.ts +0 -3
  149. package/dist/tools/ro/get-pages-transcluding.d.ts.map +0 -1
  150. package/dist/tools/ro/get-pages-transcluding.js +0 -32
  151. package/dist/tools/ro/get-pages-transcluding.js.map +0 -1
  152. package/dist/tools/ro/get-query-page.d.ts +0 -3
  153. package/dist/tools/ro/get-query-page.d.ts.map +0 -1
  154. package/dist/tools/ro/get-query-page.js +0 -27
  155. package/dist/tools/ro/get-query-page.js.map +0 -1
  156. package/dist/tools/ro/get-recent-changes.d.ts +0 -3
  157. package/dist/tools/ro/get-recent-changes.d.ts.map +0 -1
  158. package/dist/tools/ro/get-recent-changes.js +0 -43
  159. package/dist/tools/ro/get-recent-changes.js.map +0 -1
  160. package/dist/tools/ro/get-site-info.d.ts +0 -3
  161. package/dist/tools/ro/get-site-info.d.ts.map +0 -1
  162. package/dist/tools/ro/get-site-info.js +0 -23
  163. package/dist/tools/ro/get-site-info.js.map +0 -1
  164. package/dist/tools/ro/get-site-stats.d.ts +0 -3
  165. package/dist/tools/ro/get-site-stats.d.ts.map +0 -1
  166. package/dist/tools/ro/get-site-stats.js +0 -20
  167. package/dist/tools/ro/get-site-stats.js.map +0 -1
  168. package/dist/tools/ro/get-user-contribs.d.ts +0 -3
  169. package/dist/tools/ro/get-user-contribs.d.ts.map +0 -1
  170. package/dist/tools/ro/get-user-contribs.js +0 -39
  171. package/dist/tools/ro/get-user-contribs.js.map +0 -1
  172. package/dist/tools/ro/get-users.d.ts +0 -3
  173. package/dist/tools/ro/get-users.d.ts.map +0 -1
  174. package/dist/tools/ro/get-users.js +0 -29
  175. package/dist/tools/ro/get-users.js.map +0 -1
  176. package/dist/tools/ro/parse.d.ts +0 -3
  177. package/dist/tools/ro/parse.d.ts.map +0 -1
  178. package/dist/tools/ro/parse.js +0 -37
  179. package/dist/tools/ro/parse.js.map +0 -1
  180. package/dist/tools/ro/search.d.ts +0 -3
  181. package/dist/tools/ro/search.d.ts.map +0 -1
  182. package/dist/tools/ro/search.js +0 -32
  183. package/dist/tools/ro/search.js.map +0 -1
  184. package/dist/tools/ro/whoami.d.ts +0 -3
  185. package/dist/tools/ro/whoami.d.ts.map +0 -1
  186. package/dist/tools/ro/whoami.js +0 -20
  187. package/dist/tools/ro/whoami.js.map +0 -1
  188. package/dist/tools/ro/whoare.d.ts +0 -3
  189. package/dist/tools/ro/whoare.d.ts.map +0 -1
  190. package/dist/tools/ro/whoare.js +0 -19
  191. package/dist/tools/ro/whoare.js.map +0 -1
  192. package/dist/tools/ro/whois.d.ts +0 -3
  193. package/dist/tools/ro/whois.d.ts.map +0 -1
  194. package/dist/tools/ro/whois.js +0 -26
  195. package/dist/tools/ro/whois.js.map +0 -1
package/dist/index.js.map CHANGED
@@ -1 +1,7 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAqB,MAAM,uBAAuB,CAAC;AAE5E,SAAS,YAAY;IACpB,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;QAC5B,OAAO,EAAE;YACR,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC5B,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACxB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAA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AAC,KAA2B;QACzC,MAAM,EAAE,MAAM,CAAC,SAAS,CAAwB;KAChD,CAAC;AACH,CAAC;AAED,KAAK,UAAU,IAAI;IAClB,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAEzB,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAEzB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts", "../src/server.ts", "../src/tools/ro/get-article.ts", "../src/common/nodemwBot.ts", "../src/tools/ro/search.ts", "../src/common/utils.ts", "../src/tools/ro/get-pages-in-category.ts", "../src/tools/ro/get-categories.ts", "../src/tools/ro/get-users.ts", "../src/tools/ro/get-all-pages.ts", "../src/tools/ro/get-pages-in-namespace.ts", "../src/tools/ro/get-pages-by-prefix.ts", "../src/tools/ro/get-pages-transcluding.ts", "../src/tools/ro/get-article-revisions.ts", "../src/tools/ro/get-article-categories.ts", "../src/tools/ro/get-article-properties.ts", "../src/tools/ro/get-article-info.ts", "../src/tools/ro/get-user-contribs.ts", "../src/tools/ro/whoami.ts", "../src/tools/ro/whois.ts", "../src/tools/ro/whoare.ts", "../src/tools/ro/get-images.ts", "../src/tools/ro/get-images-from-article.ts", "../src/tools/ro/get-image-usage.ts", "../src/tools/ro/get-image-info.ts", "../src/tools/ro/get-log.ts", "../src/tools/ro/expand-templates.ts", "../src/tools/ro/parse.ts", "../src/tools/ro/get-recent-changes.ts", "../src/tools/ro/get-site-info.ts", "../src/tools/ro/get-site-stats.ts", "../src/tools/ro/get-mediawiki-version.ts", "../src/tools/ro/get-query-page.ts", "../src/tools/ro/get-external-links.ts", "../src/tools/ro/get-backlinks.ts", "../src/tools/editing/edit.ts", "../src/tools/editing/append.ts", "../src/tools/editing/prepend.ts", "../src/tools/editing/move.ts", "../src/tools/editing/delete.ts", "../src/tools/editing/protect.ts", "../src/tools/editing/purge.ts", "../src/tools/editing/send-email.ts", "../src/tools/editing/upload.ts", "../src/tools/editing/upload-by-url.ts", "../src/tools/editing/add-flow-topic.ts", "../src/tools/editing/create-account.ts", "../src/tools/index.ts"],
4
+ "sourcesContent": ["/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { parseArgs } from 'util';\nimport { createServer } from './server.js';\nimport { registerAllTools } from './tools/index.js';\nimport {\n\tinitServerConfig,\n\tgetBot,\n\tinitBot,\n\tautoDetectPath,\n\tpromisifyBotMethod,\n\ttype ServerConfig\n} from './common/nodemwBot.js';\n\nfunction parseCliArgs(): { config: ServerConfig; pathExplicit: boolean } {\n\tconst { values, positionals } = parseArgs({\n\t\toptions: {\n\t\t\tserver: { type: 'string', short: 's' },\n\t\t\tpath: { type: 'string' },\n\t\t\tendpoint: { type: 'string' },\n\t\t\tuser: { type: 'string', short: 'u' },\n\t\t\tpass: { type: 'string', short: 'p' },\n\t\t\ttoken: { type: 'string' },\n\t\t\t'dry-run': { type: 'boolean' },\n\t\t},\n\t\tstrict: false,\n\t\tallowPositionals: true,\n\t});\n\n\t// Server can be specified via --server/-s or as the first positional argument\n\tconst serverUrl = (values.server as string) ?? positionals[0] ?? process.env.NODEMW_MCP_SERVER;\n\tif (!serverUrl) {\n\t\tconsole.error('Error: target server is required (-s, positional arg, or NODEMW_MCP_SERVER env)');\n\t\tprocess.exit(1);\n\t}\n\tlet server: string;\n\tlet protocol: string | undefined;\n\tlet port: number | undefined;\n\n\ttry {\n\t\tif (serverUrl.startsWith('http://') || serverUrl.startsWith('https://')) {\n\t\t\tconst url = new URL(serverUrl);\n\t\t\tserver = url.hostname;\n\t\t\tprotocol = url.protocol.replace(':', '');\n\t\t\tif (url.port) {\n\t\t\t\tport = parseInt(url.port, 10);\n\t\t\t}\n\t\t} else {\n\t\t\tserver = serverUrl;\n\t\t}\n\t} catch {\n\t\tserver = serverUrl;\n\t}\n\n\tconst pathFromEnv = process.env.NODEMW_MCP_ENDPOINT_PATH;\n\tconst pathExplicit = !!(values.path ?? values.endpoint ?? pathFromEnv);\n\n\treturn {\n\t\tconfig: {\n\t\t\tserver,\n\t\t\tprotocol,\n\t\t\tport,\n\t\t\tpath: (values.path as string) ?? (values.endpoint as string) ?? pathFromEnv ?? '/w',\n\t\t\tusername: (values.user as string) ?? process.env.NODEMW_MCP_MW_USER,\n\t\t\tpassword: (values.pass as string) ?? process.env.NODEMW_MCP_MW_PASS,\n\t\t\ttoken: values.token as string | undefined,\n\t\t\tdryRun: values['dry-run'] as boolean | undefined,\n\t\t},\n\t\tpathExplicit,\n\t};\n}\n\nasync function main(): Promise<void> {\n\tconst { config, pathExplicit } = parseCliArgs();\n\n\t// Step 1: Auto-detect API path if not explicitly specified\n\tif (!pathExplicit) {\n\t\ttry {\n\t\t\tconfig.path = await autoDetectPath(config);\n\t\t\tconsole.error(`Auto-detected API path: ${config.path}`);\n\t\t} catch (err) {\n\t\t\tconsole.error('Error:', (err as Error).message);\n\t\t\tprocess.exit(1);\n\t\t}\n\t}\n\n\tinitServerConfig(config);\n\n\t// Step 2: Initialize bot \u2014 creates connection and logs in if credentials provided\n\ttry {\n\t\tawait initBot(config);\n\t} catch (err) {\n\t\tconsole.error('Error:', (err as Error).message);\n\t\tprocess.exit(1);\n\t}\n\n\t// Step 3: Fetch site info to enrich the server description\n\tconst bot = getBot();\n\tlet siteInfo: { sitename: string; base: string; generator: string } | undefined;\n\ttry {\n\t\tconst info = await promisifyBotMethod<{ general?: { sitename?: string; base?: string; generator?: string } }>(bot, 'getSiteInfo', ['general']);\n\t\tconst general = info?.general;\n\t\tif (general) {\n\t\t\tsiteInfo = {\n\t\t\t\tsitename: general.sitename || 'Unknown',\n\t\t\t\tbase: general.base || '',\n\t\t\t\tgenerator: general.generator || 'MediaWiki',\n\t\t\t};\n\t\t}\n\t} catch {\n\t\tconsole.error('Warning: Could not fetch site info for server description.');\n\t}\n\n\t// Step 4: Create server with site-aware description\n\tconst server = createServer(siteInfo);\n\tregisterAllTools(server);\n\n\t// Step 5: Connect stdio transport\n\tconst transport = new StdioServerTransport();\n\tawait server.connect(transport);\n}\n\nmain().catch(console.error);\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nexport const USER_AGENT = 'nodemw-mcp-server/1.0';\n\nexport interface SiteInfoSummary {\n\tsitename: string;\n\tbase: string;\n\tgenerator: string;\n}\n\nexport function createServer(siteInfo?: SiteInfoSummary): McpServer {\n\tlet description: string;\n\tif (siteInfo) {\n\t\tdescription = `Connected to ${siteInfo.sitename} (${siteInfo.base}). Running ${siteInfo.generator}. When connecting for the first time, call the get-site-info tool for full site details.`;\n\t} else {\n\t\tdescription = 'When connecting to this server for the first time, call the get-site-info tool to understand the target MediaWiki site (version, namespaces, extensions, etc.) before using other tools.';\n\t}\n\n\treturn new McpServer(\n\t\t{\n\t\t\tname: 'nodemw-mcp-server',\n\t\t\tversion: '1.0.0',\n\t\t\tdescription\n\t\t},\n\t\t{ capabilities: { tools: {} } }\n\t);\n}\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\n\r\nexport function getArticleTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-article',\r\n\t\t'Retrieve the content of a wiki article',\r\n\t\t{\r\n\t\t\ttitle: z.string().describe( 'Article title' ),\r\n\t\t\tfollowRedirect: z.boolean().optional().default( true ).describe( 'Follow redirects' ),\r\n\t\t\tredirectInfo: z.boolean().optional().default( false ).describe( 'Include information about redirects' )\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get article',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { title, followRedirect, redirectInfo } ) => handleGetArticleTool( title, followRedirect, redirectInfo )\r\n\t);\r\n}\r\n\r\nasync function handleGetArticleTool(\r\n\ttitle: string,\r\n\tfollowRedirect: boolean,\r\n\tredirectInfo: boolean\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tif (redirectInfo) {\r\n\t\t\t// When redirectInfo is requested, get both content and redirect info\r\n\t\t\tconst result = await new Promise<[string, unknown]>((resolve, reject) => {\r\n\t\t\t\tconst callback = (err: Error | null, content: string, redirectInfo: unknown) => {\r\n\t\t\t\t\tif (err) {\r\n\t\t\t\t\t\treject(err);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tresolve([content, redirectInfo]);\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\r\n\t\t\t\t// @ts-expect-error: any method call\r\n\t\t\t\tbot.getArticle(title, followRedirect, callback);\r\n\t\t\t});\r\n\t\t\tconst [content, redirect] = result;\r\n\t\t\tconst responseText = redirect \r\n\t\t\t\t? `Content:\\n\\n${content}\\n\\nRedirect Information:\\n\\n${JSON.stringify(redirect, null, 2)}`\r\n\t\t\t\t: content;\r\n\t\t\t\r\n\t\t\treturn {\r\n\t\t\t\tcontent: [ { type: 'text', text: responseText } ]\r\n\t\t\t};\r\n\t\t} else {\r\n\t\t\t// Original behavior: just return content\r\n\t\t\tconst result = await promisifyBotMethod<string>(\r\n\t\t\t\tbot,\r\n\t\t\t\t'getArticle',\r\n\t\t\t\ttitle,\r\n\t\t\t\tfollowRedirect\r\n\t\t\t);\r\n\t\t\treturn {\r\n\t\t\t\tcontent: [ { type: 'text', text: result } ]\r\n\t\t\t};\r\n\t\t}\r\n\t} catch ( error ) {\r\n\t\treturn {\r\n\t\t\tcontent: [ { type: 'text', text: `Error: ${ ( error as Error ).message }` } ],\r\n\t\t\tisError: true\r\n\t\t};\r\n\t}\r\n}\r\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport Bot from 'nodemw';\nimport { USER_AGENT } from '../server.js';\n\nexport interface ServerConfig {\n\tserver: string;\n\tpath: string;\n\tprotocol?: string;\n\tport?: number;\n\tproxy?: string;\n\tuserAgent?: string;\n\tconcurrency?: number;\n\tdebug?: boolean;\n\tusername?: string;\n\tpassword?: string;\n\ttoken?: string;\n\tdomain?: string;\n\tdryRun?: boolean;\n}\n\nlet botInstance: Bot | null = null;\nlet serverConfig: ServerConfig | null = null;\n\nexport function initServerConfig(config: ServerConfig): void {\n\tserverConfig = config;\n}\n\nfunction createBotFromConfig(config: ServerConfig): Bot {\n\tconst {\n\t\tserver,\n\t\tpath,\n\t\tprotocol,\n\t\tport,\n\t\tproxy,\n\t\tuserAgent,\n\t\tconcurrency,\n\t\tdebug,\n\t\tusername,\n\t\tpassword,\n\t\tdomain,\n\t\tdryRun\n\t} = config;\n\n\treturn new Bot({\n\t\tserver,\n\t\tprotocol: protocol || 'https',\n\t\tport,\n\t\tpath,\n\t\tproxy,\n\t\tuserAgent: userAgent || USER_AGENT,\n\t\tconcurrency,\n\t\tdebug,\n\t\tusername: username || undefined,\n\t\tpassword: password || undefined,\n\t\tdomain,\n\t\t// @ts-expect-error: dryRun is supported by nodemw at runtime but missing from BotOptions types\n\t\tdryRun\n\t});\n}\n\nasync function testApiConnection(bot: Bot): Promise<boolean> {\n\ttry {\n\t\tawait promisifyBotMethod(bot, 'getSiteInfo', ['general']);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport async function autoDetectPath(baseConfig: ServerConfig): Promise<string> {\n\t// nodemw constructs URL as ${server}${path}/api.php \u2014 so /w means /w/api.php, '' means /api.php\n\tconst pathsToTry = ['/w', ''];\n\tfor (const path of pathsToTry) {\n\t\tconst testConfig = { ...baseConfig, path };\n\t\tconst bot = createBotFromConfig(testConfig);\n\t\tif (await testApiConnection(bot)) {\n\t\t\treturn path;\n\t\t}\n\t}\n\tthrow new Error(\n\t\t'Could not auto-detect MediaWiki API path. ' +\n\t\t'Tried /w/api.php and /api.php. ' +\n\t\t'Please specify --path explicitly (e.g., --path /w or --path \"\" for root).'\n\t);\n}\n\nexport async function initBot(config: ServerConfig): Promise<Bot> {\n\tbotInstance = createBotFromConfig(config);\n\n\tconst { username, password } = config;\n\tif (username && password) {\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\tbotInstance!.logIn((err: Error | null) => {\n\t\t\t\tif (err) {\n\t\t\t\t\treject(new Error(`Login failed for user '${username}': ${err.message}`));\n\t\t\t\t} else {\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\treturn botInstance;\n}\n\nexport function getBot(): Bot {\n\tif (!botInstance) {\n\t\tthrow new Error('Bot not initialized. Server must be started first.');\n\t}\n\treturn botInstance;\n}\n\nexport function clearBotCache(): void {\n\tbotInstance = null;\n}\n\nexport function promisifyBotMethod<T>(\n\tbot: Bot,\n\tmethod: string,\n\t...args: unknown[]\n): Promise<T> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst callback = (err: Error | null, result: T) => {\n\t\t\tif (err) {\n\t\t\t\treject(err);\n\t\t\t} else {\n\t\t\t\tresolve(result);\n\t\t\t}\n\t\t};\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t(bot as any)[method](...args, callback);\n\t});\n}\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface SearchResult extends Record<string, any> {\r\n\ttitle: string;\r\n\tsnippet?: string;\r\n\turl?: string;\r\n\tpageId?: number;\r\n}\r\n\r\nexport function searchTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'search',\r\n\t\t'Search for wiki pages by keyword',\r\n\t\t{\r\n\t\t\tkeyword: z.string().describe( 'Search keyword' ),\r\n\t\t\tlimit: z.number().optional().default( 10 ).describe( 'Maximum number of results' )\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Search',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { keyword, limit } ) => handleSearchTool( keyword, limit )\r\n\t);\r\n}\r\n\r\nasync function handleSearchTool(\r\n\tkeyword: string,\r\n\tlimit: number\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\r\n\t\t// nodemw search returns array of results directly\r\n\t\tconst results = await promisifyBotMethod<SearchResult[]>(\r\n\t\t\tbot,\r\n\t\t\t'search',\r\n\t\t\tkeyword\r\n\t\t);\r\n\r\n\t\t// Limit results\r\n\t\tconst limitedResults = results.slice( 0, limit );\r\n\r\n\t\treturn jsonResult({\r\n\t\t\ttotal: results.length,\r\n\t\t\tlimit,\r\n\t\t\tkeyword,\r\n\t\t\tresults: limitedResults\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to search', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport type Bot from 'nodemw';\r\nimport type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';\r\n\r\nexport function promisifyBotMethod<T>(\r\n\tbot: Bot,\r\n\tmethod: string,\r\n\t...args: unknown[]\r\n): Promise<T> {\r\n\treturn new Promise( ( resolve, reject ) => {\r\n\t\tconst callback = ( err: Error | null, result: T ) => {\r\n\t\t\tif ( err ) {\r\n\t\t\t\treject( err );\r\n\t\t\t} else {\r\n\t\t\t\tresolve( result );\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n\t\t( bot as any )[ method ]( ...args, callback );\r\n\t} );\r\n}\r\n\r\nexport function isNonNullish<T>(\r\n\tvalue: T | null | undefined\r\n): value is T {\r\n\treturn value !== null && value !== undefined;\r\n}\r\n\r\nexport function jsonResult(data: unknown): CallToolResult {\r\n\treturn {\r\n\t\tcontent: [{\r\n\t\t\ttype: 'text',\r\n\t\t\ttext: JSON.stringify(data, null, 2)\r\n\t\t}]\r\n\t};\r\n}\r\n\r\nexport function errorResult(message: string, error?: Error): CallToolResult {\r\n\treturn {\r\n\t\tcontent: [{\r\n\t\t\ttype: 'text',\r\n\t\t\ttext: JSON.stringify({\r\n\t\t\t\terror: message,\r\n\t\t\t\tdetails: error?.message\r\n\t\t\t}, null, 2)\r\n\t\t}],\r\n\t\tisError: true\r\n\t};\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface PageInCategory extends Record<string, any> {\r\n\ttitle: string;\r\n\tpageid?: number;\r\n\tns?: number;\r\n}\r\n\r\nexport function getPagesInCategoryTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-pages-in-category',\r\n\t\t'Get all pages in a category',\r\n\t\t{\r\n\t\t\tcategory: z.string().describe( 'Category name (with or without Category: prefix)' )\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get pages in category',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { category } ) => handleGetPagesInCategoryTool( category )\r\n\t);\r\n}\r\n\r\nasync function handleGetPagesInCategoryTool(\r\n\tcategory: string\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\r\n\t\t// Remove \"Category:\" prefix if present\r\n\t\tconst cleanCategory = category.replace( /^Category:/i, '' );\r\n\r\n\t\tconst results = await promisifyBotMethod<PageInCategory[]>(\r\n\t\t\tbot,\r\n\t\t\t'getPagesInCategory',\r\n\t\t\tcleanCategory\r\n\t\t);\r\n\r\n\t\treturn jsonResult({\r\n\t\t\tcategory: cleanCategory,\r\n\t\t\tpages: results,\r\n\t\t\tcount: results.length\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get pages in category', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\nexport function getCategoriesTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-categories',\r\n\t\t'Get all categories matching a prefix',\r\n\t\t{\r\n\t\t\tprefix: z.string().optional().default('').describe('Prefix to filter categories')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get categories',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { prefix } ) => handleGetCategoriesTool( prefix )\r\n\t);\r\n}\r\n\r\nasync function handleGetCategoriesTool(\r\n\tprefix: string\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst results = await promisifyBotMethod<string[]>(\r\n\t\t\tbot,\r\n\t\t\t'getCategories',\r\n\t\t\tprefix\r\n\t\t);\r\n\r\n\t\treturn jsonResult({\r\n\t\t\tprefix,\r\n\t\t\tcategories: results,\r\n\t\t\tcount: results.length\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get categories', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface UserInfo extends Record<string, any> {\r\n\tname: string;\r\n\tuserid: number;\r\n}\r\n\r\nexport function getUsersTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-users',\r\n\t\t'Get all users matching a prefix',\r\n\t\t{\r\n\t\t\tprefix: z.string().optional().default('').describe('Prefix to filter usernames'),\r\n\t\t\tonlyWithEdits: z.boolean().optional().default(false).describe('Only include users with at least one edit')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get users',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { prefix, onlyWithEdits } ) => handleGetUsersTool( prefix, onlyWithEdits )\r\n\t);\r\n}\r\n\r\nasync function handleGetUsersTool(\r\n\tprefix: string,\r\n\tonlyWithEdits: boolean\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst results = await promisifyBotMethod<UserInfo[]>(\r\n\t\t\tbot,\r\n\t\t\t'getUsers',\r\n\t\t\t{ prefix, witheditsonly: onlyWithEdits }\r\n\t\t);\r\n\r\n\t\treturn jsonResult({\r\n\t\t\tprefix,\r\n\t\t\tonlyWithEdits,\r\n\t\t\tusers: results,\r\n\t\t\tcount: results.length\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get users', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface AllPage extends Record<string, any> {\r\n\ttitle: string;\r\n\tpageid: number;\r\n\tns: number;\r\n}\r\n\r\nexport function getAllPagesTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-all-pages',\r\n\t\t'Get all non-redirect pages from the wiki',\r\n\t\t{\r\n\t\t\tlimit: z.number().optional().default(500).describe('Maximum number of pages to return')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get all pages',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { limit } ) => handleGetAllPagesTool( limit )\r\n\t);\r\n}\r\n\r\nasync function handleGetAllPagesTool(\r\n\tlimit: number\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst allResults = await promisifyBotMethod<AllPage[]>(\r\n\t\t\tbot,\r\n\t\t\t'getAllPages'\r\n\t\t);\r\n\r\n\t\t// Limit results\r\n\t\tconst results = allResults.slice(0, limit);\r\n\r\n\t\treturn jsonResult({\r\n\t\t\ttotal: allResults.length,\r\n\t\t\tdisplayed: results.length,\r\n\t\t\tpages: results,\r\n\t\t\tlimit\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get all pages', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface PageInNamespace extends Record<string, any> {\r\n\ttitle: string;\r\n\tpageid: number;\r\n\tns: number;\r\n}\r\n\r\nexport function getPagesInNamespaceTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-pages-in-namespace',\r\n\t\t'Get all non-redirect pages in a specific namespace',\r\n\t\t{\r\n\t\t\tnamespace: z.number().describe('Namespace number to filter pages')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get pages in namespace',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { namespace } ) => handleGetPagesInNamespaceTool( namespace )\r\n\t);\r\n}\r\n\r\nasync function handleGetPagesInNamespaceTool(\r\n\tnamespace: number\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst results = await promisifyBotMethod<PageInNamespace[]>(\r\n\t\t\tbot,\r\n\t\t\t'getPagesInNamespace',\r\n\t\t\tnamespace\r\n\t\t);\r\n\r\n\t\treturn jsonResult({\r\n\t\t\tnamespace,\r\n\t\t\tpages: results,\r\n\t\t\tcount: results.length\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get pages in namespace', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface PageByPrefix extends Record<string, any> {\r\n\ttitle: string;\r\n\tpageid: number;\r\n\tns: number;\r\n}\r\n\r\nexport function getPagesByPrefixTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-pages-by-prefix',\r\n\t\t'Get pages starting with a specific prefix',\r\n\t\t{\r\n\t\t\tprefix: z.string().describe('Prefix to match page titles')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get pages by prefix',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { prefix } ) => handleGetPagesByPrefixTool( prefix )\r\n\t);\r\n}\r\n\r\nasync function handleGetPagesByPrefixTool(\r\n\tprefix: string\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst results = await promisifyBotMethod<PageByPrefix[]>(\r\n\t\t\tbot,\r\n\t\t\t'getPagesByPrefix',\r\n\t\t\tprefix\r\n\t\t);\r\n\r\n\t\treturn jsonResult({\r\n\t\t\tprefix,\r\n\t\t\tpages: results,\r\n\t\t\tcount: results.length\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get pages by prefix', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface TranscludingPage extends Record<string, any> {\r\n\ttitle: string;\r\n\tpageid: number;\r\n\tns: number;\r\n}\r\n\r\nexport function getPagesTranscludingTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-pages-transcluding',\r\n\t\t'Get all pages that transclude (include) a specific template',\r\n\t\t{\r\n\t\t\ttemplate: z.string().describe('Template title to find transclusions')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get pages transcluding template',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { template } ) => handleGetPagesTranscludingTool( template )\r\n\t);\r\n}\r\n\r\nasync function handleGetPagesTranscludingTool(\r\n\ttemplate: string\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst callbackArgs = await promisifyBotMethod<[Error | null, TranscludingPage[] | [undefined]]>(\r\n\t\t\tbot,\r\n\t\t\t'getPagesTranscluding',\r\n\t\t\ttemplate\r\n\t\t);\r\n\r\n\t\t// Extract results from callback args (ignore first arg if it's error, which promisifyBotMethod already handles)\r\n\t\tconst rawResults = callbackArgs[1];\r\n\t\tconst results = Array.isArray(rawResults) \r\n\t\t\t? rawResults.filter((page): page is TranscludingPage => page != null && typeof page === 'object' && 'title' in page)\r\n\t\t\t: [];\r\n\r\n\t\treturn jsonResult({\r\n\t\t\ttemplate,\r\n\t\t\tpages: results,\r\n\t\t\tcount: results.length\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get pages transcluding template', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface Revision extends Record<string, any> {\r\n\trevid: number;\r\n\ttimestamp: string;\r\n\tuser: string;\r\n\tcomment: string;\r\n\tsize: number;\r\n}\r\n\r\nexport function getArticleRevisionsTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-article-revisions',\r\n\t\t'Get all revisions of a wiki article',\r\n\t\t{\r\n\t\t\ttitle: z.union([z.string(), z.number()]).describe('Article title or page ID')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get article revisions',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { title } ) => handleGetArticleRevisionsTool( title )\r\n\t);\r\n}\r\n\r\nasync function handleGetArticleRevisionsTool(\r\n\ttitle: string | number\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst allRevisions = await promisifyBotMethod<Revision[][]>(\r\n\t\t\tbot,\r\n\t\t\t'getArticleRevisions',\r\n\t\t\ttitle\r\n\t\t);\r\n\r\n\t\t// Flatten the results\r\n\t\tconst revisions = allRevisions.flat();\r\n\r\n\t\treturn jsonResult({\r\n\t\t\ttitle,\r\n\t\t\trevisions,\r\n\t\t\tcount: revisions.length\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get article revisions', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\nexport function getArticleCategoriesTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-article-categories',\r\n\t\t'Get all categories that an article belongs to',\r\n\t\t{\r\n\t\t\ttitle: z.union([z.string(), z.number()]).describe('Article title or page ID')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get article categories',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { title } ) => handleGetArticleCategoriesTool( title )\r\n\t);\r\n}\r\n\r\nasync function handleGetArticleCategoriesTool(\r\n\ttitle: string | number\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst categories = await promisifyBotMethod<string[]>(\r\n\t\t\tbot,\r\n\t\t\t'getArticleCategories',\r\n\t\t\ttitle\r\n\t\t);\r\n\r\n\t\treturn jsonResult({\r\n\t\t\ttitle,\r\n\t\t\tcategories,\r\n\t\t\tcount: categories.length\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get article categories', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface PageProperties extends Record<string, any> {\r\n\t[key: string]: string | undefined;\r\n}\r\n\r\nexport function getArticlePropertiesTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-article-properties',\r\n\t\t'Get page properties for a wiki article',\r\n\t\t{\r\n\t\t\ttitle: z.string().describe('Article title')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get article properties',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { title } ) => handleGetArticlePropertiesTool( title )\r\n\t);\r\n}\r\n\r\nasync function handleGetArticlePropertiesTool(\r\n\ttitle: string\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst properties = await promisifyBotMethod<PageProperties>(\r\n\t\t\tbot,\r\n\t\t\t'getArticleProperties',\r\n\t\t\ttitle\r\n\t\t);\r\n\r\n\t\treturn jsonResult({\r\n\t\t\ttitle,\r\n\t\t\tproperties\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get article properties', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface ArticleInfo extends Record<string, any> {\r\n\ttitle: string;\r\n\tpageid: number;\r\n\tns: number;\r\n}\r\n\r\nexport function getArticleInfoTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-article-info',\r\n\t\t'Get detailed information about one or more articles',\r\n\t\t{\r\n\t\t\ttitle: z.union([\r\n\t\t\t\tz.string(),\r\n\t\t\t\tz.number(),\r\n\t\t\t\tz.array(z.union([z.string(), z.number()]))\r\n\t\t\t]).describe('Article title, page ID, or array of titles/IDs'),\r\n\t\t\tproperties: z.array(z.string()).optional().describe('Specific properties to retrieve')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get article info',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { title, properties } ) => handleGetArticleInfoTool( title, properties )\r\n\t);\r\n}\r\n\r\nasync function handleGetArticleInfoTool(\r\n\ttitle: string | number | (string | number)[],\r\n\tproperties?: string[]\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst options = properties ? { inprop: properties } : {};\r\n\t\tconst info = await promisifyBotMethod<ArticleInfo>(\r\n\t\t\tbot,\r\n\t\t\t'getArticleInfo',\r\n\t\t\ttitle,\r\n\t\t\toptions\r\n\t\t);\r\n\r\n\t\t// Handle array of results vs single result\r\n\t\tconst results = Array.isArray(info) ? info : [info];\r\n\r\n\t\treturn jsonResult({\r\n\t\t\ttitle,\r\n\t\t\tresults,\r\n\t\t\tcount: results.length\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get article info', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface UserContrib extends Record<string, any> {\r\n\ttitle: string;\r\n\trevid: number;\r\n\ttimestamp: string;\r\n\tcomment: string;\r\n}\r\n\r\nexport function getUserContribsTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-user-contribs',\r\n\t\t'Get contributions made by a specific user',\r\n\t\t{\r\n\t\t\tusername: z.string().describe('Username to get contributions for'),\r\n\t\t\tnamespace: z.number().optional().describe('Filter contributions by namespace'),\r\n\t\t\tlimit: z.number().optional().default(50).describe('Maximum number of contributions to return')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get user contributions',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { username, namespace, limit } ) => handleGetUserContribsTool( username, namespace, limit )\r\n\t);\r\n}\r\n\r\nasync function handleGetUserContribsTool(\r\n\tusername: string,\r\n\tnamespace?: number,\r\n\tlimit: number = 50\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst options = {\r\n\t\t\tuser: username,\r\n\t\t\t...(namespace !== undefined && { namespace })\r\n\t\t};\r\n\r\n\t\tconst callbackArgs = await promisifyBotMethod<[Error | null, UserContrib[], string | boolean]>(\r\n\t\t\tbot,\r\n\t\t\t'getUserContribs',\r\n\t\t\toptions\r\n\t\t);\r\n\r\n\t\tconst contribs = Array.isArray(callbackArgs[1]) ? callbackArgs[1] : [];\r\n\r\n\t\t// Limit results\r\n\t\tconst limitedContribs = contribs.slice(0, limit);\r\n\r\n\t\treturn jsonResult({\r\n\t\t\tusername,\r\n\t\t\tnamespace,\r\n\t\t\tlimit,\r\n\t\t\ttotal: contribs.length,\r\n\t\t\tdisplayed: limitedContribs.length,\r\n\t\t\tcontributions: limitedContribs\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get user contributions', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface UserInfo extends Record<string, any> {\r\n\tname: string;\r\n\tid: number;\r\n\tgroups: string[];\r\n\trights: string[];\r\n}\r\n\r\nexport function whoamiTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'whoami',\r\n\t\t'Get information about the currently logged in user',\r\n\t\t{},\r\n\t\t{\r\n\t\t\ttitle: 'Who am I',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync () => handleWhoamiTool()\r\n\t);\r\n}\r\n\r\nasync function handleWhoamiTool(): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst userInfo = await promisifyBotMethod<UserInfo>(\r\n\t\t\tbot,\r\n\t\t\t'whoami'\r\n\t\t);\r\n\r\n\t\treturn jsonResult(userInfo);\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get current user info', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface WhoisUserInfo extends Record<string, any> {\r\n\tname: string;\r\n\tuserid: number;\r\n\tgroups: string[];\r\n\trights: string[];\r\n}\r\n\r\nexport function whoisTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'whois',\r\n\t\t'Get information about a specific user',\r\n\t\t{\r\n\t\t\tusername: z.string().describe('Username to look up')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Whois',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { username } ) => handleWhoisTool( username )\r\n\t);\r\n}\r\n\r\nasync function handleWhoisTool(\r\n\tusername: string\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst userInfo = await promisifyBotMethod<WhoisUserInfo & { missing?: string }>(\r\n\t\t\tbot,\r\n\t\t\t'whois',\r\n\t\t\tusername\r\n\t\t);\r\n\r\n\t\tif (userInfo.missing) {\r\n\t\t\treturn errorResult(`User \"${username}\" not found.`);\r\n\t\t}\r\n\r\n\t\treturn jsonResult(userInfo);\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get user info', error as Error);\r\n\t}\r\n}\r\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function whoareTool( server: McpServer ): RegisteredTool {\n\treturn server.tool(\n\t\t'whoare',\n\t\t'Get information about multiple wiki users',\n\t\t{\n\t\t\tusernames: z.array( z.string() ).describe( 'Array of usernames to query' ),\n\t\t},\n\t\t{\n\t\t\ttitle: 'Who are',\n\t\t\treadOnlyHint: true,\n\t\t\tdestructiveHint: false\n\t\t} as ToolAnnotations,\n\t\tasync ( params ) => handleWhoareTool( params )\n\t);\n}\n\nasync function handleWhoareTool(\n\tparams: {\n\t\tusernames: string[];\n\t}\n): Promise<CallToolResult> {\n\ttry {\n\t\tconst bot = await getBot();\n\n\t\tconst users = await promisifyBotMethod<any[]>(\n\t\t\tbot,\n\t\t\t'whoare',\n\t\t\tparams.usernames\n\t\t);\n\n\t\treturn jsonResult(users);\n\t} catch ( error ) {\n\t\treturn errorResult('Failed to get user information', error as Error);\n\t}\n}\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface Image extends Record<string, any> {\r\n\tname: string;\r\n\timg_timestamp: string;\r\n\tuser: string;\r\n}\r\n\r\nexport function getImagesTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-images',\r\n\t\t'Get list of images starting from a specific name',\r\n\t\t{\r\n\t\t\tstartFrom: z.string().optional().default('').describe('Start from this image name'),\r\n\t\t\tlimit: z.number().optional().default(50).describe('Maximum number of images to return')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get images',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { startFrom, limit } ) => handleGetImagesTool( startFrom, limit )\r\n\t);\r\n}\r\n\r\nasync function handleGetImagesTool(\r\n\tstartFrom: string,\r\n\tlimit: number\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\t// getImages has a different callback signature - let's handle it manually\r\n\t\tconst images = await new Promise<Image[]>((resolve, reject) => {\r\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n\t\t\t(bot as any).getImages(startFrom, (err: Error | null, ...args: any[]) => {\r\n\t\t\t\tif (err) {\r\n\t\t\t\t\treject(err);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tconst imgs = args[0];\r\n\t\t\t\t\tresolve(Array.isArray(imgs) ? imgs : []);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\t// Limit results\r\n\t\tconst limitedImages = images.slice(0, limit);\r\n\r\n\t\treturn jsonResult({\r\n\t\t\ttotal: images.length,\r\n\t\t\tlimit,\r\n\t\t\tstartFrom,\r\n\t\t\timages: limitedImages\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get images', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface ArticleImage extends Record<string, any> {\r\n\ttitle: string;\r\n\tns: number;\r\n}\r\n\r\nexport function getImagesFromArticleTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-images-from-article',\r\n\t\t'Get all images embedded in a specific article',\r\n\t\t{\r\n\t\t\ttitle: z.union([z.string(), z.number()]).describe('Article title or page ID')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get images from article',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { title } ) => handleGetImagesFromArticleTool( title )\r\n\t);\r\n}\r\n\r\nasync function handleGetImagesFromArticleTool(\r\n\ttitle: string | number\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst images = await promisifyBotMethod<ArticleImage[]>(\r\n\t\t\tbot,\r\n\t\t\t'getImagesFromArticle',\r\n\t\t\ttitle\r\n\t\t);\r\n\r\n\t\treturn jsonResult({\r\n\t\t\ttitle,\r\n\t\t\timages,\r\n\t\t\tcount: images.length\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get images from article', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type {CallToolResult, ToolAnnotations} from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface ImageUsage extends Record<string, any> {\r\n\ttitle: string;\r\n\tpageid: number;\r\n\tns: number;\r\n}\r\n\r\nexport function getImageUsageTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-image-usage',\r\n\t\t'Get all pages that use a specific image',\r\n\t\t{\r\n\t\t\tfilename: z.string().describe('Image filename with File: prefix')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get image usage',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { filename } ) => handleGetImageUsageTool( filename )\r\n\t);\r\n}\r\n\r\nasync function handleGetImageUsageTool(\r\n\tfilename: string\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst pages = await promisifyBotMethod<ImageUsage[]>(\r\n\t\t\tbot,\r\n\t\t\t'getImageUsage',\r\n\t\t\tfilename\r\n\t\t);\r\n\r\n\t\treturn jsonResult({\r\n\t\t\tfilename,\r\n\t\t\tpages,\r\n\t\t\tcount: pages.length\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get image usage', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface ImageInfo extends Record<string, any> {\r\n\ttimestamp: string;\r\n\tuser: string;\r\n\twidth: number;\r\n\theight: number;\r\n\tsize: number;\r\n\turl: string;\r\n\tdescriptionurl: string;\r\n\texif?: Record<string, string>;\r\n}\r\n\r\nexport function getImageInfoTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-image-info',\r\n\t\t'Get detailed information about an image file',\r\n\t\t{\r\n\t\t\tfilename: z.string().describe('Image filename with File: prefix')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get image info',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { filename } ) => handleGetImageInfoTool( filename )\r\n\t);\r\n}\r\n\r\nasync function handleGetImageInfoTool(\r\n\tfilename: string\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst info = await promisifyBotMethod<ImageInfo | undefined>(\r\n\t\t\tbot,\r\n\t\t\t'getImageInfo',\r\n\t\t\tfilename\r\n\t\t);\r\n\r\n\t\tif (!info) {\r\n\t\t\treturn errorResult(`Image \"${filename}\" not found.`);\r\n\t\t}\r\n\r\n\t\treturn jsonResult({\r\n\t\t\tfilename,\r\n\t\t\tinfo\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get image info', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface LogEntry extends Record<string, any> {\r\n\ttitle: string;\r\n\ttimestamp: string;\r\n\tuser: string;\r\n\taction: string;\r\n\tcomment: string;\r\n}\r\n\r\nexport function getLogTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-log',\r\n\t\t'Get log entries of a specific type',\r\n\t\t{\r\n\t\t\ttype: z.string().describe('Log type (e.g. delete, block, move)'),\r\n\t\t\tstart: z.string().optional().default('').describe('Start timestamp (YYYYMMDDHHMMSS format)'),\r\n\t\t\tlimit: z.number().optional().default(50).describe('Maximum number of entries to return')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get log entries',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { type, start, limit } ) => handleGetLogTool( type, start, limit )\r\n\t);\r\n}\r\n\r\nasync function handleGetLogTool(\r\n\ttype: string,\r\n\tstart: string,\r\n\tlimit: number\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\t// Handle getLog's callback signature manually\r\n\t\tconst entries = await new Promise<LogEntry[]>((resolve, reject) => {\r\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n\t\t\t(bot as any).getLog(type, start, (err: Error | null, ...args: any[]) => {\r\n\t\t\t\tif (err) {\r\n\t\t\t\t\treject(err);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tconst ents = args[0];\r\n\t\t\t\t\tresolve(Array.isArray(ents) ? ents : []);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\t// Limit results\r\n\t\tconst limitedEntries = entries.slice(0, limit);\r\n\r\n\t\treturn jsonResult({\r\n\t\t\ttype,\r\n\t\t\tstart,\r\n\t\t\tlimit,\r\n\t\t\ttotal: entries.length,\r\n\t\t\tdisplayed: limitedEntries.length,\r\n\t\t\tentries: limitedEntries\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get log entries', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\n\r\nexport function expandTemplatesTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'expand-templates',\r\n\t\t'Expand templates in wikitext',\r\n\t\t{\r\n\t\t\ttext: z.string().describe('Wikitext with templates to expand'),\r\n\t\t\ttitle: z.string().optional().describe('Context page title'),\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Expand templates',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { text, title } ) => handleExpandTemplatesTool( text, title )\r\n\t);\r\n}\r\n\r\nasync function handleExpandTemplatesTool(\r\n\ttext: string,\r\n\ttitle?: string\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst expandedXml = await promisifyBotMethod<string>(\r\n\t\t\tbot,\r\n\t\t\t'expandTemplates',\r\n\t\t\ttext,\r\n\t\t\ttitle || ''\r\n\t\t);\r\n\r\n\t\treturn {\r\n\t\t\tcontent: [ { type: 'text', text: expandedXml } ]\r\n\t\t};\r\n\t} catch ( error ) {\r\n\t\treturn {\r\n\t\t\tcontent: [ { type: 'text', text: `Error: ${ ( error as Error ).message }` } ],\r\n\t\t\tisError: true\r\n\t\t};\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\n\r\nexport function parseTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'parse',\r\n\t\t'Parse wikitext to HTML',\r\n\t\t{\r\n\t\t\ttext: z.string().describe('Wikitext to parse'),\r\n\t\t\ttitle: z.string().optional().describe('Context page title')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Parse wikitext',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { text, title } ) => handleParseTool( text, title )\r\n\t);\r\n}\r\n\r\nasync function handleParseTool(\r\n\ttext: string,\r\n\ttitle?: string\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst callbackArgs = await promisifyBotMethod<[Error | null, string, string[]]>(\r\n\t\t\tbot,\r\n\t\t\t'parse',\r\n\t\t\ttext,\r\n\t\t\ttitle || ''\r\n\t\t);\r\n\r\n\t\tconst xml = callbackArgs[1] || '';\r\n\t\tconst images = Array.isArray(callbackArgs[2]) ? callbackArgs[2] : [];\r\n\r\n\t\tconst output = [\r\n\t\t\t'Parsed XML structure:',\r\n\t\t\t'',\r\n\t\t\txml,\r\n\t\t\t'',\r\n\t\t\t`Images found: ${images.length > 0 ? images.join(', ') : 'none'}`\r\n\t\t].join( '\\n' );\r\n\r\n\t\treturn {\r\n\t\t\tcontent: [ { type: 'text', text: output } ]\r\n\t\t};\r\n\t} catch ( error ) {\r\n\t\treturn {\r\n\t\t\tcontent: [ { type: 'text', text: `Error: ${ ( error as Error ).message }` } ],\r\n\t\t\tisError: true\r\n\t\t};\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface RecentChange extends Record<string, any> {\r\n\ttitle: string;\r\n\ttimestamp: string;\r\n\tuser: string;\r\n\tcomment: string;\r\n}\r\n\r\nexport function getRecentChangesTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-recent-changes',\r\n\t\t'Get recent changes on the wiki',\r\n\t\t{\r\n\t\t\tstart: z.string().optional().describe('Start timestamp'),\r\n\t\t\tlimit: z.number().optional().default(50).describe('Maximum number of changes to return')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get recent changes',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { start, limit } ) => handleGetRecentChangesTool( start, limit )\r\n\t);\r\n}\r\n\r\nasync function handleGetRecentChangesTool(\r\n\tstart?: string,\r\n\tlimit: number = 50\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\t// Handle getRecentChanges's callback signature manually\r\n\t\tconst changes = await new Promise<RecentChange[]>((resolve, reject) => {\r\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n\t\t\t(bot as any).getRecentChanges(start, (err: Error | null, ...args: any[]) => {\r\n\t\t\t\tif (err) {\r\n\t\t\t\t\treject(err);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tconst chgs = args[0];\r\n\t\t\t\t\tresolve(Array.isArray(chgs) ? chgs : []);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\t// Limit results\r\n\t\tconst limitedChanges = changes.slice(0, limit);\r\n\r\n\t\treturn jsonResult({\r\n\t\t\ttotal: changes.length,\r\n\t\t\tlimit,\r\n\t\t\tstart,\r\n\t\t\tchanges: limitedChanges\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get recent changes', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\nexport function getSiteInfoTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-site-info',\r\n\t\t'Get site information from MediaWiki',\r\n\t\t{\r\n\t\t\tproperties: z.array(z.string()).describe('List of site information properties to retrieve')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get site info',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { properties } ) => handleGetSiteInfoTool( properties )\r\n\t);\r\n}\r\n\r\nasync function handleGetSiteInfoTool(\r\n\tproperties: string[]\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst info = await promisifyBotMethod<Record<string, unknown>>(\r\n\t\t\tbot,\r\n\t\t\t'getSiteInfo',\r\n\t\t\tproperties\r\n\t\t);\r\n\r\n\t\treturn jsonResult(info || {});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get site info', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface SiteStats extends Record<string, any> {\r\n\tpages: number;\r\n\tarticles: number;\r\n\tedits: number;\r\n\timages: number;\r\n\tusers: number;\r\n\tactiveusers: number;\r\n\tadmins: number;\r\n\tjobs: number;\r\n}\r\n\r\nexport function getSiteStatsTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-site-stats',\r\n\t\t'Get site statistics',\r\n\t\t{},\r\n\t\t{\r\n\t\t\ttitle: 'Get site stats',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync () => handleGetSiteStatsTool()\r\n\t);\r\n}\r\n\r\nasync function handleGetSiteStatsTool(): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst stats = await promisifyBotMethod<SiteStats>(\r\n\t\t\tbot,\r\n\t\t\t'getSiteStats'\r\n\t\t);\r\n\r\n\t\treturn jsonResult(stats);\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get site stats', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\nexport function getMediaWikiVersionTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-mediawiki-version',\r\n\t\t'Get MediaWiki version running on the server',\r\n\t\t{},\r\n\t\t{\r\n\t\t\ttitle: 'Get MediaWiki version',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync () => handleGetMediaWikiVersionTool()\r\n\t);\r\n}\r\n\r\nasync function handleGetMediaWikiVersionTool(): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst version = await promisifyBotMethod<string>(\r\n\t\t\tbot,\r\n\t\t\t'getMediaWikiVersion'\r\n\t\t);\r\n\r\n\t\treturn jsonResult({ version });\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get MediaWiki version', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface QueryPageResult extends Record<string, any> {\r\n\ttitle: string;\r\n\tvalue: number;\r\n}\r\n\r\nexport function getQueryPageTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-query-page',\r\n\t\t'Get results from a query page (special page)',\r\n\t\t{\r\n\t\t\tname: z.string().describe('Name of the query page')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get query page results',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { name } ) => handleGetQueryPageTool( name )\r\n\t);\r\n}\r\n\r\nasync function handleGetQueryPageTool(\r\n\tname: string\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst results = await promisifyBotMethod<QueryPageResult[]>(\r\n\t\t\tbot,\r\n\t\t\t'getQueryPage',\r\n\t\t\tname\r\n\t\t);\r\n\r\n\t\treturn jsonResult({\r\n\t\t\tname,\r\n\t\t\tresults,\r\n\t\t\tcount: results.length\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get query page results', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface ExternalLink extends Record<string, any> {\r\n\t'*': string;\r\n}\r\n\r\nexport function getExternalLinksTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-external-links',\r\n\t\t'Get all external links from an article',\r\n\t\t{\r\n\t\t\ttitle: z.union([z.string(), z.number()]).describe('Article title or page ID')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get external links',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { title } ) => handleGetExternalLinksTool( title )\r\n\t);\r\n}\r\n\r\nasync function handleGetExternalLinksTool(\r\n\ttitle: string | number\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst links = await promisifyBotMethod<ExternalLink[]>(\r\n\t\t\tbot,\r\n\t\t\t'getExternalLinks',\r\n\t\t\ttitle\r\n\t\t);\r\n\r\n\t\treturn jsonResult({\r\n\t\t\ttitle,\r\n\t\t\tlinks: links.map(link => link['*']),\r\n\t\t\tcount: links.length\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get external links', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface Backlink extends Record<string, any> {\r\n\ttitle: string;\r\n\tpageid: number;\r\n}\r\n\r\nexport function getBacklinksTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'get-backlinks',\r\n\t\t'Get all backlinks to a specific page',\r\n\t\t{\r\n\t\t\ttitle: z.string().describe('Target page title to find backlinks for')\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Get backlinks',\r\n\t\t\treadOnlyHint: true,\r\n\t\t\tdestructiveHint: false\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( { title } ) => handleGetBacklinksTool( title )\r\n\t);\r\n}\r\n\r\nasync function handleGetBacklinksTool(\r\n\ttitle: string\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst backlinks = await promisifyBotMethod<Backlink[]>(\r\n\t\t\tbot,\r\n\t\t\t'getBacklinks',\r\n\t\t\ttitle\r\n\t\t);\r\n\r\n\t\treturn jsonResult({\r\n\t\t\ttarget: title,\r\n\t\t\tbacklinks,\r\n\t\t\tcount: backlinks.length\r\n\t\t});\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to get backlinks', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\nexport function editTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'edit',\r\n\t\t'Edit a wiki page (requires authentication)',\r\n\t\t{\r\n\t\t\ttitle: z.string().describe( 'Page title to edit' ),\r\n\t\t\tcontent: z.string().describe( 'New content for the page' ),\r\n\t\t\tsummary: z.string().describe( 'Edit summary' ),\r\n\t\t\tminor: z.boolean().optional().default( false ).describe( 'Mark as minor edit' )\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Edit page',\r\n\t\t\treadOnlyHint: false,\r\n\t\t\tdestructiveHint: true\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( params ) => handleEditTool( params )\r\n\t);\r\n}\r\n\r\nasync function handleEditTool(\r\n\tparams: {\r\n\t\ttitle: string;\r\n\t\tcontent: string;\r\n\t\tsummary: string;\r\n\t\tminor?: boolean;\r\n\t}\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst prefixedSummary = `[nodemw-mcp] ${params.summary}`;\r\n\r\n\t\tconst result = await promisifyBotMethod<{\r\n\t\t\ttitle: string;\r\n\t\t\tpageid?: number;\r\n\t\t\toldrevid?: number;\r\n\t\t\tnewrevid?: number;\r\n\t\t}>(\r\n\t\t\tbot,\r\n\t\t\t'edit',\r\n\t\t\tparams.title,\r\n\t\t\tparams.content,\r\n\t\t\tprefixedSummary,\r\n\t\t\tparams.minor || false\r\n\t\t);\r\n\r\n\t\treturn jsonResult(result);\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to edit page', error as Error);\r\n\t}\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\nexport function appendTool( server: McpServer ): RegisteredTool {\r\n\treturn server.tool(\r\n\t\t'append',\r\n\t\t'Append content to a wiki page (requires authentication)',\r\n\t\t{\r\n\t\t\ttitle: z.string().describe( 'Page title' ),\r\n\t\t\tcontent: z.string().describe( 'Content to append' ),\r\n\t\t\tsummary: z.string().describe( 'Edit summary' )\r\n\t\t},\r\n\t\t{\r\n\t\t\ttitle: 'Append to page',\r\n\t\t\treadOnlyHint: false,\r\n\t\t\tdestructiveHint: true\r\n\t\t} as ToolAnnotations,\r\n\t\tasync ( params ) => handleAppendTool( params )\r\n\t);\r\n}\r\n\r\nasync function handleAppendTool(\r\n\tparams: {\r\n\t\ttitle: string;\r\n\t\tcontent: string;\r\n\t\tsummary: string;\r\n\t}\r\n): Promise<CallToolResult> {\r\n\ttry {\r\n\t\tconst bot = await getBot();\r\n\t\tconst prefixedSummary = `[nodemw-mcp] ${params.summary}`;\r\n\r\n\t\tawait promisifyBotMethod<void>(\r\n\t\t\tbot,\r\n\t\t\t'append',\r\n\t\t\tparams.title,\r\n\t\t\tparams.content,\r\n\t\t\tprefixedSummary\r\n\t\t);\r\n\r\n\t\treturn jsonResult({ success: true, title: params.title });\r\n\t} catch ( error ) {\r\n\t\treturn errorResult('Failed to append to page', error as Error);\r\n\t}\r\n}\r\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function prependTool( server: McpServer ): RegisteredTool {\n\treturn server.tool(\n\t\t'prepend',\n\t\t'Prepend content to a wiki page (requires authentication)',\n\t\t{\n\t\t\ttitle: z.string().describe( 'Page title to prepend to' ),\n\t\t\tcontent: z.string().describe( 'Content to prepend' ),\n\t\t\tsummary: z.string().describe( 'Edit summary' ),\n\t\t},\n\t\t{\n\t\t\ttitle: 'Prepend to page',\n\t\t\treadOnlyHint: false,\n\t\t\tdestructiveHint: true\n\t\t} as ToolAnnotations,\n\t\tasync ( params ) => handlePrependTool( params )\n\t);\n}\n\nasync function handlePrependTool(\n\tparams: {\n\t\ttitle: string;\n\t\tcontent: string;\n\t\tsummary: string;\n\t}\n): Promise<CallToolResult> {\n\ttry {\n\t\tconst bot = await getBot();\n\t\tconst prefixedSummary = `[nodemw-mcp] ${params.summary}`;\n\n\t\tconst result = await promisifyBotMethod<{\n\t\t\ttitle: string;\n\t\t\tpageid?: number;\n\t\t\toldrevid?: number;\n\t\t\tnewrevid?: number;\n\t\t}>(\n\t\t\tbot,\n\t\t\t'prepend',\n\t\t\tparams.title,\n\t\t\tparams.content,\n\t\t\tprefixedSummary\n\t\t);\n\n\t\treturn jsonResult(result);\n\t} catch ( error ) {\n\t\treturn errorResult('Failed to prepend to page', error as Error);\n\t}\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function moveTool( server: McpServer ): RegisteredTool {\n\treturn server.tool(\n\t\t'move',\n\t\t'Move (rename) a wiki page (requires authentication)',\n\t\t{\n\t\t\tfrom: z.string().describe( 'Current page title' ),\n\t\t\tto: z.string().describe( 'New page title' ),\n\t\t\tsummary: z.string().describe( 'Move summary' ),\n\t\t},\n\t\t{\n\t\t\ttitle: 'Move page',\n\t\t\treadOnlyHint: false,\n\t\t\tdestructiveHint: true\n\t\t} as ToolAnnotations,\n\t\tasync ( params ) => handleMoveTool( params )\n\t);\n}\n\nasync function handleMoveTool(\n\tparams: {\n\t\tfrom: string;\n\t\tto: string;\n\t\tsummary: string;\n\t}\n): Promise<CallToolResult> {\n\ttry {\n\t\tconst bot = await getBot();\n\t\tconst prefixedSummary = `[nodemw-mcp] ${params.summary}`;\n\n\t\tconst result = await promisifyBotMethod<{\n\t\t\tfrom: string;\n\t\t\tto: string;\n\t\t\treason: string;\n\t\t}>(\n\t\t\tbot,\n\t\t\t'move',\n\t\t\tparams.from,\n\t\t\tparams.to,\n\t\t\tprefixedSummary\n\t\t);\n\n\t\treturn jsonResult(result);\n\t} catch ( error ) {\n\t\treturn errorResult('Failed to move page', error as Error);\n\t}\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function deleteTool( server: McpServer ): RegisteredTool {\n\treturn server.tool(\n\t\t'delete',\n\t\t'Delete a wiki page (requires authentication)',\n\t\t{\n\t\t\ttitle: z.string().describe( 'Page title to delete' ),\n\t\t\treason: z.string().describe( 'Reason for deletion' ),\n\t\t},\n\t\t{\n\t\t\ttitle: 'Delete page',\n\t\t\treadOnlyHint: false,\n\t\t\tdestructiveHint: true\n\t\t} as ToolAnnotations,\n\t\tasync ( params ) => handleDeleteTool( params )\n\t);\n}\n\nasync function handleDeleteTool(\n\tparams: {\n\t\ttitle: string;\n\t\treason: string;\n\t}\n): Promise<CallToolResult> {\n\ttry {\n\t\tconst bot = await getBot();\n\t\tconst prefixedReason = `[nodemw-mcp] ${params.reason}`;\n\n\t\tconst result = await promisifyBotMethod<{\n\t\t\ttitle: string;\n\t\t\treason: string;\n\t\t}>(\n\t\t\tbot,\n\t\t\t'delete',\n\t\t\tparams.title,\n\t\t\tprefixedReason\n\t\t);\n\n\t\treturn jsonResult(result);\n\t} catch ( error ) {\n\t\treturn errorResult('Failed to delete page', error as Error);\n\t}\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function protectTool( server: McpServer ): RegisteredTool {\n\treturn server.tool(\n\t\t'protect',\n\t\t'Protect a wiki page (requires authentication)',\n\t\t{\n\t\t\ttitle: z.string().describe( 'Page title to protect' ),\n\t\t\tprotections: z.array(\n\t\t\t\tz.object({\n\t\t\t\t\ttype: z.string().describe( 'Action type (e.g., edit, move)' ),\n\t\t\t\t\tlevel: z.string().optional().default('all').describe( 'Protection level (e.g., sysop, autoconfirmed)' ),\n\t\t\t\t\texpiry: z.string().optional().describe( 'Expiry time (e.g., 1 week, never)' )\n\t\t\t\t})\n\t\t\t).describe( 'Protection settings' ),\n\t\t\treason: z.string().optional().describe( 'Reason for protection' ),\n\t\t\tcascade: z.boolean().optional().default(false).describe( 'Apply cascade protection' )\n\t\t},\n\t\t{\n\t\t\ttitle: 'Protect page',\n\t\t\treadOnlyHint: false,\n\t\t\tdestructiveHint: true\n\t\t} as ToolAnnotations,\n\t\tasync ( params ) => handleProtectTool( params )\n\t);\n}\n\nasync function handleProtectTool(\n\tparams: {\n\t\ttitle: string;\n\t\tprotections: Array<{ type: string; level?: string; expiry?: string }>;\n\t\treason?: string;\n\t\tcascade?: boolean;\n\t}\n): Promise<CallToolResult> {\n\ttry {\n\t\tconst bot = await getBot();\n\t\tconst options: any = {};\n\t\tif (params.reason) {\n\t\t\toptions.reason = `[nodemw-mcp] ${params.reason}`;\n\t\t}\n\t\tif (params.cascade) {\n\t\t\toptions.cascade = params.cascade;\n\t\t}\n\n\t\tconst result = await promisifyBotMethod<{\n\t\t\ttitle: string;\n\t\t\tprotections: any[];\n\t\t}>(\n\t\t\tbot,\n\t\t\t'protect',\n\t\t\tparams.title,\n\t\t\tparams.protections,\n\t\t\toptions\n\t\t);\n\n\t\treturn jsonResult(result);\n\t} catch ( error ) {\n\t\treturn errorResult('Failed to protect page', error as Error);\n\t}\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function purgeTool( server: McpServer ): RegisteredTool {\n\treturn server.tool(\n\t\t'purge',\n\t\t'Purge cache for wiki pages',\n\t\t{\n\t\t\ttitles: z.union([z.string(), z.array(z.string())]).describe( 'Page title(s) or category to purge' ),\n\t\t},\n\t\t{\n\t\t\ttitle: 'Purge pages',\n\t\t\treadOnlyHint: false,\n\t\t\tdestructiveHint: false\n\t\t} as ToolAnnotations,\n\t\tasync ( params ) => handlePurgeTool( params )\n\t);\n}\n\nasync function handlePurgeTool(\n\tparams: {\n\t\ttitles: string | string[];\n\t}\n): Promise<CallToolResult> {\n\ttry {\n\t\tconst bot = await getBot();\n\n\t\tconst result = await promisifyBotMethod<any[]>(\n\t\t\tbot,\n\t\t\t'purge',\n\t\t\tparams.titles\n\t\t);\n\n\t\treturn jsonResult(result);\n\t} catch ( error ) {\n\t\treturn errorResult('Failed to purge pages', error as Error);\n\t}\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function sendEmailTool( server: McpServer ): RegisteredTool {\n\treturn server.tool(\n\t\t'send-email',\n\t\t'Send email to a wiki user (requires authentication)',\n\t\t{\n\t\t\tusername: z.string().describe( 'Username to email' ),\n\t\t\tsubject: z.string().describe( 'Email subject' ),\n\t\t\ttext: z.string().describe( 'Email content' ),\n\t\t},\n\t\t{\n\t\t\ttitle: 'Send email',\n\t\t\treadOnlyHint: false,\n\t\t\tdestructiveHint: false\n\t\t} as ToolAnnotations,\n\t\tasync ( params ) => handleSendEmailTool( params )\n\t);\n}\n\nasync function handleSendEmailTool(\n\tparams: {\n\t\tusername: string;\n\t\tsubject: string;\n\t\ttext: string;\n\t}\n): Promise<CallToolResult> {\n\ttry {\n\t\tconst bot = await getBot();\n\n\t\tconst result = await promisifyBotMethod<{\n\t\t\tresult: string;\n\t\t}>(\n\t\t\tbot,\n\t\t\t'sendEmail',\n\t\t\tparams.username,\n\t\t\tparams.subject,\n\t\t\tparams.text\n\t\t);\n\n\t\treturn jsonResult(result);\n\t} catch ( error ) {\n\t\treturn errorResult('Failed to send email', error as Error);\n\t}\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function uploadTool( server: McpServer ): RegisteredTool {\n\treturn server.tool(\n\t\t'upload',\n\t\t'Upload a file to wiki (requires authentication)',\n\t\t{\n\t\t\tfilename: z.string().describe( 'Destination filename on wiki' ),\n\t\t\tcontent: z.string().describe( 'File content as base64 string' ),\n\t\t\tcomment: z.string().optional().describe( 'Upload comment' ),\n\t\t},\n\t\t{\n\t\t\ttitle: 'Upload file',\n\t\t\treadOnlyHint: false,\n\t\t\tdestructiveHint: false\n\t\t} as ToolAnnotations,\n\t\tasync ( params ) => handleUploadTool( params )\n\t);\n}\n\nasync function handleUploadTool(\n\tparams: {\n\t\tfilename: string;\n\t\tcontent: string;\n\t\tcomment?: string;\n\t}\n): Promise<CallToolResult> {\n\ttry {\n\t\tconst bot = await getBot();\n\t\tconst fileContent = Buffer.from(params.content, 'base64');\n\t\tconst comment = params.comment ? `[nodemw-mcp] ${params.comment}` : '[nodemw-mcp] File upload';\n\n\t\tconst result = await promisifyBotMethod<{\n\t\t\tresult: string;\n\t\t\tfilename: string;\n\t\t\timageinfo?: any;\n\t\t}>(\n\t\t\tbot,\n\t\t\t'upload',\n\t\t\tparams.filename,\n\t\t\tfileContent,\n\t\t\tcomment\n\t\t);\n\n\t\treturn jsonResult(result);\n\t} catch ( error ) {\n\t\treturn errorResult('Failed to upload file', error as Error);\n\t}\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function uploadByUrlTool( server: McpServer ): RegisteredTool {\n\treturn server.tool(\n\t\t'upload-by-url',\n\t\t'Upload a file to wiki from URL (requires authentication)',\n\t\t{\n\t\t\tfilename: z.string().describe( 'Destination filename on wiki' ),\n\t\t\turl: z.string().url().describe( 'Source URL to download file from' ),\n\t\t\tsummary: z.string().optional().describe( 'Upload summary' ),\n\t\t},\n\t\t{\n\t\t\ttitle: 'Upload file by URL',\n\t\t\treadOnlyHint: false,\n\t\t\tdestructiveHint: false\n\t\t} as ToolAnnotations,\n\t\tasync ( params ) => handleUploadByUrlTool( params )\n\t);\n}\n\nasync function handleUploadByUrlTool(\n\tparams: {\n\t\tfilename: string;\n\t\turl: string;\n\t\tsummary?: string;\n\t}\n): Promise<CallToolResult> {\n\ttry {\n\t\tconst bot = await getBot();\n\t\tconst prefixedSummary = params.summary ? `[nodemw-mcp] ${params.summary}` : '[nodemw-mcp] File upload from URL';\n\n\t\tconst result = await promisifyBotMethod<{\n\t\t\tresult: string;\n\t\t\tfilename: string;\n\t\t\timageinfo?: any;\n\t\t}>(\n\t\t\tbot,\n\t\t\t'uploadByUrl',\n\t\t\tparams.filename,\n\t\t\tparams.url,\n\t\t\tprefixedSummary\n\t\t);\n\n\t\treturn jsonResult(result);\n\t} catch ( error ) {\n\t\treturn errorResult('Failed to upload file by URL', error as Error);\n\t}\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function addFlowTopicTool( server: McpServer ): RegisteredTool {\n\treturn server.tool(\n\t\t'add-flow-topic',\n\t\t'Add a new Flow topic to a wiki page (requires authentication)',\n\t\t{\n\t\t\ttitle: z.string().describe( 'Page title to add topic to' ),\n\t\t\tsubject: z.string().describe( 'Topic subject' ),\n\t\t\tcontent: z.string().describe( 'Topic content in wikitext' ),\n\t\t},\n\t\t{\n\t\t\ttitle: 'Add Flow topic',\n\t\t\treadOnlyHint: false,\n\t\t\tdestructiveHint: false\n\t\t} as ToolAnnotations,\n\t\tasync ( params ) => handleAddFlowTopicTool( params )\n\t);\n}\n\nasync function handleAddFlowTopicTool(\n\tparams: {\n\t\ttitle: string;\n\t\tsubject: string;\n\t\tcontent: string;\n\t}\n): Promise<CallToolResult> {\n\ttry {\n\t\tconst bot = await getBot();\n\n\t\tconst result = await promisifyBotMethod<{\n\t\t\t'new-topic': {\n\t\t\t\tstatus: string;\n\t\t\t\tworkflow: string;\n\t\t\t};\n\t\t}>(\n\t\t\tbot,\n\t\t\t'addFlowTopic',\n\t\t\tparams.title,\n\t\t\tparams.subject,\n\t\t\tparams.content\n\t\t);\n\n\t\treturn jsonResult(result);\n\t} catch ( error ) {\n\t\treturn errorResult('Failed to add Flow topic', error as Error);\n\t}\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function createAccountTool( server: McpServer ): RegisteredTool {\n\treturn server.tool(\n\t\t'create-account',\n\t\t'Create a new MediaWiki user account (requires authentication)',\n\t\t{\n\t\t\tusername: z.string().describe( 'New account username' ),\n\t\t\tpassword: z.string().describe( 'New account password' ),\n\t\t},\n\t\t{\n\t\t\ttitle: 'Create user account',\n\t\t\treadOnlyHint: false,\n\t\t\tdestructiveHint: false\n\t\t} as ToolAnnotations,\n\t\tasync ( params ) => handleCreateAccountTool( params )\n\t);\n}\n\nasync function handleCreateAccountTool(\n\tparams: {\n\t\tusername: string;\n\t\tpassword: string;\n\t}\n): Promise<CallToolResult> {\n\ttry {\n\t\tconst bot = await getBot();\n\n\t\tconst result = await promisifyBotMethod<any>(\n\t\t\tbot,\n\t\t\t'createAccount',\n\t\t\tparams.username,\n\t\t\tparams.password\n\t\t);\n\n\t\treturn jsonResult(result);\n\t} catch ( error ) {\n\t\treturn errorResult('Failed to create account', error as Error);\n\t}\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\n\n// Read tools\nimport { getArticleTool } from './ro/get-article.js';\nimport { searchTool } from './ro/search.js';\nimport { getPagesInCategoryTool } from './ro/get-pages-in-category.js';\nimport { getCategoriesTool } from './ro/get-categories.js';\nimport { getUsersTool } from './ro/get-users.js';\nimport { getAllPagesTool } from './ro/get-all-pages.js';\nimport { getPagesInNamespaceTool } from './ro/get-pages-in-namespace.js';\nimport { getPagesByPrefixTool } from './ro/get-pages-by-prefix.js';\nimport { getPagesTranscludingTool } from './ro/get-pages-transcluding.js';\nimport { getArticleRevisionsTool } from './ro/get-article-revisions.js';\nimport { getArticleCategoriesTool } from './ro/get-article-categories.js';\nimport { getArticlePropertiesTool } from './ro/get-article-properties.js';\nimport { getArticleInfoTool } from './ro/get-article-info.js';\nimport { getUserContribsTool } from './ro/get-user-contribs.js';\nimport { whoamiTool } from './ro/whoami.js';\nimport { whoisTool } from './ro/whois.js';\nimport { whoareTool } from './ro/whoare.js';\nimport { getImagesTool } from './ro/get-images.js';\nimport { getImagesFromArticleTool } from './ro/get-images-from-article.js';\nimport { getImageUsageTool } from './ro/get-image-usage.js';\nimport { getImageInfoTool } from './ro/get-image-info.js';\nimport { getLogTool } from './ro/get-log.js';\nimport { expandTemplatesTool } from './ro/expand-templates.js';\nimport { parseTool } from './ro/parse.js';\nimport { getRecentChangesTool } from './ro/get-recent-changes.js';\nimport { getSiteInfoTool } from './ro/get-site-info.js';\nimport { getSiteStatsTool } from './ro/get-site-stats.js';\nimport { getMediaWikiVersionTool } from './ro/get-mediawiki-version.js';\nimport { getQueryPageTool } from './ro/get-query-page.js';\nimport { getExternalLinksTool } from './ro/get-external-links.js';\nimport { getBacklinksTool } from './ro/get-backlinks.js';\n\n// Write tools\nimport { editTool } from './editing/edit.js';\nimport { appendTool } from './editing/append.js';\nimport { prependTool } from './editing/prepend.js';\nimport { moveTool } from './editing/move.js';\nimport { deleteTool } from './editing/delete.js';\nimport { protectTool } from './editing/protect.js';\nimport { purgeTool } from './editing/purge.js';\nimport { sendEmailTool } from './editing/send-email.js';\nimport { uploadTool } from './editing/upload.js';\nimport { uploadByUrlTool } from './editing/upload-by-url.js';\nimport { addFlowTopicTool } from './editing/add-flow-topic.js';\nimport { createAccountTool } from './editing/create-account.js';\n\nconst toolRegistrars = [\n\t// Read tools\n\tgetArticleTool,\n\tsearchTool,\n\tgetPagesInCategoryTool,\n\tgetCategoriesTool,\n\tgetUsersTool,\n\tgetAllPagesTool,\n\tgetPagesInNamespaceTool,\n\tgetPagesByPrefixTool,\n\tgetPagesTranscludingTool,\n\tgetArticleRevisionsTool,\n\tgetArticleCategoriesTool,\n\tgetArticlePropertiesTool,\n\tgetArticleInfoTool,\n\tgetUserContribsTool,\n\twhoamiTool,\n\twhoisTool,\n\twhoareTool,\n\tgetImagesTool,\n\tgetImagesFromArticleTool,\n\tgetImageUsageTool,\n\tgetImageInfoTool,\n\tgetLogTool,\n\texpandTemplatesTool,\n\tparseTool,\n\tgetRecentChangesTool,\n\tgetSiteInfoTool,\n\tgetSiteStatsTool,\n\tgetMediaWikiVersionTool,\n\tgetQueryPageTool,\n\tgetExternalLinksTool,\n\tgetBacklinksTool,\n\n\t// Write tools\n\teditTool,\n\tappendTool,\n\tprependTool,\n\tmoveTool,\n\tdeleteTool,\n\tprotectTool,\n\tpurgeTool,\n\tsendEmailTool,\n\tuploadTool,\n\tuploadByUrlTool,\n\taddFlowTopicTool,\n\tcreateAccountTool\n];\n\nexport function registerAllTools(server: McpServer): RegisteredTool[] {\n\tconst registeredTools: RegisteredTool[] = [];\n\tfor (const registrar of toolRegistrars) {\n\t\ttry {\n\t\t\tregisteredTools.push(registrar(server));\n\t\t} catch (error) {\n\t\t\tconsole.error(`Error registering tool: ${(error as Error).message}`);\n\t\t}\n\t}\n\treturn registeredTools;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,OAAS,wBAAAA,OAA4B,4CACrC,OAAS,aAAAC,OAAiB,OCD1B,OAAS,aAAAC,OAAiB,0CAEnB,IAAMC,EAAa,wBAQnB,SAASC,EAAaC,EAAuC,CACnE,IAAIC,EACJ,OAAID,EACHC,EAAc,gBAAgBD,EAAS,QAAQ,KAAKA,EAAS,IAAI,cAAcA,EAAS,SAAS,2FAEjGC,EAAc,2LAGR,IAAIJ,GACV,CACC,KAAM,oBACN,QAAS,QACT,YAAAI,CACD,EACA,CAAE,aAAc,CAAE,MAAO,CAAC,CAAE,CAAE,CAC/B,CACD,CC1BA,OAAS,KAAAC,MAAS,MCAlB,OAAOC,OAAS,SAmBhB,IAAIC,EAA0B,KAC1BC,GAAoC,KAEjC,SAASC,EAAiBC,EAA4B,CAC5DF,GAAeE,CAChB,CAEA,SAASC,EAAoBD,EAA2B,CACvD,GAAM,CACL,OAAAE,EACA,KAAAC,EACA,SAAAC,EACA,KAAAC,EACA,MAAAC,EACA,UAAAC,EACA,YAAAC,EACA,MAAAC,EACA,SAAAC,EACA,SAAAC,EACA,OAAAC,EACA,OAAAC,CACD,EAAIb,EAEJ,OAAO,IAAIc,GAAI,CACd,OAAAZ,EACA,SAAUE,GAAY,QACtB,KAAAC,EACA,KAAAF,EACA,MAAAG,EACA,UAAWC,GAAaQ,EACxB,YAAAP,EACA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AAY,IAAIC,GACtB,MAAMpB,EAAO,QAAQmB,CAAS,CAC/B,CAEAb,GAAK,EAAE,MAAM,QAAQ,KAAK",
6
+ "names": ["StdioServerTransport", "parseArgs", "McpServer", "USER_AGENT", "createServer", "siteInfo", "description", "z", "Bot", "botInstance", "serverConfig", "initServerConfig", "config", "createBotFromConfig", "server", "path", "protocol", "port", "proxy", "userAgent", "concurrency", "debug", "username", "password", "domain", "dryRun", "Bot", "USER_AGENT", "testApiConnection", "bot", "promisifyBotMethod", "autoDetectPath", "baseConfig", "pathsToTry", "testConfig", "initBot", "resolve", "reject", "err", "getBot", "promisifyBotMethod", "bot", "method", "args", "resolve", "reject", "callback", "err", "result", "getArticleTool", "server", "z", "title", "followRedirect", "redirectInfo", "handleGetArticleTool", "bot", "getBot", "result", "resolve", "reject", "callback", "err", "content", "redirect", "promisifyBotMethod", "error", "z", "jsonResult", "data", "errorResult", "message", "error", "searchTool", "server", "z", "keyword", "limit", "handleSearchTool", "bot", "getBot", "results", "promisifyBotMethod", "limitedResults", "jsonResult", "error", "errorResult", "z", "getPagesInCategoryTool", "server", "z", "category", "handleGetPagesInCategoryTool", "bot", "getBot", "cleanCategory", "results", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getCategoriesTool", "server", "z", "prefix", "handleGetCategoriesTool", "bot", "getBot", "results", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getUsersTool", "server", "z", "prefix", "onlyWithEdits", "handleGetUsersTool", "bot", "getBot", "results", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getAllPagesTool", "server", "z", "limit", "handleGetAllPagesTool", "bot", "getBot", "allResults", "promisifyBotMethod", "results", "jsonResult", "error", "errorResult", "z", "getPagesInNamespaceTool", "server", "z", "namespace", "handleGetPagesInNamespaceTool", "bot", "getBot", "results", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getPagesByPrefixTool", "server", "z", "prefix", "handleGetPagesByPrefixTool", "bot", "getBot", "results", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getPagesTranscludingTool", "server", "z", "template", "handleGetPagesTranscludingTool", "bot", "getBot", "rawResults", "promisifyBotMethod", "results", "page", "jsonResult", "error", "errorResult", "z", "getArticleRevisionsTool", "server", "z", "title", "handleGetArticleRevisionsTool", "bot", "getBot", "revisions", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getArticleCategoriesTool", "server", "z", "title", "handleGetArticleCategoriesTool", "bot", "getBot", "categories", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getArticlePropertiesTool", "server", "z", "title", "handleGetArticlePropertiesTool", "bot", "getBot", "properties", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getArticleInfoTool", "server", "z", "title", "properties", "handleGetArticleInfoTool", "bot", "getBot", "info", "promisifyBotMethod", "results", "jsonResult", "error", "errorResult", "z", "getUserContribsTool", "server", "z", "username", "namespace", "limit", "handleGetUserContribsTool", "bot", "getBot", "options", "callbackArgs", "promisifyBotMethod", "contribs", "limitedContribs", "jsonResult", "error", "errorResult", "whoamiTool", "server", "handleWhoamiTool", "bot", "getBot", "userInfo", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "whoisTool", "server", "z", "username", "handleWhoisTool", "bot", "getBot", "userInfo", "promisifyBotMethod", "errorResult", "jsonResult", "error", "z", "whoareTool", "server", "z", "params", "handleWhoareTool", "bot", "getBot", "users", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getImagesTool", "server", "z", "startFrom", "limit", "handleGetImagesTool", "bot", "getBot", "images", "resolve", "reject", "err", "args", "imgs", "limitedImages", "jsonResult", "error", "errorResult", "z", "getImagesFromArticleTool", "server", "z", "title", "handleGetImagesFromArticleTool", "bot", "getBot", "images", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getImageUsageTool", "server", "z", "filename", "handleGetImageUsageTool", "bot", "getBot", "pages", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getImageInfoTool", "server", "z", "filename", "handleGetImageInfoTool", "bot", "getBot", "info", "promisifyBotMethod", "jsonResult", "errorResult", "error", "z", "getLogTool", "server", "z", "type", "start", "limit", "handleGetLogTool", "bot", "getBot", "entries", "resolve", "reject", "err", "args", "ents", "limitedEntries", "jsonResult", "error", "errorResult", "z", "expandTemplatesTool", "server", "z", "text", "title", "handleExpandTemplatesTool", "bot", "getBot", "promisifyBotMethod", "error", "z", "parseTool", "server", "z", "text", "title", "handleParseTool", "bot", "getBot", "callbackArgs", "promisifyBotMethod", "xml", "images", "error", "z", "getRecentChangesTool", "server", "z", "start", "limit", "handleGetRecentChangesTool", "bot", "getBot", "changes", "resolve", "reject", "err", "args", "chgs", "limitedChanges", "jsonResult", "error", "errorResult", "z", "getSiteInfoTool", "server", "z", "properties", "handleGetSiteInfoTool", "bot", "getBot", "info", "promisifyBotMethod", "jsonResult", "error", "errorResult", "getSiteStatsTool", "server", "handleGetSiteStatsTool", "bot", "getBot", "stats", "promisifyBotMethod", "jsonResult", "error", "errorResult", "getMediaWikiVersionTool", "server", "handleGetMediaWikiVersionTool", "bot", "getBot", "version", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getQueryPageTool", "server", "z", "name", "handleGetQueryPageTool", "bot", "getBot", "results", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getExternalLinksTool", "server", "z", "title", "handleGetExternalLinksTool", "bot", "getBot", "links", "promisifyBotMethod", "jsonResult", "link", "error", "errorResult", "z", "getBacklinksTool", "server", "z", "title", "handleGetBacklinksTool", "bot", "getBot", "backlinks", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "editTool", "server", "z", "params", "handleEditTool", "bot", "getBot", "prefixedSummary", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "appendTool", "server", "z", "params", "handleAppendTool", "bot", "getBot", "prefixedSummary", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "prependTool", "server", "z", "params", "handlePrependTool", "bot", "getBot", "prefixedSummary", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "moveTool", "server", "z", "params", "handleMoveTool", "bot", "getBot", "prefixedSummary", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "deleteTool", "server", "z", "params", "handleDeleteTool", "bot", "getBot", "prefixedReason", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "protectTool", "server", "z", "params", "handleProtectTool", "bot", "getBot", "options", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "purgeTool", "server", "z", "params", "handlePurgeTool", "bot", "getBot", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "sendEmailTool", "server", "z", "params", "handleSendEmailTool", "bot", "getBot", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "uploadTool", "server", "z", "params", "handleUploadTool", "bot", "getBot", "fileContent", "comment", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "uploadByUrlTool", "server", "z", "params", "handleUploadByUrlTool", "bot", "getBot", "prefixedSummary", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "addFlowTopicTool", "server", "z", "params", "handleAddFlowTopicTool", "bot", "getBot", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "createAccountTool", "server", "z", "params", "handleCreateAccountTool", "bot", "getBot", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "toolRegistrars", "getArticleTool", "searchTool", "getPagesInCategoryTool", "getCategoriesTool", "getUsersTool", "getAllPagesTool", "getPagesInNamespaceTool", "getPagesByPrefixTool", "getPagesTranscludingTool", "getArticleRevisionsTool", "getArticleCategoriesTool", "getArticlePropertiesTool", "getArticleInfoTool", "getUserContribsTool", "whoamiTool", "whoisTool", "whoareTool", "getImagesTool", "getImagesFromArticleTool", "getImageUsageTool", "getImageInfoTool", "getLogTool", "expandTemplatesTool", "parseTool", "getRecentChangesTool", "getSiteInfoTool", "getSiteStatsTool", "getMediaWikiVersionTool", "getQueryPageTool", "getExternalLinksTool", "getBacklinksTool", "editTool", "appendTool", "prependTool", "moveTool", "deleteTool", "protectTool", "purgeTool", "sendEmailTool", "uploadTool", "uploadByUrlTool", "addFlowTopicTool", "createAccountTool", "registerAllTools", "server", "registeredTools", "registrar", "error", "parseCliArgs", "values", "positionals", "parseArgs", "serverUrl", "server", "protocol", "port", "url", "pathFromEnv", "pathExplicit", "main", "config", "autoDetectPath", "err", "initServerConfig", "initBot", "bot", "getBot", "siteInfo", "general", "promisifyBotMethod", "createServer", "registerAllTools", "transport", "StdioServerTransport"]
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiedada/nodemw-mcp-server",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "MCP server for nodemw - MediaWiki API client",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -8,18 +8,12 @@
8
8
  "nodemw-mcp-server": "./dist/index.js"
9
9
  },
10
10
  "scripts": {
11
- "build": "tsc",
12
- "dev": "tsc --watch",
11
+ "build": "node scripts/build.js",
12
+ "dev": "node scripts/build.js --watch",
13
13
  "lint": "eslint src/**/*.ts",
14
14
  "test": "vitest",
15
15
  "prepare": "npm run build",
16
- "debug": "ts-node --inspect-brk dist/index.js",
17
- "clean": "rimraf dist dist-bundle",
18
- "clean:bundle": "rimraf dist-bundle",
19
- "build:single": "node scripts/build-single.js",
20
- "build:bundle": "npm run build && npm run build:single",
21
- "build:standalone": "npm run clean:bundle && npm run build:single",
22
- "build:all": "npm run clean && npm run build && npm run build:single"
16
+ "clean": "rimraf dist"
23
17
  },
24
18
  "keywords": [
25
19
  "mcp",
@@ -28,7 +22,7 @@
28
22
  "wiki"
29
23
  ],
30
24
  "author": "",
31
- "license": "LGPL-3.0",
25
+ "license": "BSD-2-Clause",
32
26
  "dependencies": {
33
27
  "@modelcontextprotocol/sdk": "^1.0.0",
34
28
  "nodemw": "^0.26.0",
@@ -1,21 +0,0 @@
1
- import Bot from 'nodemw';
2
- export interface ServerConfig {
3
- server: string;
4
- endpoint: string;
5
- protocol?: string;
6
- port?: number;
7
- proxy?: string;
8
- userAgent?: string;
9
- concurrency?: number;
10
- debug?: boolean;
11
- username?: string;
12
- password?: string;
13
- token?: string;
14
- domain?: string;
15
- dryRun?: boolean;
16
- }
17
- export declare function initServerConfig(config: ServerConfig): void;
18
- export declare function getBot(): Promise<Bot>;
19
- export declare function clearBotCache(): void;
20
- export declare function promisifyBotMethod<T>(bot: Bot, method: string, ...args: unknown[]): Promise<T>;
21
- //# sourceMappingURL=nodemwBot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nodemwBot.d.ts","sourceRoot":"","sources":["../../src/common/nodemwBot.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,QAAQ,CAAC;AAGzB,MAAM,WAAW,YAAY;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAKD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAE3D;AAED,wBAAsB,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,CAsD3C;AAED,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EACnC,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,GAAG,IAAI,EAAE,OAAO,EAAE,GAChB,OAAO,CAAC,CAAC,CAAC,CAaZ"}