@xiedada/nodemw-mcp-server 0.0.1

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 +166 -0
  2. package/README.md +145 -0
  3. package/dist/common/nodemwBot.d.ts +21 -0
  4. package/dist/common/nodemwBot.d.ts.map +1 -0
  5. package/dist/common/nodemwBot.js +62 -0
  6. package/dist/common/nodemwBot.js.map +1 -0
  7. package/dist/common/utils.d.ts +7 -0
  8. package/dist/common/utils.d.ts.map +1 -0
  9. package/dist/common/utils.js +38 -0
  10. package/dist/common/utils.js.map +1 -0
  11. package/dist/index.d.ts +3 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +64 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/server.d.ts +4 -0
  16. package/dist/server.d.ts.map +1 -0
  17. package/dist/server.js +9 -0
  18. package/dist/server.js.map +1 -0
  19. package/dist/tools/editing/add-flow-topic.d.ts +3 -0
  20. package/dist/tools/editing/add-flow-topic.d.ts.map +1 -0
  21. package/dist/tools/editing/add-flow-topic.js +25 -0
  22. package/dist/tools/editing/add-flow-topic.js.map +1 -0
  23. package/dist/tools/editing/append.d.ts +3 -0
  24. package/dist/tools/editing/append.d.ts.map +1 -0
  25. package/dist/tools/editing/append.js +26 -0
  26. package/dist/tools/editing/append.js.map +1 -0
  27. package/dist/tools/editing/create-account.d.ts +3 -0
  28. package/dist/tools/editing/create-account.d.ts.map +1 -0
  29. package/dist/tools/editing/create-account.js +24 -0
  30. package/dist/tools/editing/create-account.js.map +1 -0
  31. package/dist/tools/editing/delete.d.ts +3 -0
  32. package/dist/tools/editing/delete.d.ts.map +1 -0
  33. package/dist/tools/editing/delete.js +25 -0
  34. package/dist/tools/editing/delete.js.map +1 -0
  35. package/dist/tools/editing/edit.d.ts +3 -0
  36. package/dist/tools/editing/edit.d.ts.map +1 -0
  37. package/dist/tools/editing/edit.js +27 -0
  38. package/dist/tools/editing/edit.js.map +1 -0
  39. package/dist/tools/editing/move.d.ts +3 -0
  40. package/dist/tools/editing/move.d.ts.map +1 -0
  41. package/dist/tools/editing/move.js +26 -0
  42. package/dist/tools/editing/move.js.map +1 -0
  43. package/dist/tools/editing/prepend.d.ts +3 -0
  44. package/dist/tools/editing/prepend.d.ts.map +1 -0
  45. package/dist/tools/editing/prepend.js +26 -0
  46. package/dist/tools/editing/prepend.js.map +1 -0
  47. package/dist/tools/editing/protect.d.ts +3 -0
  48. package/dist/tools/editing/protect.d.ts.map +1 -0
  49. package/dist/tools/editing/protect.js +37 -0
  50. package/dist/tools/editing/protect.js.map +1 -0
  51. package/dist/tools/editing/purge.d.ts +3 -0
  52. package/dist/tools/editing/purge.d.ts.map +1 -0
  53. package/dist/tools/editing/purge.js +23 -0
  54. package/dist/tools/editing/purge.js.map +1 -0
  55. package/dist/tools/editing/send-email.d.ts +3 -0
  56. package/dist/tools/editing/send-email.d.ts.map +1 -0
  57. package/dist/tools/editing/send-email.js +25 -0
  58. package/dist/tools/editing/send-email.js.map +1 -0
  59. package/dist/tools/editing/upload-by-url.d.ts +3 -0
  60. package/dist/tools/editing/upload-by-url.d.ts.map +1 -0
  61. package/dist/tools/editing/upload-by-url.js +26 -0
  62. package/dist/tools/editing/upload-by-url.js.map +1 -0
  63. package/dist/tools/editing/upload.d.ts +3 -0
  64. package/dist/tools/editing/upload.d.ts.map +1 -0
  65. package/dist/tools/editing/upload.js +27 -0
  66. package/dist/tools/editing/upload.js.map +1 -0
  67. package/dist/tools/index.d.ts +3 -0
  68. package/dist/tools/index.d.ts.map +1 -0
  69. package/dist/tools/index.js +105 -0
  70. package/dist/tools/index.js.map +1 -0
  71. package/dist/tools/ro/expand-templates.d.ts +3 -0
  72. package/dist/tools/ro/expand-templates.d.ts.map +1 -0
  73. package/dist/tools/ro/expand-templates.js +28 -0
  74. package/dist/tools/ro/expand-templates.js.map +1 -0
  75. package/dist/tools/ro/get-all-pages.d.ts +3 -0
  76. package/dist/tools/ro/get-all-pages.d.ts.map +1 -0
  77. package/dist/tools/ro/get-all-pages.js +30 -0
  78. package/dist/tools/ro/get-all-pages.js.map +1 -0
  79. package/dist/tools/ro/get-article-categories.d.ts +3 -0
  80. package/dist/tools/ro/get-article-categories.d.ts.map +1 -0
  81. package/dist/tools/ro/get-article-categories.js +27 -0
  82. package/dist/tools/ro/get-article-categories.js.map +1 -0
  83. package/dist/tools/ro/get-article-info.d.ts +3 -0
  84. package/dist/tools/ro/get-article-info.d.ts.map +1 -0
  85. package/dist/tools/ro/get-article-info.js +35 -0
  86. package/dist/tools/ro/get-article-info.js.map +1 -0
  87. package/dist/tools/ro/get-article-properties.d.ts +3 -0
  88. package/dist/tools/ro/get-article-properties.d.ts.map +1 -0
  89. package/dist/tools/ro/get-article-properties.js +26 -0
  90. package/dist/tools/ro/get-article-properties.js.map +1 -0
  91. package/dist/tools/ro/get-article-revisions.d.ts +3 -0
  92. package/dist/tools/ro/get-article-revisions.d.ts.map +1 -0
  93. package/dist/tools/ro/get-article-revisions.js +29 -0
  94. package/dist/tools/ro/get-article-revisions.js.map +1 -0
  95. package/dist/tools/ro/get-article.d.ts +3 -0
  96. package/dist/tools/ro/get-article.d.ts.map +1 -0
  97. package/dist/tools/ro/get-article.js +54 -0
  98. package/dist/tools/ro/get-article.js.map +1 -0
  99. package/dist/tools/ro/get-backlinks.d.ts +3 -0
  100. package/dist/tools/ro/get-backlinks.d.ts.map +1 -0
  101. package/dist/tools/ro/get-backlinks.js +27 -0
  102. package/dist/tools/ro/get-backlinks.js.map +1 -0
  103. package/dist/tools/ro/get-categories.d.ts +3 -0
  104. package/dist/tools/ro/get-categories.d.ts.map +1 -0
  105. package/dist/tools/ro/get-categories.js +27 -0
  106. package/dist/tools/ro/get-categories.js.map +1 -0
  107. package/dist/tools/ro/get-external-links.d.ts +3 -0
  108. package/dist/tools/ro/get-external-links.d.ts.map +1 -0
  109. package/dist/tools/ro/get-external-links.js +27 -0
  110. package/dist/tools/ro/get-external-links.js.map +1 -0
  111. package/dist/tools/ro/get-image-info.d.ts +3 -0
  112. package/dist/tools/ro/get-image-info.d.ts.map +1 -0
  113. package/dist/tools/ro/get-image-info.js +29 -0
  114. package/dist/tools/ro/get-image-info.js.map +1 -0
  115. package/dist/tools/ro/get-image-usage.d.ts +3 -0
  116. package/dist/tools/ro/get-image-usage.d.ts.map +1 -0
  117. package/dist/tools/ro/get-image-usage.js +27 -0
  118. package/dist/tools/ro/get-image-usage.js.map +1 -0
  119. package/dist/tools/ro/get-images-from-article.d.ts +3 -0
  120. package/dist/tools/ro/get-images-from-article.d.ts.map +1 -0
  121. package/dist/tools/ro/get-images-from-article.js +27 -0
  122. package/dist/tools/ro/get-images-from-article.js.map +1 -0
  123. package/dist/tools/ro/get-images.d.ts +3 -0
  124. package/dist/tools/ro/get-images.d.ts.map +1 -0
  125. package/dist/tools/ro/get-images.js +43 -0
  126. package/dist/tools/ro/get-images.js.map +1 -0
  127. package/dist/tools/ro/get-log.d.ts +3 -0
  128. package/dist/tools/ro/get-log.d.ts.map +1 -0
  129. package/dist/tools/ro/get-log.js +46 -0
  130. package/dist/tools/ro/get-log.js.map +1 -0
  131. package/dist/tools/ro/get-mediawiki-version.d.ts +3 -0
  132. package/dist/tools/ro/get-mediawiki-version.d.ts.map +1 -0
  133. package/dist/tools/ro/get-mediawiki-version.js +20 -0
  134. package/dist/tools/ro/get-mediawiki-version.js.map +1 -0
  135. package/dist/tools/ro/get-pages-by-prefix.d.ts +3 -0
  136. package/dist/tools/ro/get-pages-by-prefix.d.ts.map +1 -0
  137. package/dist/tools/ro/get-pages-by-prefix.js +27 -0
  138. package/dist/tools/ro/get-pages-by-prefix.js.map +1 -0
  139. package/dist/tools/ro/get-pages-in-category.d.ts +3 -0
  140. package/dist/tools/ro/get-pages-in-category.d.ts.map +1 -0
  141. package/dist/tools/ro/get-pages-in-category.js +29 -0
  142. package/dist/tools/ro/get-pages-in-category.js.map +1 -0
  143. package/dist/tools/ro/get-pages-in-namespace.d.ts +3 -0
  144. package/dist/tools/ro/get-pages-in-namespace.d.ts.map +1 -0
  145. package/dist/tools/ro/get-pages-in-namespace.js +27 -0
  146. package/dist/tools/ro/get-pages-in-namespace.js.map +1 -0
  147. package/dist/tools/ro/get-pages-transcluding.d.ts +3 -0
  148. package/dist/tools/ro/get-pages-transcluding.d.ts.map +1 -0
  149. package/dist/tools/ro/get-pages-transcluding.js +32 -0
  150. package/dist/tools/ro/get-pages-transcluding.js.map +1 -0
  151. package/dist/tools/ro/get-query-page.d.ts +3 -0
  152. package/dist/tools/ro/get-query-page.d.ts.map +1 -0
  153. package/dist/tools/ro/get-query-page.js +27 -0
  154. package/dist/tools/ro/get-query-page.js.map +1 -0
  155. package/dist/tools/ro/get-recent-changes.d.ts +3 -0
  156. package/dist/tools/ro/get-recent-changes.d.ts.map +1 -0
  157. package/dist/tools/ro/get-recent-changes.js +43 -0
  158. package/dist/tools/ro/get-recent-changes.js.map +1 -0
  159. package/dist/tools/ro/get-site-info.d.ts +3 -0
  160. package/dist/tools/ro/get-site-info.d.ts.map +1 -0
  161. package/dist/tools/ro/get-site-info.js +23 -0
  162. package/dist/tools/ro/get-site-info.js.map +1 -0
  163. package/dist/tools/ro/get-site-stats.d.ts +3 -0
  164. package/dist/tools/ro/get-site-stats.d.ts.map +1 -0
  165. package/dist/tools/ro/get-site-stats.js +20 -0
  166. package/dist/tools/ro/get-site-stats.js.map +1 -0
  167. package/dist/tools/ro/get-user-contribs.d.ts +3 -0
  168. package/dist/tools/ro/get-user-contribs.d.ts.map +1 -0
  169. package/dist/tools/ro/get-user-contribs.js +39 -0
  170. package/dist/tools/ro/get-user-contribs.js.map +1 -0
  171. package/dist/tools/ro/get-users.d.ts +3 -0
  172. package/dist/tools/ro/get-users.d.ts.map +1 -0
  173. package/dist/tools/ro/get-users.js +29 -0
  174. package/dist/tools/ro/get-users.js.map +1 -0
  175. package/dist/tools/ro/parse.d.ts +3 -0
  176. package/dist/tools/ro/parse.d.ts.map +1 -0
  177. package/dist/tools/ro/parse.js +37 -0
  178. package/dist/tools/ro/parse.js.map +1 -0
  179. package/dist/tools/ro/search.d.ts +3 -0
  180. package/dist/tools/ro/search.d.ts.map +1 -0
  181. package/dist/tools/ro/search.js +32 -0
  182. package/dist/tools/ro/search.js.map +1 -0
  183. package/dist/tools/ro/whoami.d.ts +3 -0
  184. package/dist/tools/ro/whoami.d.ts.map +1 -0
  185. package/dist/tools/ro/whoami.js +20 -0
  186. package/dist/tools/ro/whoami.js.map +1 -0
  187. package/dist/tools/ro/whoare.d.ts +3 -0
  188. package/dist/tools/ro/whoare.d.ts.map +1 -0
  189. package/dist/tools/ro/whoare.js +19 -0
  190. package/dist/tools/ro/whoare.js.map +1 -0
  191. package/dist/tools/ro/whois.d.ts +3 -0
  192. package/dist/tools/ro/whois.d.ts.map +1 -0
  193. package/dist/tools/ro/whois.js +26 -0
  194. package/dist/tools/ro/whois.js.map +1 -0
  195. package/package.json +53 -0
