@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.
- package/LICENSE +24 -166
- package/README.md +124 -145
- package/dist/index.js +36 -63
- package/dist/index.js.map +7 -1
- package/package.json +5 -11
- package/dist/common/nodemwBot.d.ts +0 -21
- package/dist/common/nodemwBot.d.ts.map +0 -1
- package/dist/common/nodemwBot.js +0 -62
- package/dist/common/nodemwBot.js.map +0 -1
- package/dist/common/utils.d.ts +0 -7
- package/dist/common/utils.d.ts.map +0 -1
- package/dist/common/utils.js +0 -38
- package/dist/common/utils.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/server.d.ts +0 -4
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js +0 -9
- package/dist/server.js.map +0 -1
- package/dist/tools/editing/add-flow-topic.d.ts +0 -3
- package/dist/tools/editing/add-flow-topic.d.ts.map +0 -1
- package/dist/tools/editing/add-flow-topic.js +0 -25
- package/dist/tools/editing/add-flow-topic.js.map +0 -1
- package/dist/tools/editing/append.d.ts +0 -3
- package/dist/tools/editing/append.d.ts.map +0 -1
- package/dist/tools/editing/append.js +0 -26
- package/dist/tools/editing/append.js.map +0 -1
- package/dist/tools/editing/create-account.d.ts +0 -3
- package/dist/tools/editing/create-account.d.ts.map +0 -1
- package/dist/tools/editing/create-account.js +0 -24
- package/dist/tools/editing/create-account.js.map +0 -1
- package/dist/tools/editing/delete.d.ts +0 -3
- package/dist/tools/editing/delete.d.ts.map +0 -1
- package/dist/tools/editing/delete.js +0 -25
- package/dist/tools/editing/delete.js.map +0 -1
- package/dist/tools/editing/edit.d.ts +0 -3
- package/dist/tools/editing/edit.d.ts.map +0 -1
- package/dist/tools/editing/edit.js +0 -27
- package/dist/tools/editing/edit.js.map +0 -1
- package/dist/tools/editing/move.d.ts +0 -3
- package/dist/tools/editing/move.d.ts.map +0 -1
- package/dist/tools/editing/move.js +0 -26
- package/dist/tools/editing/move.js.map +0 -1
- package/dist/tools/editing/prepend.d.ts +0 -3
- package/dist/tools/editing/prepend.d.ts.map +0 -1
- package/dist/tools/editing/prepend.js +0 -26
- package/dist/tools/editing/prepend.js.map +0 -1
- package/dist/tools/editing/protect.d.ts +0 -3
- package/dist/tools/editing/protect.d.ts.map +0 -1
- package/dist/tools/editing/protect.js +0 -37
- package/dist/tools/editing/protect.js.map +0 -1
- package/dist/tools/editing/purge.d.ts +0 -3
- package/dist/tools/editing/purge.d.ts.map +0 -1
- package/dist/tools/editing/purge.js +0 -23
- package/dist/tools/editing/purge.js.map +0 -1
- package/dist/tools/editing/send-email.d.ts +0 -3
- package/dist/tools/editing/send-email.d.ts.map +0 -1
- package/dist/tools/editing/send-email.js +0 -25
- package/dist/tools/editing/send-email.js.map +0 -1
- package/dist/tools/editing/upload-by-url.d.ts +0 -3
- package/dist/tools/editing/upload-by-url.d.ts.map +0 -1
- package/dist/tools/editing/upload-by-url.js +0 -26
- package/dist/tools/editing/upload-by-url.js.map +0 -1
- package/dist/tools/editing/upload.d.ts +0 -3
- package/dist/tools/editing/upload.d.ts.map +0 -1
- package/dist/tools/editing/upload.js +0 -27
- package/dist/tools/editing/upload.js.map +0 -1
- package/dist/tools/index.d.ts +0 -3
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -105
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/ro/expand-templates.d.ts +0 -3
- package/dist/tools/ro/expand-templates.d.ts.map +0 -1
- package/dist/tools/ro/expand-templates.js +0 -28
- package/dist/tools/ro/expand-templates.js.map +0 -1
- package/dist/tools/ro/get-all-pages.d.ts +0 -3
- package/dist/tools/ro/get-all-pages.d.ts.map +0 -1
- package/dist/tools/ro/get-all-pages.js +0 -30
- package/dist/tools/ro/get-all-pages.js.map +0 -1
- package/dist/tools/ro/get-article-categories.d.ts +0 -3
- package/dist/tools/ro/get-article-categories.d.ts.map +0 -1
- package/dist/tools/ro/get-article-categories.js +0 -27
- package/dist/tools/ro/get-article-categories.js.map +0 -1
- package/dist/tools/ro/get-article-info.d.ts +0 -3
- package/dist/tools/ro/get-article-info.d.ts.map +0 -1
- package/dist/tools/ro/get-article-info.js +0 -35
- package/dist/tools/ro/get-article-info.js.map +0 -1
- package/dist/tools/ro/get-article-properties.d.ts +0 -3
- package/dist/tools/ro/get-article-properties.d.ts.map +0 -1
- package/dist/tools/ro/get-article-properties.js +0 -26
- package/dist/tools/ro/get-article-properties.js.map +0 -1
- package/dist/tools/ro/get-article-revisions.d.ts +0 -3
- package/dist/tools/ro/get-article-revisions.d.ts.map +0 -1
- package/dist/tools/ro/get-article-revisions.js +0 -29
- package/dist/tools/ro/get-article-revisions.js.map +0 -1
- package/dist/tools/ro/get-article.d.ts +0 -3
- package/dist/tools/ro/get-article.d.ts.map +0 -1
- package/dist/tools/ro/get-article.js +0 -54
- package/dist/tools/ro/get-article.js.map +0 -1
- package/dist/tools/ro/get-backlinks.d.ts +0 -3
- package/dist/tools/ro/get-backlinks.d.ts.map +0 -1
- package/dist/tools/ro/get-backlinks.js +0 -27
- package/dist/tools/ro/get-backlinks.js.map +0 -1
- package/dist/tools/ro/get-categories.d.ts +0 -3
- package/dist/tools/ro/get-categories.d.ts.map +0 -1
- package/dist/tools/ro/get-categories.js +0 -27
- package/dist/tools/ro/get-categories.js.map +0 -1
- package/dist/tools/ro/get-external-links.d.ts +0 -3
- package/dist/tools/ro/get-external-links.d.ts.map +0 -1
- package/dist/tools/ro/get-external-links.js +0 -27
- package/dist/tools/ro/get-external-links.js.map +0 -1
- package/dist/tools/ro/get-image-info.d.ts +0 -3
- package/dist/tools/ro/get-image-info.d.ts.map +0 -1
- package/dist/tools/ro/get-image-info.js +0 -29
- package/dist/tools/ro/get-image-info.js.map +0 -1
- package/dist/tools/ro/get-image-usage.d.ts +0 -3
- package/dist/tools/ro/get-image-usage.d.ts.map +0 -1
- package/dist/tools/ro/get-image-usage.js +0 -27
- package/dist/tools/ro/get-image-usage.js.map +0 -1
- package/dist/tools/ro/get-images-from-article.d.ts +0 -3
- package/dist/tools/ro/get-images-from-article.d.ts.map +0 -1
- package/dist/tools/ro/get-images-from-article.js +0 -27
- package/dist/tools/ro/get-images-from-article.js.map +0 -1
- package/dist/tools/ro/get-images.d.ts +0 -3
- package/dist/tools/ro/get-images.d.ts.map +0 -1
- package/dist/tools/ro/get-images.js +0 -43
- package/dist/tools/ro/get-images.js.map +0 -1
- package/dist/tools/ro/get-log.d.ts +0 -3
- package/dist/tools/ro/get-log.d.ts.map +0 -1
- package/dist/tools/ro/get-log.js +0 -46
- package/dist/tools/ro/get-log.js.map +0 -1
- package/dist/tools/ro/get-mediawiki-version.d.ts +0 -3
- package/dist/tools/ro/get-mediawiki-version.d.ts.map +0 -1
- package/dist/tools/ro/get-mediawiki-version.js +0 -20
- package/dist/tools/ro/get-mediawiki-version.js.map +0 -1
- package/dist/tools/ro/get-pages-by-prefix.d.ts +0 -3
- package/dist/tools/ro/get-pages-by-prefix.d.ts.map +0 -1
- package/dist/tools/ro/get-pages-by-prefix.js +0 -27
- package/dist/tools/ro/get-pages-by-prefix.js.map +0 -1
- package/dist/tools/ro/get-pages-in-category.d.ts +0 -3
- package/dist/tools/ro/get-pages-in-category.d.ts.map +0 -1
- package/dist/tools/ro/get-pages-in-category.js +0 -29
- package/dist/tools/ro/get-pages-in-category.js.map +0 -1
- package/dist/tools/ro/get-pages-in-namespace.d.ts +0 -3
- package/dist/tools/ro/get-pages-in-namespace.d.ts.map +0 -1
- package/dist/tools/ro/get-pages-in-namespace.js +0 -27
- package/dist/tools/ro/get-pages-in-namespace.js.map +0 -1
- package/dist/tools/ro/get-pages-transcluding.d.ts +0 -3
- package/dist/tools/ro/get-pages-transcluding.d.ts.map +0 -1
- package/dist/tools/ro/get-pages-transcluding.js +0 -32
- package/dist/tools/ro/get-pages-transcluding.js.map +0 -1
- package/dist/tools/ro/get-query-page.d.ts +0 -3
- package/dist/tools/ro/get-query-page.d.ts.map +0 -1
- package/dist/tools/ro/get-query-page.js +0 -27
- package/dist/tools/ro/get-query-page.js.map +0 -1
- package/dist/tools/ro/get-recent-changes.d.ts +0 -3
- package/dist/tools/ro/get-recent-changes.d.ts.map +0 -1
- package/dist/tools/ro/get-recent-changes.js +0 -43
- package/dist/tools/ro/get-recent-changes.js.map +0 -1
- package/dist/tools/ro/get-site-info.d.ts +0 -3
- package/dist/tools/ro/get-site-info.d.ts.map +0 -1
- package/dist/tools/ro/get-site-info.js +0 -23
- package/dist/tools/ro/get-site-info.js.map +0 -1
- package/dist/tools/ro/get-site-stats.d.ts +0 -3
- package/dist/tools/ro/get-site-stats.d.ts.map +0 -1
- package/dist/tools/ro/get-site-stats.js +0 -20
- package/dist/tools/ro/get-site-stats.js.map +0 -1
- package/dist/tools/ro/get-user-contribs.d.ts +0 -3
- package/dist/tools/ro/get-user-contribs.d.ts.map +0 -1
- package/dist/tools/ro/get-user-contribs.js +0 -39
- package/dist/tools/ro/get-user-contribs.js.map +0 -1
- package/dist/tools/ro/get-users.d.ts +0 -3
- package/dist/tools/ro/get-users.d.ts.map +0 -1
- package/dist/tools/ro/get-users.js +0 -29
- package/dist/tools/ro/get-users.js.map +0 -1
- package/dist/tools/ro/parse.d.ts +0 -3
- package/dist/tools/ro/parse.d.ts.map +0 -1
- package/dist/tools/ro/parse.js +0 -37
- package/dist/tools/ro/parse.js.map +0 -1
- package/dist/tools/ro/search.d.ts +0 -3
- package/dist/tools/ro/search.d.ts.map +0 -1
- package/dist/tools/ro/search.js +0 -32
- package/dist/tools/ro/search.js.map +0 -1
- package/dist/tools/ro/whoami.d.ts +0 -3
- package/dist/tools/ro/whoami.d.ts.map +0 -1
- package/dist/tools/ro/whoami.js +0 -20
- package/dist/tools/ro/whoami.js.map +0 -1
- package/dist/tools/ro/whoare.d.ts +0 -3
- package/dist/tools/ro/whoare.d.ts.map +0 -1
- package/dist/tools/ro/whoare.js +0 -19
- package/dist/tools/ro/whoare.js.map +0 -1
- package/dist/tools/ro/whois.d.ts +0 -3
- package/dist/tools/ro/whois.d.ts.map +0 -1
- package/dist/tools/ro/whois.js +0 -26
- package/dist/tools/ro/whois.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,166 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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.
|
|
1
|
+
BSD 2-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Xie Youtian
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
16
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
17
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
19
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
20
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
21
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
22
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
23
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
24
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -1,145 +1,124 @@
|
|
|
1
|
-
# Nodemw MCP Server
|
|
2
|
-
|
|
3
|
-
A Model Context Protocol (MCP) server
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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.
|
|
1
|
+
# Nodemw MCP Server
|
|
2
|
+
|
|
3
|
+
A [Model Context Protocol (MCP)](https://modelcontextprotocol.org) server for [nodemw](https://github.com/macbre/nodemw), the Node.js MediaWiki API client.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install
|
|
9
|
+
npm install
|
|
10
|
+
npm run build
|
|
11
|
+
|
|
12
|
+
# Connect as guest
|
|
13
|
+
node dist/index.js zh.minecraft.wiki
|
|
14
|
+
|
|
15
|
+
# Connect with credentials
|
|
16
|
+
node dist/index.js -u myuser -p mypass mywiki.example.com
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## CLI Usage
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
nodemw-mcp-server [options] [server]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Arguments**:
|
|
26
|
+
|
|
27
|
+
| Option | Short | Description |
|
|
28
|
+
|--------|-------|-------------|
|
|
29
|
+
| `[server]` | (positional) | Target MediaWiki server, e.g. `en.wikipedia.org` |
|
|
30
|
+
| `--server` | `-s` | Same as positional, explicit form |
|
|
31
|
+
| `--path` | | API script path (default: auto-detect; tries `/w` then root) |
|
|
32
|
+
| `--user` | `-u` | Login username |
|
|
33
|
+
| `--pass` | `-p` | Login password |
|
|
34
|
+
| `--dry-run` | | Dry-run mode (no actual edits) |
|
|
35
|
+
|
|
36
|
+
**Examples**:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Guest access, auto-detect API path
|
|
40
|
+
nodemw-mcp-server zh.minecraft.wiki
|
|
41
|
+
|
|
42
|
+
# Authenticated, explicit API path
|
|
43
|
+
nodemw-mcp-server -u editor -p secret --path /w mywiki.example.com
|
|
44
|
+
|
|
45
|
+
# With full URL
|
|
46
|
+
nodemw-mcp-server -s https://en.wikipedia.org
|
|
47
|
+
|
|
48
|
+
# Dry-run mode for safe testing
|
|
49
|
+
nodemw-mcp-server --dry-run -u editor -p secret mywiki.example.com
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Environment Variables
|
|
53
|
+
|
|
54
|
+
All settings can be configured via environment variables. CLI arguments take precedence.
|
|
55
|
+
|
|
56
|
+
| Variable | Equivalent |
|
|
57
|
+
|----------|------------|
|
|
58
|
+
| `NODEMW_MCP_SERVER` | `--server` / positional |
|
|
59
|
+
| `NODEMW_MCP_ENDPOINT_PATH` | `--path` |
|
|
60
|
+
| `NODEMW_MCP_MW_USER` | `--user` / `-u` |
|
|
61
|
+
| `NODEMW_MCP_MW_PASS` | `--pass` / `-p` |
|
|
62
|
+
|
|
63
|
+
## Usage with config files
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"mcpServers": {
|
|
68
|
+
"nodemw": {
|
|
69
|
+
"command": "npx",
|
|
70
|
+
"args": ["@xiedada/nodemw-mcp-server"],
|
|
71
|
+
"env": {
|
|
72
|
+
"NODEMW_MCP_SERVER": "mywiki.example.com",
|
|
73
|
+
"NODEMW_MCP_MW_USER": "editor",
|
|
74
|
+
"NODEMW_MCP_MW_PASS": "secret"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Available Tools
|
|
82
|
+
|
|
83
|
+
### Read Operations (29 tools)
|
|
84
|
+
|
|
85
|
+
`get-article`, `search`, `get-pages-in-category`, `get-categories`, `get-users`, `get-all-pages`, `get-pages-in-namespace`, `get-pages-by-prefix`, `get-pages-transcluding`, `get-article-revisions`, `get-article-categories`, `get-article-properties`, `get-article-info`, `get-user-contribs`, `whoami`, `whois`, `whoare`, `get-images`, `get-images-from-article`, `get-image-usage`, `get-image-info`, `get-log`, `expand-templates`, `parse`, `get-recent-changes`, `get-site-info`, `get-site-stats`, `get-mediawiki-version`, `get-external-links`, `get-backlinks`, `get-query-page`
|
|
86
|
+
|
|
87
|
+
### Write Operations (12 tools, require authentication)
|
|
88
|
+
|
|
89
|
+
`edit`, `append`, `prepend`, `move`, `delete`, `protect`, `purge`, `send-email`, `upload`, `upload-by-url`, `add-flow-topic`, `create-account`
|
|
90
|
+
|
|
91
|
+
## Development
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npm run build # Build dist/index.js
|
|
95
|
+
npm run dev # Watch mode
|
|
96
|
+
npm run clean # Remove dist/
|
|
97
|
+
npm test # Run tests
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
Copyright (c) 2026 Xie Youtian
|
|
103
|
+
|
|
104
|
+
Redistribution and use in source and binary forms, with or without
|
|
105
|
+
modification, are permitted provided that the following conditions are met:
|
|
106
|
+
|
|
107
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
108
|
+
list of conditions and the following disclaimer.
|
|
109
|
+
|
|
110
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
111
|
+
this list of conditions and the following disclaimer in the documentation
|
|
112
|
+
and/or other materials provided with the distribution.
|
|
113
|
+
|
|
114
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
115
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
116
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
117
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
118
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
119
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
120
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
121
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
122
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
123
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
124
|
+
|
package/dist/index.js
CHANGED
|
@@ -1,64 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
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
|
|
2
|
+
/*
|
|
3
|
+
* SPDX-License-Identifier: BSD-2-Clause
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2026 Xie Youtian
|
|
6
|
+
*
|
|
7
|
+
* Redistribution and use in source and binary forms, with or without
|
|
8
|
+
* modification, are permitted provided that the following conditions are met:
|
|
9
|
+
*
|
|
10
|
+
* 1. Redistributions of source code must retain the above copyright notice,
|
|
11
|
+
* this list of conditions and the following disclaimer.
|
|
12
|
+
*
|
|
13
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
14
|
+
* this list of conditions and the following disclaimer in the documentation
|
|
15
|
+
* and/or other materials provided with the distribution.
|
|
16
|
+
*
|
|
17
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
18
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
19
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
20
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
21
|
+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
22
|
+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
23
|
+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
24
|
+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
25
|
+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
26
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
27
|
+
* POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
+
*/
|
|
29
|
+
import{StdioServerTransport as Ye}from"@modelcontextprotocol/sdk/server/stdio.js";import{parseArgs as Je}from"util";import{McpServer as $t}from"@modelcontextprotocol/sdk/server/mcp.js";var F="nodemw-mcp-server/1.0";function O(t){let e;return t?e=`Connected to ${t.sitename} (${t.base}). Running ${t.generator}. When connecting for the first time, call the get-site-info tool for full site details.`:e="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.",new $t({name:"nodemw-mcp-server",version:"1.0.0",description:e},{capabilities:{tools:{}}})}import{z as v}from"zod";import Dt from"nodemw";var T=null,qt=null;function U(t){qt=t}function z(t){let{server:e,path:o,protocol:s,port:a,proxy:c,userAgent:m,concurrency:p,debug:u,username:g,password:y,domain:R,dryRun:x}=t;return new Dt({server:e,protocol:s||"https",port:a,path:o,proxy:c,userAgent:m||F,concurrency:p,debug:u,username:g||void 0,password:y||void 0,domain:R,dryRun:x})}async function _t(t){try{return await n(t,"getSiteInfo",["general"]),!0}catch{return!1}}async function W(t){let e=["/w",""];for(let o of e){let s={...t,path:o},a=z(s);if(await _t(a))return o}throw new Error('Could not auto-detect MediaWiki API path. Tried /w/api.php and /api.php. Please specify --path explicitly (e.g., --path /w or --path "" for root).')}async function N(t){T=z(t);let{username:e,password:o}=t;return e&&o&&await new Promise((s,a)=>{T.logIn(c=>{c?a(new Error(`Login failed for user '${e}': ${c.message}`)):s()})}),T}function r(){if(!T)throw new Error("Bot not initialized. Server must be started first.");return T}function n(t,e,...o){return new Promise((s,a)=>{let c=(m,p)=>{m?a(m):s(p)};t[e](...o,c)})}function L(t){return t.tool("get-article","Retrieve the content of a wiki article",{title:v.string().describe("Article title"),followRedirect:v.boolean().optional().default(!0).describe("Follow redirects"),redirectInfo:v.boolean().optional().default(!1).describe("Include information about redirects")},{title:"Get article",readOnlyHint:!0,destructiveHint:!1},async({title:e,followRedirect:o,redirectInfo:s})=>Qt(e,o,s))}async function Qt(t,e,o){try{let s=await r();if(o){let a=await new Promise((u,g)=>{let y=(R,x,Lt)=>{R?g(R):u([x,Lt])};s.getArticle(t,e,y)}),[c,m]=a;return{content:[{type:"text",text:m?`Content:
|
|
30
|
+
|
|
31
|
+
${c}
|
|
32
|
+
|
|
33
|
+
Redirect Information:
|
|
34
|
+
|
|
35
|
+
${JSON.stringify(m,null,2)}`:c}]}}else return{content:[{type:"text",text:await n(s,"getArticle",t,e)}]}}catch(s){return{content:[{type:"text",text:`Error: ${s.message}`}],isError:!0}}}import{z as $}from"zod";function l(t){return{content:[{type:"text",text:JSON.stringify(t,null,2)}]}}function i(t,e){return{content:[{type:"text",text:JSON.stringify({error:t,details:e?.message},null,2)}],isError:!0}}function D(t){return t.tool("search","Search for wiki pages by keyword",{keyword:$.string().describe("Search keyword"),limit:$.number().optional().default(10).describe("Maximum number of results")},{title:"Search",readOnlyHint:!0,destructiveHint:!1},async({keyword:e,limit:o})=>Vt(e,o))}async function Vt(t,e){try{let o=await r(),s=await n(o,"search",t),a=s.slice(0,e);return l({total:s.length,limit:e,keyword:t,results:a})}catch(o){return i("Failed to search",o)}}import{z as Yt}from"zod";function q(t){return t.tool("get-pages-in-category","Get all pages in a category",{category:Yt.string().describe("Category name (with or without Category: prefix)")},{title:"Get pages in category",readOnlyHint:!0,destructiveHint:!1},async({category:e})=>Jt(e))}async function Jt(t){try{let e=await r(),o=t.replace(/^Category:/i,""),s=await n(e,"getPagesInCategory",o);return l({category:o,pages:s,count:s.length})}catch(e){return i("Failed to get pages in category",e)}}import{z as Xt}from"zod";function _(t){return t.tool("get-categories","Get all categories matching a prefix",{prefix:Xt.string().optional().default("").describe("Prefix to filter categories")},{title:"Get categories",readOnlyHint:!0,destructiveHint:!1},async({prefix:e})=>Kt(e))}async function Kt(t){try{let e=await r(),o=await n(e,"getCategories",t);return l({prefix:t,categories:o,count:o.length})}catch(e){return i("Failed to get categories",e)}}import{z as Q}from"zod";function V(t){return t.tool("get-users","Get all users matching a prefix",{prefix:Q.string().optional().default("").describe("Prefix to filter usernames"),onlyWithEdits:Q.boolean().optional().default(!1).describe("Only include users with at least one edit")},{title:"Get users",readOnlyHint:!0,destructiveHint:!1},async({prefix:e,onlyWithEdits:o})=>Zt(e,o))}async function Zt(t,e){try{let o=await r(),s=await n(o,"getUsers",{prefix:t,witheditsonly:e});return l({prefix:t,onlyWithEdits:e,users:s,count:s.length})}catch(o){return i("Failed to get users",o)}}import{z as te}from"zod";function Y(t){return t.tool("get-all-pages","Get all non-redirect pages from the wiki",{limit:te.number().optional().default(500).describe("Maximum number of pages to return")},{title:"Get all pages",readOnlyHint:!0,destructiveHint:!1},async({limit:e})=>ee(e))}async function ee(t){try{let e=await r(),o=await n(e,"getAllPages"),s=o.slice(0,t);return l({total:o.length,displayed:s.length,pages:s,limit:t})}catch(e){return i("Failed to get all pages",e)}}import{z as oe}from"zod";function J(t){return t.tool("get-pages-in-namespace","Get all non-redirect pages in a specific namespace",{namespace:oe.number().describe("Namespace number to filter pages")},{title:"Get pages in namespace",readOnlyHint:!0,destructiveHint:!1},async({namespace:e})=>re(e))}async function re(t){try{let e=await r(),o=await n(e,"getPagesInNamespace",t);return l({namespace:t,pages:o,count:o.length})}catch(e){return i("Failed to get pages in namespace",e)}}import{z as ne}from"zod";function X(t){return t.tool("get-pages-by-prefix","Get pages starting with a specific prefix",{prefix:ne.string().describe("Prefix to match page titles")},{title:"Get pages by prefix",readOnlyHint:!0,destructiveHint:!1},async({prefix:e})=>se(e))}async function se(t){try{let e=await r(),o=await n(e,"getPagesByPrefix",t);return l({prefix:t,pages:o,count:o.length})}catch(e){return i("Failed to get pages by prefix",e)}}import{z as ie}from"zod";function K(t){return t.tool("get-pages-transcluding","Get all pages that transclude (include) a specific template",{template:ie.string().describe("Template title to find transclusions")},{title:"Get pages transcluding template",readOnlyHint:!0,destructiveHint:!1},async({template:e})=>le(e))}async function le(t){try{let e=await r(),s=(await n(e,"getPagesTranscluding",t))[1],a=Array.isArray(s)?s.filter(c=>c!=null&&typeof c=="object"&&"title"in c):[];return l({template:t,pages:a,count:a.length})}catch(e){return i("Failed to get pages transcluding template",e)}}import{z as w}from"zod";function Z(t){return t.tool("get-article-revisions","Get all revisions of a wiki article",{title:w.union([w.string(),w.number()]).describe("Article title or page ID")},{title:"Get article revisions",readOnlyHint:!0,destructiveHint:!1},async({title:e})=>ae(e))}async function ae(t){try{let e=await r(),s=(await n(e,"getArticleRevisions",t)).flat();return l({title:t,revisions:s,count:s.length})}catch(e){return i("Failed to get article revisions",e)}}import{z as k}from"zod";function tt(t){return t.tool("get-article-categories","Get all categories that an article belongs to",{title:k.union([k.string(),k.number()]).describe("Article title or page ID")},{title:"Get article categories",readOnlyHint:!0,destructiveHint:!1},async({title:e})=>ce(e))}async function ce(t){try{let e=await r(),o=await n(e,"getArticleCategories",t);return l({title:t,categories:o,count:o.length})}catch(e){return i("Failed to get article categories",e)}}import{z as me}from"zod";function et(t){return t.tool("get-article-properties","Get page properties for a wiki article",{title:me.string().describe("Article title")},{title:"Get article properties",readOnlyHint:!0,destructiveHint:!1},async({title:e})=>pe(e))}async function pe(t){try{let e=await r(),o=await n(e,"getArticleProperties",t);return l({title:t,properties:o})}catch(e){return i("Failed to get article properties",e)}}import{z as d}from"zod";function ot(t){return t.tool("get-article-info","Get detailed information about one or more articles",{title:d.union([d.string(),d.number(),d.array(d.union([d.string(),d.number()]))]).describe("Article title, page ID, or array of titles/IDs"),properties:d.array(d.string()).optional().describe("Specific properties to retrieve")},{title:"Get article info",readOnlyHint:!0,destructiveHint:!1},async({title:e,properties:o})=>ue(e,o))}async function ue(t,e){try{let o=await r(),a=await n(o,"getArticleInfo",t,e?{inprop:e}:{}),c=Array.isArray(a)?a:[a];return l({title:t,results:c,count:c.length})}catch(o){return i("Failed to get article info",o)}}import{z as M}from"zod";function rt(t){return t.tool("get-user-contribs","Get contributions made by a specific user",{username:M.string().describe("Username to get contributions for"),namespace:M.number().optional().describe("Filter contributions by namespace"),limit:M.number().optional().default(50).describe("Maximum number of contributions to return")},{title:"Get user contributions",readOnlyHint:!0,destructiveHint:!1},async({username:e,namespace:o,limit:s})=>ge(e,o,s))}async function ge(t,e,o=50){try{let s=await r(),a={user:t,...e!==void 0&&{namespace:e}},c=await n(s,"getUserContribs",a),m=Array.isArray(c[1])?c[1]:[],p=m.slice(0,o);return l({username:t,namespace:e,limit:o,total:m.length,displayed:p.length,contributions:p})}catch(s){return i("Failed to get user contributions",s)}}function nt(t){return t.tool("whoami","Get information about the currently logged in user",{},{title:"Who am I",readOnlyHint:!0,destructiveHint:!1},async()=>de())}async function de(){try{let t=await r(),e=await n(t,"whoami");return l(e)}catch(t){return i("Failed to get current user info",t)}}import{z as fe}from"zod";function st(t){return t.tool("whois","Get information about a specific user",{username:fe.string().describe("Username to look up")},{title:"Whois",readOnlyHint:!0,destructiveHint:!1},async({username:e})=>ye(e))}async function ye(t){try{let e=await r(),o=await n(e,"whois",t);return o.missing?i(`User "${t}" not found.`):l(o)}catch(e){return i("Failed to get user info",e)}}import{z as it}from"zod";function lt(t){return t.tool("whoare","Get information about multiple wiki users",{usernames:it.array(it.string()).describe("Array of usernames to query")},{title:"Who are",readOnlyHint:!0,destructiveHint:!1},async e=>Te(e))}async function Te(t){try{let e=await r(),o=await n(e,"whoare",t.usernames);return l(o)}catch(e){return i("Failed to get user information",e)}}import{z as at}from"zod";function ct(t){return t.tool("get-images","Get list of images starting from a specific name",{startFrom:at.string().optional().default("").describe("Start from this image name"),limit:at.number().optional().default(50).describe("Maximum number of images to return")},{title:"Get images",readOnlyHint:!0,destructiveHint:!1},async({startFrom:e,limit:o})=>Re(e,o))}async function Re(t,e){try{let o=await r(),s=await new Promise((c,m)=>{o.getImages(t,(p,...u)=>{if(p)m(p);else{let g=u[0];c(Array.isArray(g)?g:[])}})}),a=s.slice(0,e);return l({total:s.length,limit:e,startFrom:t,images:a})}catch(o){return i("Failed to get images",o)}}import{z as A}from"zod";function mt(t){return t.tool("get-images-from-article","Get all images embedded in a specific article",{title:A.union([A.string(),A.number()]).describe("Article title or page ID")},{title:"Get images from article",readOnlyHint:!0,destructiveHint:!1},async({title:e})=>he(e))}async function he(t){try{let e=await r(),o=await n(e,"getImagesFromArticle",t);return l({title:t,images:o,count:o.length})}catch(e){return i("Failed to get images from article",e)}}import{z as be}from"zod";function pt(t){return t.tool("get-image-usage","Get all pages that use a specific image",{filename:be.string().describe("Image filename with File: prefix")},{title:"Get image usage",readOnlyHint:!0,destructiveHint:!1},async({filename:e})=>xe(e))}async function xe(t){try{let e=await r(),o=await n(e,"getImageUsage",t);return l({filename:t,pages:o,count:o.length})}catch(e){return i("Failed to get image usage",e)}}import{z as ve}from"zod";function ut(t){return t.tool("get-image-info","Get detailed information about an image file",{filename:ve.string().describe("Image filename with File: prefix")},{title:"Get image info",readOnlyHint:!0,destructiveHint:!1},async({filename:e})=>we(e))}async function we(t){try{let e=await r(),o=await n(e,"getImageInfo",t);return o?l({filename:t,info:o}):i(`Image "${t}" not found.`)}catch(e){return i("Failed to get image info",e)}}import{z as S}from"zod";function gt(t){return t.tool("get-log","Get log entries of a specific type",{type:S.string().describe("Log type (e.g. delete, block, move)"),start:S.string().optional().default("").describe("Start timestamp (YYYYMMDDHHMMSS format)"),limit:S.number().optional().default(50).describe("Maximum number of entries to return")},{title:"Get log entries",readOnlyHint:!0,destructiveHint:!1},async({type:e,start:o,limit:s})=>ke(e,o,s))}async function ke(t,e,o){try{let s=await r(),a=await new Promise((m,p)=>{s.getLog(t,e,(u,...g)=>{if(u)p(u);else{let y=g[0];m(Array.isArray(y)?y:[])}})}),c=a.slice(0,o);return l({type:t,start:e,limit:o,total:a.length,displayed:c.length,entries:c})}catch(s){return i("Failed to get log entries",s)}}import{z as dt}from"zod";function ft(t){return t.tool("expand-templates","Expand templates in wikitext",{text:dt.string().describe("Wikitext with templates to expand"),title:dt.string().optional().describe("Context page title")},{title:"Expand templates",readOnlyHint:!0,destructiveHint:!1},async({text:e,title:o})=>Me(e,o))}async function Me(t,e){try{let o=await r();return{content:[{type:"text",text:await n(o,"expandTemplates",t,e||"")}]}}catch(o){return{content:[{type:"text",text:`Error: ${o.message}`}],isError:!0}}}import{z as yt}from"zod";function Tt(t){return t.tool("parse","Parse wikitext to HTML",{text:yt.string().describe("Wikitext to parse"),title:yt.string().optional().describe("Context page title")},{title:"Parse wikitext",readOnlyHint:!0,destructiveHint:!1},async({text:e,title:o})=>Ae(e,o))}async function Ae(t,e){try{let o=await r(),s=await n(o,"parse",t,e||""),a=s[1]||"",c=Array.isArray(s[2])?s[2]:[];return{content:[{type:"text",text:["Parsed XML structure:","",a,"",`Images found: ${c.length>0?c.join(", "):"none"}`].join(`
|
|
36
|
+
`)}]}}catch(o){return{content:[{type:"text",text:`Error: ${o.message}`}],isError:!0}}}import{z as Rt}from"zod";function ht(t){return t.tool("get-recent-changes","Get recent changes on the wiki",{start:Rt.string().optional().describe("Start timestamp"),limit:Rt.number().optional().default(50).describe("Maximum number of changes to return")},{title:"Get recent changes",readOnlyHint:!0,destructiveHint:!1},async({start:e,limit:o})=>Se(e,o))}async function Se(t,e=50){try{let o=await r(),s=await new Promise((c,m)=>{o.getRecentChanges(t,(p,...u)=>{if(p)m(p);else{let g=u[0];c(Array.isArray(g)?g:[])}})}),a=s.slice(0,e);return l({total:s.length,limit:e,start:t,changes:a})}catch(o){return i("Failed to get recent changes",o)}}import{z as bt}from"zod";function xt(t){return t.tool("get-site-info","Get site information from MediaWiki",{properties:bt.array(bt.string()).describe("List of site information properties to retrieve")},{title:"Get site info",readOnlyHint:!0,destructiveHint:!1},async({properties:e})=>Ce(e))}async function Ce(t){try{let e=await r(),o=await n(e,"getSiteInfo",t);return l(o||{})}catch(e){return i("Failed to get site info",e)}}function vt(t){return t.tool("get-site-stats","Get site statistics",{},{title:"Get site stats",readOnlyHint:!0,destructiveHint:!1},async()=>Pe())}async function Pe(){try{let t=await r(),e=await n(t,"getSiteStats");return l(e)}catch(t){return i("Failed to get site stats",t)}}function wt(t){return t.tool("get-mediawiki-version","Get MediaWiki version running on the server",{},{title:"Get MediaWiki version",readOnlyHint:!0,destructiveHint:!1},async()=>je())}async function je(){try{let t=await r(),e=await n(t,"getMediaWikiVersion");return l({version:e})}catch(t){return i("Failed to get MediaWiki version",t)}}import{z as Be}from"zod";function kt(t){return t.tool("get-query-page","Get results from a query page (special page)",{name:Be.string().describe("Name of the query page")},{title:"Get query page results",readOnlyHint:!0,destructiveHint:!1},async({name:e})=>Ee(e))}async function Ee(t){try{let e=await r(),o=await n(e,"getQueryPage",t);return l({name:t,results:o,count:o.length})}catch(e){return i("Failed to get query page results",e)}}import{z as C}from"zod";function Mt(t){return t.tool("get-external-links","Get all external links from an article",{title:C.union([C.string(),C.number()]).describe("Article title or page ID")},{title:"Get external links",readOnlyHint:!0,destructiveHint:!1},async({title:e})=>He(e))}async function He(t){try{let e=await r(),o=await n(e,"getExternalLinks",t);return l({title:t,links:o.map(s=>s["*"]),count:o.length})}catch(e){return i("Failed to get external links",e)}}import{z as Ie}from"zod";function At(t){return t.tool("get-backlinks","Get all backlinks to a specific page",{title:Ie.string().describe("Target page title to find backlinks for")},{title:"Get backlinks",readOnlyHint:!0,destructiveHint:!1},async({title:e})=>Ge(e))}async function Ge(t){try{let e=await r(),o=await n(e,"getBacklinks",t);return l({target:t,backlinks:o,count:o.length})}catch(e){return i("Failed to get backlinks",e)}}import{z as h}from"zod";function St(t){return t.tool("edit","Edit a wiki page (requires authentication)",{title:h.string().describe("Page title to edit"),content:h.string().describe("New content for the page"),summary:h.string().describe("Edit summary"),minor:h.boolean().optional().default(!1).describe("Mark as minor edit")},{title:"Edit page",readOnlyHint:!1,destructiveHint:!0},async e=>Fe(e))}async function Fe(t){try{let e=await r(),o=`[nodemw-mcp] ${t.summary}`,s=await n(e,"edit",t.title,t.content,o,t.minor||!1);return l(s)}catch(e){return i("Failed to edit page",e)}}import{z as P}from"zod";function Ct(t){return t.tool("append","Append content to a wiki page (requires authentication)",{title:P.string().describe("Page title"),content:P.string().describe("Content to append"),summary:P.string().describe("Edit summary")},{title:"Append to page",readOnlyHint:!1,destructiveHint:!0},async e=>Oe(e))}async function Oe(t){try{let e=await r(),o=`[nodemw-mcp] ${t.summary}`;return await n(e,"append",t.title,t.content,o),l({success:!0,title:t.title})}catch(e){return i("Failed to append to page",e)}}import{z as j}from"zod";function Pt(t){return t.tool("prepend","Prepend content to a wiki page (requires authentication)",{title:j.string().describe("Page title to prepend to"),content:j.string().describe("Content to prepend"),summary:j.string().describe("Edit summary")},{title:"Prepend to page",readOnlyHint:!1,destructiveHint:!0},async e=>Ue(e))}async function Ue(t){try{let e=await r(),o=`[nodemw-mcp] ${t.summary}`,s=await n(e,"prepend",t.title,t.content,o);return l(s)}catch(e){return i("Failed to prepend to page",e)}}import{z as B}from"zod";function jt(t){return t.tool("move","Move (rename) a wiki page (requires authentication)",{from:B.string().describe("Current page title"),to:B.string().describe("New page title"),summary:B.string().describe("Move summary")},{title:"Move page",readOnlyHint:!1,destructiveHint:!0},async e=>ze(e))}async function ze(t){try{let e=await r(),o=`[nodemw-mcp] ${t.summary}`,s=await n(e,"move",t.from,t.to,o);return l(s)}catch(e){return i("Failed to move page",e)}}import{z as Bt}from"zod";function Et(t){return t.tool("delete","Delete a wiki page (requires authentication)",{title:Bt.string().describe("Page title to delete"),reason:Bt.string().describe("Reason for deletion")},{title:"Delete page",readOnlyHint:!1,destructiveHint:!0},async e=>We(e))}async function We(t){try{let e=await r(),o=`[nodemw-mcp] ${t.reason}`,s=await n(e,"delete",t.title,o);return l(s)}catch(e){return i("Failed to delete page",e)}}import{z as f}from"zod";function Ht(t){return t.tool("protect","Protect a wiki page (requires authentication)",{title:f.string().describe("Page title to protect"),protections:f.array(f.object({type:f.string().describe("Action type (e.g., edit, move)"),level:f.string().optional().default("all").describe("Protection level (e.g., sysop, autoconfirmed)"),expiry:f.string().optional().describe("Expiry time (e.g., 1 week, never)")})).describe("Protection settings"),reason:f.string().optional().describe("Reason for protection"),cascade:f.boolean().optional().default(!1).describe("Apply cascade protection")},{title:"Protect page",readOnlyHint:!1,destructiveHint:!0},async e=>Ne(e))}async function Ne(t){try{let e=await r(),o={};t.reason&&(o.reason=`[nodemw-mcp] ${t.reason}`),t.cascade&&(o.cascade=t.cascade);let s=await n(e,"protect",t.title,t.protections,o);return l(s)}catch(e){return i("Failed to protect page",e)}}import{z as b}from"zod";function It(t){return t.tool("purge","Purge cache for wiki pages",{titles:b.union([b.string(),b.array(b.string())]).describe("Page title(s) or category to purge")},{title:"Purge pages",readOnlyHint:!1,destructiveHint:!1},async e=>Le(e))}async function Le(t){try{let e=await r(),o=await n(e,"purge",t.titles);return l(o)}catch(e){return i("Failed to purge pages",e)}}import{z as E}from"zod";function Gt(t){return t.tool("send-email","Send email to a wiki user (requires authentication)",{username:E.string().describe("Username to email"),subject:E.string().describe("Email subject"),text:E.string().describe("Email content")},{title:"Send email",readOnlyHint:!1,destructiveHint:!1},async e=>$e(e))}async function $e(t){try{let e=await r(),o=await n(e,"sendEmail",t.username,t.subject,t.text);return l(o)}catch(e){return i("Failed to send email",e)}}import{z as H}from"zod";function Ft(t){return t.tool("upload","Upload a file to wiki (requires authentication)",{filename:H.string().describe("Destination filename on wiki"),content:H.string().describe("File content as base64 string"),comment:H.string().optional().describe("Upload comment")},{title:"Upload file",readOnlyHint:!1,destructiveHint:!1},async e=>De(e))}async function De(t){try{let e=await r(),o=Buffer.from(t.content,"base64"),s=t.comment?`[nodemw-mcp] ${t.comment}`:"[nodemw-mcp] File upload",a=await n(e,"upload",t.filename,o,s);return l(a)}catch(e){return i("Failed to upload file",e)}}import{z as I}from"zod";function Ot(t){return t.tool("upload-by-url","Upload a file to wiki from URL (requires authentication)",{filename:I.string().describe("Destination filename on wiki"),url:I.string().url().describe("Source URL to download file from"),summary:I.string().optional().describe("Upload summary")},{title:"Upload file by URL",readOnlyHint:!1,destructiveHint:!1},async e=>qe(e))}async function qe(t){try{let e=await r(),o=t.summary?`[nodemw-mcp] ${t.summary}`:"[nodemw-mcp] File upload from URL",s=await n(e,"uploadByUrl",t.filename,t.url,o);return l(s)}catch(e){return i("Failed to upload file by URL",e)}}import{z as G}from"zod";function Ut(t){return t.tool("add-flow-topic","Add a new Flow topic to a wiki page (requires authentication)",{title:G.string().describe("Page title to add topic to"),subject:G.string().describe("Topic subject"),content:G.string().describe("Topic content in wikitext")},{title:"Add Flow topic",readOnlyHint:!1,destructiveHint:!1},async e=>_e(e))}async function _e(t){try{let e=await r(),o=await n(e,"addFlowTopic",t.title,t.subject,t.content);return l(o)}catch(e){return i("Failed to add Flow topic",e)}}import{z as zt}from"zod";function Wt(t){return t.tool("create-account","Create a new MediaWiki user account (requires authentication)",{username:zt.string().describe("New account username"),password:zt.string().describe("New account password")},{title:"Create user account",readOnlyHint:!1,destructiveHint:!1},async e=>Qe(e))}async function Qe(t){try{let e=await r(),o=await n(e,"createAccount",t.username,t.password);return l(o)}catch(e){return i("Failed to create account",e)}}var Ve=[L,D,q,_,V,Y,J,X,K,Z,tt,et,ot,rt,nt,st,lt,ct,mt,pt,ut,gt,ft,Tt,ht,xt,vt,wt,kt,Mt,At,St,Ct,Pt,jt,Et,Ht,It,Gt,Ft,Ot,Ut,Wt];function Nt(t){let e=[];for(let o of Ve)try{e.push(o(t))}catch(s){console.error(`Error registering tool: ${s.message}`)}return e}function Xe(){let{values:t,positionals:e}=Je({options:{server:{type:"string",short:"s"},path:{type:"string"},endpoint:{type:"string"},user:{type:"string",short:"u"},pass:{type:"string",short:"p"},token:{type:"string"},"dry-run":{type:"boolean"}},strict:!1,allowPositionals:!0}),o=t.server??e[0]??process.env.NODEMW_MCP_SERVER;o||(console.error("Error: target server is required (-s, positional arg, or NODEMW_MCP_SERVER env)"),process.exit(1));let s,a,c;try{if(o.startsWith("http://")||o.startsWith("https://")){let u=new URL(o);s=u.hostname,a=u.protocol.replace(":",""),u.port&&(c=parseInt(u.port,10))}else s=o}catch{s=o}let m=process.env.NODEMW_MCP_ENDPOINT_PATH,p=!!(t.path??t.endpoint??m);return{config:{server:s,protocol:a,port:c,path:t.path??t.endpoint??m??"/w",username:t.user??process.env.NODEMW_MCP_MW_USER,password:t.pass??process.env.NODEMW_MCP_MW_PASS,token:t.token,dryRun:t["dry-run"]},pathExplicit:p}}async function Ke(){let{config:t,pathExplicit:e}=Xe();if(!e)try{t.path=await W(t),console.error(`Auto-detected API path: ${t.path}`)}catch(m){console.error("Error:",m.message),process.exit(1)}U(t);try{await N(t)}catch(m){console.error("Error:",m.message),process.exit(1)}let o=r(),s;try{let p=(await n(o,"getSiteInfo",["general"]))?.general;p&&(s={sitename:p.sitename||"Unknown",base:p.base||"",generator:p.generator||"MediaWiki"})}catch{console.error("Warning: Could not fetch site info for server description.")}let a=O(s);Nt(a);let c=new Ye;await a.connect(c)}Ke().catch(console.error);
|
|
37
|
+
//# sourceMappingURL=index.js.map
|