@xiedada/nodemw-mcp-server 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +125 -0
- package/dist/index.js +2137 -5
- package/package.json +1 -1
- package/dist/index.js.map +0 -7
package/README.md
CHANGED
|
@@ -122,3 +122,128 @@ npm test # Run tests
|
|
|
122
122
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
123
123
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
124
124
|
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
# Nodemw MCP Server(中文)
|
|
128
|
+
|
|
129
|
+
一个为 [nodemw](https://github.com/macbre/nodemw)(Node.js MediaWiki API 客户端)构建的 [Model Context Protocol (MCP)](https://modelcontextprotocol.org) 服务器。
|
|
130
|
+
|
|
131
|
+
## 快速开始
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# 安装
|
|
135
|
+
npm install
|
|
136
|
+
npm run build
|
|
137
|
+
|
|
138
|
+
# 以游客身份连接
|
|
139
|
+
node dist/index.js zh.minecraft.wiki
|
|
140
|
+
|
|
141
|
+
# 使用账号密码连接
|
|
142
|
+
node dist/index.js -u myuser -p mypass mywiki.example.com
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## CLI 用法
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
nodemw-mcp-server [options] [server]
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**参数说明**:
|
|
152
|
+
|
|
153
|
+
| 参数 | 简写 | 说明 |
|
|
154
|
+
|--------|-------|-------------|
|
|
155
|
+
| `[server]` | (位置参数) | 目标 MediaWiki 服务器,如 `en.wikipedia.org` |
|
|
156
|
+
| `--server` | `-s` | 同上,显式形式 |
|
|
157
|
+
| `--path` | | API 脚本路径(默认:自动检测;先尝试 `/w`,再尝试根路径) |
|
|
158
|
+
| `--user` | `-u` | 登录用户名 |
|
|
159
|
+
| `--pass` | `-p` | 登录密码 |
|
|
160
|
+
| `--dry-run` | | 干运行模式(不执行实际编辑) |
|
|
161
|
+
|
|
162
|
+
**示例**:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# 游客访问,自动检测 API 路径
|
|
166
|
+
nodemw-mcp-server zh.minecraft.wiki
|
|
167
|
+
|
|
168
|
+
# 认证访问,手动指定 API 路径
|
|
169
|
+
nodemw-mcp-server -u editor -p secret --path /w mywiki.example.com
|
|
170
|
+
|
|
171
|
+
# 使用完整 URL
|
|
172
|
+
nodemw-mcp-server -s https://en.wikipedia.org
|
|
173
|
+
|
|
174
|
+
# 干运行模式,安全测试
|
|
175
|
+
nodemw-mcp-server --dry-run -u editor -p secret mywiki.example.com
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## 环境变量
|
|
179
|
+
|
|
180
|
+
所有设置都可以通过环境变量配置,CLI 参数优先级更高。
|
|
181
|
+
|
|
182
|
+
| 变量 | 等效参数 |
|
|
183
|
+
|----------|------------|
|
|
184
|
+
| `NODEMW_MCP_SERVER` | `--server` / 位置参数 |
|
|
185
|
+
| `NODEMW_MCP_ENDPOINT_PATH` | `--path` |
|
|
186
|
+
| `NODEMW_MCP_MW_USER` | `--user` / `-u` |
|
|
187
|
+
| `NODEMW_MCP_MW_PASS` | `--pass` / `-p` |
|
|
188
|
+
|
|
189
|
+
## 配合配置文件使用
|
|
190
|
+
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"mcpServers": {
|
|
194
|
+
"nodemw": {
|
|
195
|
+
"command": "npx",
|
|
196
|
+
"args": ["@xiedada/nodemw-mcp-server"],
|
|
197
|
+
"env": {
|
|
198
|
+
"NODEMW_MCP_SERVER": "mywiki.example.com",
|
|
199
|
+
"NODEMW_MCP_MW_USER": "editor",
|
|
200
|
+
"NODEMW_MCP_MW_PASS": "secret"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## 可用工具
|
|
208
|
+
|
|
209
|
+
### 读取操作(29 个工具)
|
|
210
|
+
|
|
211
|
+
`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`
|
|
212
|
+
|
|
213
|
+
### 写入操作(12 个工具,需要认证)
|
|
214
|
+
|
|
215
|
+
`edit`、`append`、`prepend`、`move`、`delete`、`protect`、`purge`、`send-email`、`upload`、`upload-by-url`、`add-flow-topic`、`create-account`
|
|
216
|
+
|
|
217
|
+
## 开发
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
npm run build # 构建 dist/index.js
|
|
221
|
+
npm run dev # 监视模式
|
|
222
|
+
npm run clean # 删除 dist/
|
|
223
|
+
npm test # 运行测试
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## 许可协议
|
|
227
|
+
|
|
228
|
+
Copyright (c) 2026 Xie Youtian
|
|
229
|
+
|
|
230
|
+
Redistribution and use in source and binary forms, with or without
|
|
231
|
+
modification, are permitted provided that the following conditions are met:
|
|
232
|
+
|
|
233
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
234
|
+
list of conditions and the following disclaimer.
|
|
235
|
+
|
|
236
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
237
|
+
this list of conditions and the following disclaimer in the documentation
|
|
238
|
+
and/or other materials provided with the distribution.
|
|
239
|
+
|
|
240
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
241
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
242
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
243
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
244
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
245
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
246
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
247
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
248
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
249
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|