package/LICENSE ADDED
@@ -0,0 +1,166 @@
1
+
2
+ GNU LESSER GENERAL PUBLIC LICENSE
3
+ Version 3, 29 June 2007
4
+
5
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+
10
+ This version of the GNU Lesser General Public License incorporates
11
+ the terms and conditions of version 3 of the GNU General Public
12
+ License, supplemented by the additional permissions listed below.
13
+
14
+ 0. Additional Definitions.
15
+
16
+ As used herein, "this License" refers to version 3 of the GNU Lesser
17
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
18
+ General Public License.
19
+
20
+ "The Library" refers to a covered work governed by this License,
21
+ other than an Application or a Combined Work as defined below.
22
+
23
+ An "Application" is any work that makes use of an interface provided
24
+ by the Library, but which is not otherwise based on the Library.
25
+ Defining a subclass of a class defined by the Library is deemed a mode
26
+ of using an interface provided by the Library.
27
+
28
+ A "Combined Work" is a work produced by combining or linking an
29
+ Application with the Library. The particular version of the Library
30
+ with which the Combined Work was made is also called the "Linked
31
+ Version".
32
+
33
+ The "Minimal Corresponding Source" for a Combined Work means the
34
+ Corresponding Source for the Combined Work, excluding any source code
35
+ for portions of the Combined Work that, considered in isolation, are
36
+ based on the Application, and not on the Linked Version.
37
+
38
+ The "Corresponding Application Code" for a Combined Work means the
39
+ object code and/or source code for the Application, including any data
40
+ and utility programs needed for reproducing the Combined Work from the
41
+ Application, but excluding the System Libraries of the Combined Work.
42
+
43
+ 1. Exception to Section 3 of the GNU GPL.
44
+
45
+ You may convey a covered work under sections 3 and 4 of this License
46
+ without being bound by section 3 of the GNU GPL.
47
+
48
+ 2. Conveying Modified Versions.
49
+
50
+ If you modify a copy of the Library, and, in your modifications, a
51
+ facility refers to a function or data to be supplied by an Application
52
+ that uses the facility (other than as an argument passed when the
53
+ facility is invoked), then you may convey a copy of the modified
54
+ version:
55
+
56
+ a) under this License, provided that you make a good faith effort to
57
+ ensure that, in the event an Application does not supply the
58
+ function or data, the facility still operates, and performs
59
+ whatever part of its purpose remains meaningful, or
60
+
61
+ b) under the GNU GPL, with none of the additional permissions of
62
+ this License applicable to that copy.
63
+
64
+ 3. Object Code Incorporating Material from Library Header Files.
65
+
66
+ The object code form of an Application may incorporate material from
67
+ a header file that is part of the Library. You may convey such object
68
+ code under terms of your choice, provided that, if the incorporated
69
+ material is not limited to numerical parameters, data structure
70
+ layouts and accessors, or small macros, inline functions and templates
71
+ (ten or fewer lines in length), you do both of the following:
72
+
73
+ a) Give prominent notice with each copy of the object code that the
74
+ Library is used in it and that the Library and its use are
75
+ covered by this License.
76
+
77
+ b) Accompany the object code with a copy of the GNU GPL and this license
78
+ document.
79
+
80
+ 4. Combined Works.
81
+
82
+ You may convey a Combined Work under terms of your choice that,
83
+ taken together, effectively do not restrict modification of the
84
+ portions of the Library contained in the Combined Work and reverse
85
+ engineering for debugging such modifications, if you also do each of
86
+ the following:
87
+
88
+ a) Give prominent notice with each copy of the Combined Work that
89
+ the Library is used in it and that the Library and its use are
90
+ covered by this License.
91
+
92
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
93
+ document.
94
+
95
+ c) For a Combined Work that displays copyright notices during
96
+ execution, include the copyright notice for the Library among
97
+ these notices, as well as a reference directing the user to the
98
+ copies of the GNU GPL and this license document.
99
+
100
+ d) Do one of the following:
101
+
102
+ 0) Convey the Minimal Corresponding Source under the terms of this
103
+ License, and the Corresponding Application Code in a form
104
+ suitable for, and under terms that permit, the user to
105
+ recombine or relink the Application with a modified version of
106
+ the Linked Version to produce a modified Combined Work, in the
107
+ manner specified by section 6 of the GNU GPL for conveying
108
+ Corresponding Source.
109
+
110
+ 1) Use a suitable shared library mechanism for linking with the
111
+ Library. A suitable mechanism is one that (a) uses at run time
112
+ a copy of the Library already present on the user's computer
113
+ system, and (b) will operate properly with a modified version
114
+ of the Library that is interface-compatible with the Linked
115
+ Version.
116
+
117
+ e) Provide Installation Information, but only if you would otherwise
118
+ be required to provide such information under section 6 of the
119
+ GNU GPL, and only to the extent that such information is
120
+ necessary to install and execute a modified version of the
121
+ Combined Work produced by recombining or relinking the
122
+ Application with a modified version of the Linked Version. (If
123
+ you use option 4d0, the Installation Information must accompany
124
+ the Minimal Corresponding Source and Corresponding Application
125
+ Code. If you use option 4d1, you must provide the Installation
126
+ Information in the manner specified by section 6 of the GNU GPL
127
+ for conveying Corresponding Source.)
128
+
129
+ 5. Combined Libraries.
130
+
131
+ You may place library facilities that are a work based on the
132
+ Library side by side in a single library together with other library
133
+ facilities that are not Applications and are not covered by this
134
+ License, and convey such a combined library under terms of your
135
+ choice, if you do both of the following:
136
+
137
+ a) Accompany the combined library with a copy of the same work based
138
+ on the Library, uncombined with any other library facilities,
139
+ conveyed under the terms of this License.
140
+
141
+ b) Give prominent notice with the combined library that part of it
142
+ is a work based on the Library, and explaining where to find the
143
+ accompanying uncombined form of the same work.
144
+
145
+ 6. Revised Versions of the GNU Lesser General Public License.
146
+
147
+ The Free Software Foundation may publish revised and/or new versions
148
+ of the GNU Lesser General Public License from time to time. Such new
149
+ versions will be similar in spirit to the present version, but may
150
+ differ in detail to address new problems or concerns.
151
+
152
+ Each version is given a distinguishing version number. If the
153
+ Library as you received it specifies that a certain numbered version
154
+ of the GNU Lesser General Public License "or any later version"
155
+ applies to it, you have the option of following the terms and
156
+ conditions either of that published version or of any later version
157
+ published by the Free Software Foundation. If the Library as you
158
+ received it does not specify a version number of the GNU Lesser
159
+ General Public License, you may choose any version of the GNU Lesser
160
+ General Public License ever published by the Free Software Foundation.
161
+
162
+ If the Library as you received it specifies that a proxy can decide
163
+ whether future versions of the GNU Lesser General Public License shall
164
+ apply, that proxy's public statement of acceptance of any version is
165
+ permanent authorization for you to choose that version for the
166
+ Library.
package/README.md ADDED
@@ -0,0 +1,145 @@
1
+ # Nodemw MCP Server
2
+
3
+ A Model Context Protocol (MCP) server implementation for [nodemw](https://github.com/macbre/nodemw), a Node.js MediaWiki API client.
4
+
5
+ ## Features
6
+
7
+ - **Complete API Coverage**: Exposes all nodemw `Bot` class methods as MCP tools
8
+ - **Resource Management**: Bot configurations are exposed as MCP resources
9
+ - **Automatic Authentication**: Login state is managed internally, no credentials exposed to AI
10
+ - **Type Safety**: Written in TypeScript with full type definitions
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install
16
+ npm run build
17
+ ```
18
+
19
+ ## Single File Build
20
+
21
+ For closed-source distribution, you can build a minified single-file version:
22
+
23
+ ```bash
24
+ # Build standard version (multiple files)
25
+ npm run build
26
+
27
+ # Build single-file bundle (includes dependencies)
28
+ npm run build:bundle
29
+
30
+ # Build standalone single-file version
31
+ npm run build:standalone
32
+
33
+ # Clean build artifacts
34
+ npm run clean
35
+ ```
36
+
37
+ The single-file build outputs to `dist-bundle/index.js` (approx. 1.3MB). This file contains all dependencies bundled together, excluding Node.js built-in modules.
38
+
39
+ Usage with Claude Desktop (single-file version):
40
+ ```json
41
+ {
42
+ "mcpServers": {
43
+ "nodemw": {
44
+ "command": "node",
45
+ "args": ["/path/to/nodemw-mcp/dist-bundle/index.js"],
46
+ "env": {
47
+ "CONFIG": "/path/to/your/config.json"
48
+ }
49
+ }
50
+ }
51
+ }
52
+ ```
53
+
54
+ ## Configuration
55
+
56
+ Create a `config.json` file in the project root (or set `CONFIG` environment variable to point to your config file):
57
+
58
+ ```json
59
+ {
60
+ "defaultBot": "en.wikipedia.org",
61
+ "bots": {
62
+ "en.wikipedia.org": {
63
+ "server": "https://en.wikipedia.org",
64
+ "path": "/w",
65
+ "debug": false,
66
+ "username": null,
67
+ "password": null
68
+ },
69
+ "mywiki": {
70
+ "server": "https://mywiki.example.com",
71
+ "path": "/w",
72
+ "debug": false,
73
+ "username": "myuser",
74
+ "password": "${MY_PASSWORD}" // Environment variable substitution
75
+ }
76
+ }
77
+ }
78
+ ```
79
+
80
+ ## Usage with Claude Desktop
81
+
82
+ Add to your Claude Desktop configuration (`claude_desktop_config.json`):
83
+
84
+ ```json
85
+ {
86
+ "mcpServers": {
87
+ "nodemw": {
88
+ "command": "node",
89
+ "args": ["/path/to/nodemw-mcp/dist/index.js"],
90
+ "env": {
91
+ "CONFIG": "/path/to/your/config.json"
92
+ }
93
+ }
94
+ }
95
+ }
96
+ ```
97
+
98
+ ## Available Tools
99
+
100
+ ### Resource Management
101
+
102
+ - `add-bot`: Add a new bot configuration
103
+ - `remove-bot`: Remove a bot configuration
104
+ - `set-bot`: Switch to a different bot configuration
105
+
106
+ ### Read Operations
107
+
108
+ - `get-article`: Get the content of a wiki page
109
+ - `search`: Search for pages by keyword
110
+ - `get-pages-in-category`: List all pages in a category
111
+
112
+ ### Write Operations (Requires Authentication)
113
+
114
+ - `edit`: Edit a wiki page
115
+ - `append`: Append content to a wiki page
116
+
117
+ ## Testing with MCP Inspector
118
+
119
+ ```bash
120
+ # List all tools
121
+ npx @modelcontextprotocol/inspector --cli node dist/index.js \
122
+ --method tools/list
123
+
124
+ # Get a page
125
+ npx @modelcontextprotocol/inspector --cli node dist/index.js \
126
+ --method tools/call \
127
+ --tool-name get-article \
128
+ --tool-arg 'title=Main Page'
129
+
130
+ # Search
131
+ npx @modelcontextprotocol/inspector --cli node dist/index.js \
132
+ --method tools/call \
133
+ --tool-name search \
134
+ --tool-arg 'keyword=MediaWiki'
135
+
136
+ # Read a resource
137
+ npx @modelcontextprotocol/inspector --cli node dist/index.js \
138
+ --method resources/read \
139
+ --uri 'mcp://bots/en.wikipedia.org'
140
+ ```
141
+
142
+ ## Copyright
143
+ © 2025 Xie Youtian. All rights reserved.
144
+
145
+ Warning: This computer program is protected by copyright law and international treaties. Unauthorized reproduction or distribution of this program, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under the law.
@@ -0,0 +1,21 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,62 @@
1
+ import Bot from 'nodemw';
2
+ import { USER_AGENT } from '../server.js';
3
+ let botInstance = null;
4
+ let serverConfig = null;
5
+ export function initServerConfig(config) {
6
+ serverConfig = config;
7
+ }
8
+ export async function getBot() {
9
+ if (botInstance) {
10
+ return botInstance;
11
+ }
12
+ if (!serverConfig) {
13
+ throw new Error('Server not configured. Use --server to specify the MediaWiki server.');
14
+ }
15
+ const { server, endpoint, protocol, port, proxy, userAgent, concurrency, debug, username, password, token, domain, dryRun } = serverConfig;
16
+ botInstance = new Bot({
17
+ server,
18
+ protocol: protocol || 'https',
19
+ port,
20
+ path: endpoint,
21
+ proxy,
22
+ userAgent: userAgent || USER_AGENT,
23
+ concurrency,
24
+ debug,
25
+ username: username || undefined,
26
+ password: password || undefined,
27
+ domain,
28
+ // @ts-expect-error: dryRun is supported by nodemw at runtime but missing from BotOptions types
29
+ dryRun
30
+ });
31
+ if (username && password) {
32
+ await new Promise((resolve, reject) => {
33
+ botInstance.logIn((err) => {
34
+ if (err) {
35
+ reject(err);
36
+ }
37
+ else {
38
+ resolve();
39
+ }
40
+ });
41
+ });
42
+ }
43
+ return botInstance;
44
+ }
45
+ export function clearBotCache() {
46
+ botInstance = null;
47
+ }
48
+ export function promisifyBotMethod(bot, method, ...args) {
49
+ return new Promise((resolve, reject) => {
50
+ const callback = (err, result) => {
51
+ if (err) {
52
+ reject(err);
53
+ }
54
+ else {
55
+ resolve(result);
56
+ }
57
+ };
58
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
+ bot[method](...args, callback);
60
+ });
61
+ }
62
+ //# sourceMappingURL=nodemwBot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodemwBot.js","sourceRoot":"","sources":["../../src/common/nodemwBot.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAkB1C,IAAI,WAAW,GAAe,IAAI,CAAC;AACnC,IAAI,YAAY,GAAwB,IAAI,CAAC;AAE7C,MAAM,UAAU,gBAAgB,CAAC,MAAoB;IACpD,YAAY,GAAG,MAAM,CAAC;AACvB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM;IAC3B,IAAI,WAAW,EAAE,CAAC;QACjB,OAAO,WAAW,CAAC;IACpB,CAAC;IAED,IAAI,CAAC,YAAY,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;IACzF,CAAC;IAED,MAAM,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,SAAS,EACT,WAAW,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,EACN,MAAM,EACN,GAAG,YAAY,CAAC;IAEjB,WAAW,GAAG,IAAI,GAAG,CAAC;QACrB,MAAM;QACN,QAAQ,EAAE,QAAQ,IAAI,OAAO;QAC7B,IAAI;QACJ,IAAI,EAAE,QAAQ;QACd,KAAK;QACL,SAAS,EAAE,SAAS,IAAI,UAAU;QAClC,WAAW;QACX,KAAK;QACL,QAAQ,EAAE,QAAQ,IAAI,SAAS;QAC/B,QAAQ,EAAE,QAAQ,IAAI,SAAS;QAC/B,MAAM;QACN,+FAA+F;QAC/F,MAAM;KACN,CAAC,CAAC;IAEH,IAAI,QAAQ,IAAI,QAAQ,EAAE,CAAC;QAC1B,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,WAAY,CAAC,KAAK,CAAC,CAAC,GAAiB,EAAE,EAAE;gBACxC,IAAI,GAAG,EAAE,CAAC;oBACT,MAAM,CAAC,GAAG,CAAC,CAAC;gBACb,CAAC;qBAAM,CAAC;oBACP,OAAO,EAAE,CAAC;gBACX,CAAC;YACF,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,WAAW,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,aAAa;IAC5B,WAAW,GAAG,IAAI,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,kBAAkB,CACjC,GAAQ,EACR,MAAc,EACd,GAAG,IAAe;IAElB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,MAAM,QAAQ,GAAG,CAAC,GAAiB,EAAE,MAAS,EAAE,EAAE;YACjD,IAAI,GAAG,EAAE,CAAC;gBACT,MAAM,CAAC,GAAG,CAAC,CAAC;YACb,CAAC;iBAAM,CAAC;gBACP,OAAO,CAAC,MAAM,CAAC,CAAC;YACjB,CAAC;QACF,CAAC,CAAC;QAEF,8DAA8D;QAC7D,GAAW,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import Bot = require('nodemw');
2
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
3
+ export declare function promisifyBotMethod<T>(bot: Bot, method: string, ...args: unknown[]): Promise<T>;
4
+ export declare function isNonNullish<T>(value: T | null | undefined): value is T;
5
+ export declare function jsonResult(data: unknown): CallToolResult;
6
+ export declare function errorResult(message: string, error?: Error): CallToolResult;
7
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,GAAG,QAAQ,QAAQ,CAAC,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE,wBAAgB,kBAAkB,CAAC,CAAC,EACnC,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,GAAG,IAAI,EAAE,OAAO,EAAE,GAChB,OAAO,CAAC,CAAC,CAAC,CAaZ;AAED,wBAAgB,YAAY,CAAC,CAAC,EAC7B,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,GACzB,KAAK,IAAI,CAAC,CAEZ;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,CAOxD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,cAAc,CAW1E"}
@@ -0,0 +1,38 @@
1
+ export function promisifyBotMethod(bot, method, ...args) {
2
+ return new Promise((resolve, reject) => {
3
+ const callback = (err, result) => {
4
+ if (err) {
5
+ reject(err);
6
+ }
7
+ else {
8
+ resolve(result);
9
+ }
10
+ };
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
+ bot[method](...args, callback);
13
+ });
14
+ }
15
+ export function isNonNullish(value) {
16
+ return value !== null && value !== undefined;
17
+ }
18
+ export function jsonResult(data) {
19
+ return {
20
+ content: [{
21
+ type: 'text',
22
+ text: JSON.stringify(data, null, 2)
23
+ }]
24
+ };
25
+ }
26
+ export function errorResult(message, error) {
27
+ return {
28
+ content: [{
29
+ type: 'text',
30
+ text: JSON.stringify({
31
+ error: message,
32
+ details: error?.message
33
+ }, null, 2)
34
+ }],
35
+ isError: true
36
+ };
37
+ }
38
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,kBAAkB,CACjC,GAAQ,EACR,MAAc,EACd,GAAG,IAAe;IAElB,OAAO,IAAI,OAAO,CAAE,CAAE,OAAO,EAAE,MAAM,EAAG,EAAE;QACzC,MAAM,QAAQ,GAAG,CAAE,GAAiB,EAAE,MAAS,EAAG,EAAE;YACnD,IAAK,GAAG,EAAG,CAAC;gBACX,MAAM,CAAE,GAAG,CAAE,CAAC;YACf,CAAC;iBAAM,CAAC;gBACP,OAAO,CAAE,MAAM,CAAE,CAAC;YACnB,CAAC;QACF,CAAC,CAAC;QAEF,8DAA8D;QAC5D,GAAY,CAAE,MAAM,CAAE,CAAE,GAAG,IAAI,EAAE,QAAQ,CAAE,CAAC;IAC/C,CAAC,CAAE,CAAC;AACL,CAAC;AAED,MAAM,UAAU,YAAY,CAC3B,KAA2B;IAE3B,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAa;IACvC,OAAO;QACN,OAAO,EAAE,CAAC;gBACT,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;aACnC,CAAC;KACF,CAAC;AACH,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAe,EAAE,KAAa;IACzD,OAAO;QACN,OAAO,EAAE,CAAC;gBACT,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACpB,KAAK,EAAE,OAAO;oBACd,OAAO,EAAE,KAAK,EAAE,OAAO;iBACvB,EAAE,IAAI,EAAE,CAAC,CAAC;aACX,CAAC;QACF,OAAO,EAAE,IAAI;KACb,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env node
2
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
+ import { parseArgs } from 'util';
4
+ import { createServer } from './server.js';
5
+ import { registerAllTools } from './tools/index.js';
6
+ import { initServerConfig } from './common/nodemwBot.js';
7
+ function parseCliArgs() {
8
+ const { values } = parseArgs({
9
+ options: {
10
+ server: { type: 'string' },
11
+ endpoint: { type: 'string' },
12
+ user: { type: 'string' },
13
+ pass: { type: 'string' },
14
+ token: { type: 'string' },
15
+ 'dry-run': { type: 'boolean' },
16
+ },
17
+ strict: false,
18
+ allowPositionals: true,
19
+ });
20
+ if (!values.server) {
21
+ console.error('Error: --server is required (e.g., --server en.wikipedia.org or --server https://en.wikipedia.org)');
22
+ process.exit(1);
23
+ }
24
+ const serverUrl = values.server;
25
+ let server;
26
+ let protocol;
27
+ let port;
28
+ try {
29
+ if (serverUrl.startsWith('http://') || serverUrl.startsWith('https://')) {
30
+ const url = new URL(serverUrl);
31
+ server = url.hostname;
32
+ protocol = url.protocol.replace(':', '');
33
+ if (url.port) {
34
+ port = parseInt(url.port, 10);
35
+ }
36
+ }
37
+ else {
38
+ server = serverUrl;
39
+ }
40
+ }
41
+ catch {
42
+ server = serverUrl;
43
+ }
44
+ return {
45
+ server,
46
+ protocol,
47
+ port,
48
+ endpoint: values.endpoint ?? '/w',
49
+ username: values.user,
50
+ password: values.pass,
51
+ token: values.token,
52
+ dryRun: values['dry-run'],
53
+ };
54
+ }
55
+ async function main() {
56
+ const config = parseCliArgs();
57
+ initServerConfig(config);
58
+ const server = createServer();
59
+ registerAllTools(server);
60
+ const transport = new StdioServerTransport();
61
+ await server.connect(transport);
62
+ }
63
+ main().catch(console.error);
64
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
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,EAAE;YACxB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACzB,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;SAC9B;QACD,MAAM,EAAE,KAAK;QACb,gBAAgB,EAAE,IAAI;KACtB,CAAC,CAAC;IAEH,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,oGAAoG,CAAC,CAAC;QACpH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,MAAgB,CAAC;IAC1C,IAAI,MAAc,CAAC;IACnB,IAAI,QAA4B,CAAC;IACjC,IAAI,IAAwB,CAAC;IAE7B,IAAI,CAAC;QACJ,IAAI,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;YAC/B,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC;YACtB,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACzC,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;gBACd,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC/B,CAAC;QACF,CAAC;aAAM,CAAC;YACP,MAAM,GAAG,SAAS,CAAC;QACpB,CAAC;IACF,CAAC;IAAC,MAAM,CAAC;QACR,MAAM,GAAG,SAAS,CAAC;IACpB,CAAC;IAED,OAAO;QACN,MAAM;QACN,QAAQ;QACR,IAAI;QACJ,QAAQ,EAAG,MAAM,CAAC,QAAmB,IAAI,IAAI;QAC7C,QAAQ,EAAE,MAAM,CAAC,IAA0B;QAC3C,QAAQ,EAAE,MAAM,CAAC,IAA0B;QAC3C,KAAK,EAAE,MAAM,CAAC,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"}
@@ -0,0 +1,4 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare const USER_AGENT = "nodemw-mcp-server/1.0";
3
+ export declare function createServer(): McpServer;
4
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,eAAO,MAAM,UAAU,0BAA0B,CAAC;AAElD,wBAAgB,YAAY,IAAI,SAAS,CAQxC"}
package/dist/server.js ADDED
@@ -0,0 +1,9 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export const USER_AGENT = 'nodemw-mcp-server/1.0';
3
+ export function createServer() {
4
+ return new McpServer({
5
+ name: 'nodemw-mcp-server',
6
+ version: '1.0.0'
7
+ }, { capabilities: { tools: {} } });
8
+ }
9
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,MAAM,CAAC,MAAM,UAAU,GAAG,uBAAuB,CAAC;AAElD,MAAM,UAAU,YAAY;IAC3B,OAAO,IAAI,SAAS,CACnB;QACC,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,OAAO;KAChB,EACD,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAC/B,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function addFlowTopicTool(server: McpServer): RegisteredTool;
3
+ //# sourceMappingURL=add-flow-topic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-flow-topic.d.ts","sourceRoot":"","sources":["../../../src/tools/editing/add-flow-topic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAKzF,wBAAgB,gBAAgB,CAAE,MAAM,EAAE,SAAS,GAAI,cAAc,CAgBpE"}
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ import { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';
3
+ import { jsonResult, errorResult } from '../../common/utils.js';
4
+ export function addFlowTopicTool(server) {
5
+ return server.tool('add-flow-topic', 'Add a new Flow topic to a wiki page (requires authentication)', {
6
+ title: z.string().describe('Page title to add topic to'),
7
+ subject: z.string().describe('Topic subject'),
8
+ content: z.string().describe('Topic content in wikitext'),
9
+ }, {
10
+ title: 'Add Flow topic',
11
+ readOnlyHint: false,
12
+ destructiveHint: false
13
+ }, async (params) => handleAddFlowTopicTool(params));
14
+ }
15
+ async function handleAddFlowTopicTool(params) {
16
+ try {
17
+ const bot = await getBot();
18
+ const result = await promisifyBotMethod(bot, 'addFlowTopic', params.title, params.subject, params.content);
19
+ return jsonResult(result);
20
+ }
21
+ catch (error) {
22
+ return errorResult('Failed to add Flow topic', error);
23
+ }
24
+ }
25
+ //# sourceMappingURL=add-flow-topic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-flow-topic.js","sourceRoot":"","sources":["../../../src/tools/editing/add-flow-topic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,UAAU,gBAAgB,CAAE,MAAiB;IAClD,OAAO,MAAM,CAAC,IAAI,CACjB,gBAAgB,EAChB,+DAA+D,EAC/D;QACC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAE,4BAA4B,CAAE;QAC1D,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAE,eAAe,CAAE;QAC/C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAE,2BAA2B,CAAE;KAC3D,EACD;QACC,KAAK,EAAE,gBAAgB;QACvB,YAAY,EAAE,KAAK;QACnB,eAAe,EAAE,KAAK;KACH,EACpB,KAAK,EAAG,MAAM,EAAG,EAAE,CAAC,sBAAsB,CAAE,MAAM,CAAE,CACpD,CAAC;AACH,CAAC;AAED,KAAK,UAAU,sBAAsB,CACpC,MAIC;IAED,IAAI,CAAC;QACJ,MAAM,GAAG,GAAG,MAAM,MAAM,EAAE,CAAC;QAE3B,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAMtC,GAAG,EACH,cAAc,EACd,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,OAAO,CACd,CAAC;QAEF,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAAC,OAAQ,KAAK,EAAG,CAAC;QAClB,OAAO,WAAW,CAAC,0BAA0B,EAAE,KAAc,CAAC,CAAC;IAChE,CAAC;AACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function appendTool(server: McpServer): RegisteredTool;
3
+ //# sourceMappingURL=append.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"append.d.ts","sourceRoot":"","sources":["../../../src/tools/editing/append.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAKzF,wBAAgB,UAAU,CAAE,MAAM,EAAE,SAAS,GAAI,cAAc,CAgB9D"}
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ import { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';
3
+ import { jsonResult, errorResult } from '../../common/utils.js';
4
+ export function appendTool(server) {
5
+ return server.tool('append', 'Append content to a wiki page (requires authentication)', {
6
+ title: z.string().describe('Page title'),
7
+ content: z.string().describe('Content to append'),
8
+ summary: z.string().describe('Edit summary')
9
+ }, {
10
+ title: 'Append to page',
11
+ readOnlyHint: false,
12
+ destructiveHint: true
13
+ }, async (params) => handleAppendTool(params));
14
+ }
15
+ async function handleAppendTool(params) {
16
+ try {
17
+ const bot = await getBot();
18
+ const prefixedSummary = `[nodemw-mcp] ${params.summary}`;
19
+ await promisifyBotMethod(bot, 'append', params.title, params.content, prefixedSummary);
20
+ return jsonResult({ success: true, title: params.title });
21
+ }
22
+ catch (error) {
23
+ return errorResult('Failed to append to page', error);
24
+ }
25
+ }
26
+ //# sourceMappingURL=append.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"append.js","sourceRoot":"","sources":["../../../src/tools/editing/append.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,UAAU,UAAU,CAAE,MAAiB;IAC5C,OAAO,MAAM,CAAC,IAAI,CACjB,QAAQ,EACR,yDAAyD,EACzD;QACC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAE,YAAY,CAAE;QAC1C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAE,mBAAmB,CAAE;QACnD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAE,cAAc,CAAE;KAC9C,EACD;QACC,KAAK,EAAE,gBAAgB;QACvB,YAAY,EAAE,KAAK;QACnB,eAAe,EAAE,IAAI;KACF,EACpB,KAAK,EAAG,MAAM,EAAG,EAAE,CAAC,gBAAgB,CAAE,MAAM,CAAE,CAC9C,CAAC;AACH,CAAC;AAED,KAAK,UAAU,gBAAgB,CAC9B,MAIC;IAED,IAAI,CAAC;QACJ,MAAM,GAAG,GAAG,MAAM,MAAM,EAAE,CAAC;QAC3B,MAAM,eAAe,GAAG,gBAAgB,MAAM,CAAC,OAAO,EAAE,CAAC;QAEzD,MAAM,kBAAkB,CACvB,GAAG,EACH,QAAQ,EACR,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,OAAO,EACd,eAAe,CACf,CAAC;QAEF,OAAO,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IAC3D,CAAC;IAAC,OAAQ,KAAK,EAAG,CAAC;QAClB,OAAO,WAAW,CAAC,0BAA0B,EAAE,KAAc,CAAC,CAAC;IAChE,CAAC;AACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function createAccountTool(server: McpServer): RegisteredTool;
3
+ //# sourceMappingURL=create-account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-account.d.ts","sourceRoot":"","sources":["../../../src/tools/editing/create-account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAKzF,wBAAgB,iBAAiB,CAAE,MAAM,EAAE,SAAS,GAAI,cAAc,CAerE"}