@maplezzk/mcps 1.1.6 → 1.5.0
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 +154 -387
- package/README.zh.md +407 -0
- package/dist/commands/call.js +75 -18
- package/dist/commands/tools.js +32 -2
- package/dist/tests/unit/call.test.js +111 -0
- package/dist/tests/unit/tools.test.js +170 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,61 +1,60 @@
|
|
|
1
1
|
# mcps - MCP CLI Manager
|
|
2
2
|
|
|
3
|
-
[English](./
|
|
3
|
+
[English](./README.md) | [简体中文](./README.zh.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A powerful command-line interface for managing and interacting with [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) servers.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Features
|
|
8
8
|
|
|
9
|
-
- 🔌
|
|
10
|
-
- 🛠️
|
|
11
|
-
- 🚀
|
|
12
|
-
- 🔄
|
|
13
|
-
- 📊
|
|
14
|
-
- 🔍
|
|
15
|
-
- 🚨
|
|
16
|
-
- ✅ **自动化测试**:完整的测试套件,确保代码质量
|
|
9
|
+
- 🔌 **Server Management**: Easily add, remove, list, and update MCP servers (Stdio, SSE, and HTTP modes)
|
|
10
|
+
- 🛠️ **Tool Discovery**: List available tools from any configured server
|
|
11
|
+
- 🚀 **Tool Execution**: Call tools directly from the CLI with automatic argument parsing
|
|
12
|
+
- 🔄 **Daemon Mode**: Maintain persistent connections to MCP servers for better performance
|
|
13
|
+
- 📊 **Table Output**: Clear server status and tool listings
|
|
14
|
+
- 🔍 **Tool Filtering**: Filter tools by keywords with simple mode
|
|
15
|
+
- 🚨 **Verbose Logging**: Optional detailed logging for debugging
|
|
17
16
|
|
|
18
|
-
##
|
|
17
|
+
## Installation
|
|
19
18
|
|
|
20
19
|
```bash
|
|
21
20
|
npm install -g @maplezzk/mcps
|
|
22
21
|
```
|
|
23
22
|
|
|
24
|
-
##
|
|
23
|
+
## Quick Start
|
|
25
24
|
|
|
26
25
|
```bash
|
|
27
|
-
# 1.
|
|
26
|
+
# 1. Add a server
|
|
28
27
|
mcps add fetch --command uvx --args mcp-server-fetch
|
|
29
28
|
|
|
30
|
-
# 2.
|
|
29
|
+
# 2. Start the daemon
|
|
31
30
|
mcps start
|
|
32
31
|
|
|
33
|
-
# 3.
|
|
32
|
+
# 3. Check server status
|
|
34
33
|
mcps status
|
|
35
34
|
|
|
36
|
-
# 4.
|
|
35
|
+
# 4. List available tools
|
|
37
36
|
mcps tools fetch
|
|
38
37
|
|
|
39
|
-
# 5.
|
|
38
|
+
# 5. Call a tool
|
|
40
39
|
mcps call fetch fetch url="https://example.com"
|
|
41
40
|
```
|
|
42
41
|
|
|
43
|
-
##
|
|
42
|
+
## Usage Guide
|
|
44
43
|
|
|
45
|
-
### 1.
|
|
44
|
+
### 1. Daemon Mode
|
|
46
45
|
|
|
47
|
-
mcps
|
|
46
|
+
mcps supports a daemon mode that maintains persistent connections to MCP servers, significantly improving performance for frequent calls.
|
|
48
47
|
|
|
49
|
-
|
|
48
|
+
**Start Daemon:**
|
|
50
49
|
```bash
|
|
51
|
-
#
|
|
50
|
+
# Normal mode
|
|
52
51
|
mcps start
|
|
53
52
|
|
|
54
|
-
#
|
|
53
|
+
# Verbose mode (show connection process for each server and disabled servers)
|
|
55
54
|
mcps start --verbose
|
|
56
55
|
```
|
|
57
56
|
|
|
58
|
-
|
|
57
|
+
Output example:
|
|
59
58
|
```
|
|
60
59
|
Starting daemon in background...
|
|
61
60
|
[Daemon] Connecting to 7 server(s)...
|
|
@@ -66,26 +65,26 @@ Starting daemon in background...
|
|
|
66
65
|
Daemon started successfully on port 4100.
|
|
67
66
|
```
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
**Restart Connections:**
|
|
70
69
|
```bash
|
|
71
|
-
#
|
|
70
|
+
# Reset all connections
|
|
72
71
|
mcps restart
|
|
73
72
|
|
|
74
|
-
#
|
|
73
|
+
# Reset connection for a specific server
|
|
75
74
|
mcps restart my-server
|
|
76
75
|
```
|
|
77
76
|
|
|
78
|
-
|
|
77
|
+
**Stop Daemon:**
|
|
79
78
|
```bash
|
|
80
79
|
mcps stop
|
|
81
80
|
```
|
|
82
81
|
|
|
83
|
-
|
|
82
|
+
**Check Daemon Status:**
|
|
84
83
|
```bash
|
|
85
84
|
mcps status
|
|
86
85
|
```
|
|
87
86
|
|
|
88
|
-
|
|
87
|
+
Output example:
|
|
89
88
|
```
|
|
90
89
|
Daemon is running (v1.0.29)
|
|
91
90
|
|
|
@@ -98,14 +97,14 @@ gitlab-mr-creator Connected 30
|
|
|
98
97
|
Total: 3 connection(s)
|
|
99
98
|
```
|
|
100
99
|
|
|
101
|
-
### 2.
|
|
100
|
+
### 2. Server Management
|
|
102
101
|
|
|
103
|
-
|
|
102
|
+
**List all servers (configuration):**
|
|
104
103
|
```bash
|
|
105
104
|
mcps ls
|
|
106
105
|
```
|
|
107
106
|
|
|
108
|
-
|
|
107
|
+
Output example:
|
|
109
108
|
```
|
|
110
109
|
NAME TYPE ENABLED COMMAND/URL
|
|
111
110
|
───────────────── ────── ─────── ─────────────
|
|
@@ -115,85 +114,86 @@ my-server stdio ✗ npx my-server
|
|
|
115
114
|
Total: 3 server(s)
|
|
116
115
|
```
|
|
117
116
|
|
|
118
|
-
|
|
117
|
+
**Add Stdio Server:**
|
|
119
118
|
```bash
|
|
120
|
-
#
|
|
119
|
+
# Add local Node.js server
|
|
121
120
|
mcps add my-server --command node --args ./build/index.js
|
|
122
121
|
|
|
123
|
-
#
|
|
122
|
+
# Use npx/uvx to add server
|
|
124
123
|
mcps add fetch --command uvx --args mcp-server-fetch
|
|
125
124
|
|
|
126
|
-
#
|
|
125
|
+
# Add server with environment variables
|
|
127
126
|
mcps add my-db --command npx --args @modelcontextprotocol/server-postgres --env POSTGRES_CONNECTION_STRING="${DATABASE_URL}"
|
|
128
127
|
```
|
|
129
128
|
|
|
130
|
-
|
|
129
|
+
**Add SSE Server:**
|
|
131
130
|
```bash
|
|
132
131
|
mcps add remote-server --type sse --url http://localhost:8000/sse
|
|
133
132
|
```
|
|
134
133
|
|
|
135
|
-
|
|
134
|
+
**Add Streamable HTTP Server:**
|
|
136
135
|
```bash
|
|
137
136
|
mcps add my-http-server --type http --url http://localhost:8000/mcp
|
|
138
137
|
```
|
|
139
138
|
|
|
140
|
-
|
|
139
|
+
**Remove Server:**
|
|
141
140
|
```bash
|
|
142
141
|
mcps rm my-server
|
|
143
142
|
```
|
|
144
143
|
|
|
145
|
-
|
|
144
|
+
**Update Server:**
|
|
146
145
|
```bash
|
|
147
|
-
#
|
|
146
|
+
# Refresh all server connections
|
|
148
147
|
mcps update
|
|
149
148
|
|
|
150
|
-
#
|
|
149
|
+
# Update specific server command
|
|
151
150
|
mcps update my-server --command new-command
|
|
152
151
|
|
|
153
|
-
#
|
|
152
|
+
# Update specific server arguments
|
|
154
153
|
mcps update my-server --args arg1 arg2
|
|
155
154
|
|
|
156
|
-
#
|
|
155
|
+
# Update both command and arguments
|
|
157
156
|
mcps update my-server --command node --args ./new-build/index.js
|
|
158
157
|
```
|
|
159
158
|
|
|
160
|
-
### 3.
|
|
159
|
+
### 3. Tool Interaction
|
|
161
160
|
|
|
162
|
-
|
|
161
|
+
**List available tools on a server:**
|
|
163
162
|
```bash
|
|
164
|
-
#
|
|
163
|
+
# Detailed mode (show all information including nested object properties)
|
|
165
164
|
mcps tools chrome-devtools
|
|
166
165
|
|
|
167
|
-
#
|
|
166
|
+
# Simple mode (show only tool names)
|
|
168
167
|
mcps tools chrome-devtools --simple
|
|
169
168
|
|
|
170
|
-
#
|
|
169
|
+
# JSON output (raw tool schema)
|
|
170
|
+
mcps tools chrome-devtools --json
|
|
171
|
+
|
|
172
|
+
# Filter tools by keyword
|
|
171
173
|
mcps tools chrome-devtools --tool screenshot
|
|
172
174
|
|
|
173
|
-
#
|
|
175
|
+
# Multiple keywords + simple mode
|
|
174
176
|
mcps tools gitlab-mr-creator --tool file --tool wiki --simple
|
|
175
177
|
```
|
|
176
178
|
|
|
177
|
-
|
|
179
|
+
Detailed mode output example (with nested objects):
|
|
178
180
|
```
|
|
179
181
|
Available Tools for chrome-devtools:
|
|
180
182
|
|
|
181
183
|
- take_screenshot
|
|
182
184
|
Take a screenshot of the page or element.
|
|
183
185
|
Arguments:
|
|
184
|
-
format*: string (Type of format to save the screenshot as...)
|
|
186
|
+
format*: string ["jpeg", "png", "webp"] (Type of format to save the screenshot as...)
|
|
185
187
|
quality: number (Compression quality from 0-100)
|
|
186
188
|
uid: string (The uid of an element to screenshot...)
|
|
187
|
-
...
|
|
188
189
|
|
|
189
190
|
- click
|
|
190
191
|
Clicks on the provided element
|
|
191
192
|
Arguments:
|
|
192
193
|
uid*: string (The uid of an element...)
|
|
193
|
-
...
|
|
194
194
|
```
|
|
195
195
|
|
|
196
|
-
|
|
196
|
+
Simple mode output example:
|
|
197
197
|
```
|
|
198
198
|
$ mcps tools chrome-devtools -s
|
|
199
199
|
click
|
|
@@ -209,43 +209,78 @@ take_snapshot
|
|
|
209
209
|
Total: 26 tool(s)
|
|
210
210
|
```
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
**Call Tools:**
|
|
213
213
|
|
|
214
|
-
|
|
214
|
+
Syntax:
|
|
215
215
|
```bash
|
|
216
|
-
mcps call <server_name> <tool_name> [arguments...]
|
|
216
|
+
mcps call <server_name> <tool_name> [options] [arguments...]
|
|
217
217
|
```
|
|
218
218
|
|
|
219
|
-
- `<server_name>`:
|
|
220
|
-
- `<tool_name>`:
|
|
221
|
-
- `[
|
|
219
|
+
- `<server_name>`: Name of the configured MCP server
|
|
220
|
+
- `<tool_name>`: Name of the tool to call
|
|
221
|
+
- `[options]`: Optional flags (`--raw`, `--json`)
|
|
222
|
+
- `[arguments...]`: Arguments passed as `key=value` pairs
|
|
223
|
+
|
|
224
|
+
**Options:**
|
|
225
|
+
|
|
226
|
+
| Option | Description |
|
|
227
|
+
|--------|-------------|
|
|
228
|
+
| `-r, --raw` | Treat all values as raw strings (disable JSON parsing) |
|
|
229
|
+
| `-j, --json <value>` | Load parameters from JSON string or file |
|
|
230
|
+
|
|
231
|
+
**Default Mode (Auto JSON Parsing):**
|
|
222
232
|
|
|
223
|
-
|
|
233
|
+
By default, values are automatically parsed as JSON:
|
|
224
234
|
```bash
|
|
225
|
-
#
|
|
235
|
+
# String
|
|
226
236
|
mcps call fetch fetch url="https://example.com"
|
|
227
237
|
|
|
228
|
-
#
|
|
229
|
-
mcps call fetch fetch
|
|
238
|
+
# Numbers and booleans are parsed
|
|
239
|
+
mcps call fetch fetch max_length=5000 follow_redirects=true
|
|
240
|
+
# Sends: { "max_length": 5000, "follow_redirects": true }
|
|
230
241
|
|
|
231
|
-
# JSON
|
|
242
|
+
# JSON object
|
|
232
243
|
mcps call my-server createUser user='{"name": "Alice", "age": 30}'
|
|
233
244
|
|
|
234
|
-
#
|
|
235
|
-
mcps call chrome-devtools take_screenshot fullPage=true quality=90
|
|
236
|
-
|
|
237
|
-
# 混合参数
|
|
245
|
+
# Mixed
|
|
238
246
|
mcps call my-server config debug=true timeout=5000 options='{"retries": 3}'
|
|
239
247
|
```
|
|
240
248
|
|
|
241
|
-
|
|
249
|
+
**--raw Mode (String Values Only):**
|
|
250
|
+
|
|
251
|
+
Use `--raw` to disable JSON parsing. All values remain as strings:
|
|
252
|
+
```bash
|
|
253
|
+
# IDs and codes stay as strings
|
|
254
|
+
mcps call my-db createOrder --raw order_id="12345" sku="ABC-001"
|
|
255
|
+
# Sends: { "order_id": "12345", "sku": "ABC-001" }
|
|
256
|
+
|
|
257
|
+
# SQL queries with special characters
|
|
258
|
+
mcps call alibaba-dms createDataChangeOrder --raw \
|
|
259
|
+
database_id="36005357" \
|
|
260
|
+
script="DELETE FROM table WHERE id = 'xxx';" \
|
|
261
|
+
logic=true
|
|
262
|
+
# Sends: { "database_id": "36005357", "script": "...", "logic": "true" }
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
**--json Mode (Complex Parameters):**
|
|
266
|
+
|
|
267
|
+
For complex parameters, use `--json` to load from a JSON string or file:
|
|
268
|
+
```bash
|
|
269
|
+
# From JSON string
|
|
270
|
+
mcps call my-server createUser --json '{"name": "Alice", "age": 30}'
|
|
271
|
+
|
|
272
|
+
# From file
|
|
273
|
+
mcps call my-server createUser --json params.json
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Configuration File
|
|
242
277
|
|
|
243
|
-
|
|
278
|
+
By default, the configuration file is stored at:
|
|
244
279
|
`~/.mcps/mcp.json`
|
|
245
280
|
|
|
246
|
-
|
|
281
|
+
You can change the storage location by setting the `MCPS_CONFIG_DIR` environment variable.
|
|
247
282
|
|
|
248
|
-
|
|
283
|
+
Configuration file example:
|
|
249
284
|
```json
|
|
250
285
|
{
|
|
251
286
|
"servers": [
|
|
@@ -269,343 +304,75 @@ mcps call my-server config debug=true timeout=5000 options='{"retries": 3}'
|
|
|
269
304
|
}
|
|
270
305
|
```
|
|
271
306
|
|
|
272
|
-
##
|
|
307
|
+
## Environment Variables
|
|
273
308
|
|
|
274
|
-
- `MCPS_CONFIG_DIR`:
|
|
275
|
-
- `MCPS_PORT`: Daemon
|
|
276
|
-
- `MCPS_VERBOSE`:
|
|
309
|
+
- `MCPS_CONFIG_DIR`: Configuration file directory (default: `~/.mcps`)
|
|
310
|
+
- `MCPS_PORT`: Daemon port (default: `4100`)
|
|
311
|
+
- `MCPS_VERBOSE`: Verbose logging mode (default: `false`)
|
|
277
312
|
|
|
278
|
-
##
|
|
313
|
+
## Command Reference
|
|
279
314
|
|
|
280
|
-
###
|
|
281
|
-
- `mcps ls` -
|
|
282
|
-
- `mcps add <name>` -
|
|
283
|
-
- `mcps rm <name>` -
|
|
284
|
-
- `mcps update [name]` -
|
|
315
|
+
### Server Management
|
|
316
|
+
- `mcps ls` - List all servers
|
|
317
|
+
- `mcps add <name>` - Add a new server
|
|
318
|
+
- `mcps rm <name>` - Remove a server
|
|
319
|
+
- `mcps update [name]` - Update server configuration
|
|
285
320
|
|
|
286
|
-
###
|
|
287
|
-
- `mcps start [-v]` -
|
|
288
|
-
- `mcps stop` -
|
|
289
|
-
- `mcps status` -
|
|
290
|
-
- `mcps restart [server]` -
|
|
321
|
+
### Daemon
|
|
322
|
+
- `mcps start [-v]` - Start daemon (`-v` for detailed logging)
|
|
323
|
+
- `mcps stop` - Stop daemon
|
|
324
|
+
- `mcps status` - Check daemon status
|
|
325
|
+
- `mcps restart [server]` - Restart daemon or specific server
|
|
291
326
|
|
|
292
|
-
###
|
|
293
|
-
- `mcps tools <server> [-s] [-t <name>...]` -
|
|
294
|
-
- `-s, --simple`:
|
|
295
|
-
- `-
|
|
296
|
-
-
|
|
327
|
+
### Tool Interaction
|
|
328
|
+
- `mcps tools <server> [-s] [-j] [-t <name>...]` - List available tools
|
|
329
|
+
- `-s, --simple`: Show only tool names
|
|
330
|
+
- `-j, --json`: Output raw JSON (for debugging)
|
|
331
|
+
- `-t, --tool`: Filter tools by name (can be used multiple times)
|
|
332
|
+
- `mcps call <server> <tool> [args...]` - Call a tool
|
|
297
333
|
|
|
298
|
-
##
|
|
334
|
+
## Performance
|
|
299
335
|
|
|
300
|
-
mcps
|
|
336
|
+
mcps optimizes performance through:
|
|
301
337
|
|
|
302
|
-
1.
|
|
303
|
-
2.
|
|
304
|
-
3.
|
|
338
|
+
1. **Daemon Mode**: Maintains persistent connections, avoiding repeated startup overhead
|
|
339
|
+
2. **Tool Caching**: Caches tool counts during connection, avoiding repeated queries
|
|
340
|
+
3. **Async Connections**: Parallel initialization of multiple server connections
|
|
305
341
|
|
|
306
|
-
|
|
307
|
-
-
|
|
308
|
-
-
|
|
309
|
-
-
|
|
310
|
-
|
|
311
|
-
## 开发工作流
|
|
312
|
-
|
|
313
|
-
欢迎贡献代码!以下是参与项目开发的完整流程。
|
|
314
|
-
|
|
315
|
-
### 环境准备
|
|
316
|
-
|
|
317
|
-
**前置要求:**
|
|
318
|
-
- Node.js >= 20
|
|
319
|
-
- npm >= 9
|
|
320
|
-
- Git
|
|
321
|
-
|
|
322
|
-
**克隆项目:**
|
|
323
|
-
```bash
|
|
324
|
-
git clone https://github.com/a13835614623/mcps.git
|
|
325
|
-
cd mcps
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
**安装依赖:**
|
|
329
|
-
```bash
|
|
330
|
-
npm install
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
### 本地开发
|
|
334
|
-
|
|
335
|
-
**开发模式(使用 ts-node 直接运行):**
|
|
336
|
-
```bash
|
|
337
|
-
npm run dev -- <command>
|
|
338
|
-
# 例如
|
|
339
|
-
npm run dev -- ls
|
|
340
|
-
npm run dev -- start
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
**构建项目:**
|
|
344
|
-
```bash
|
|
345
|
-
npm run build
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
**运行构建后的版本:**
|
|
349
|
-
```bash
|
|
350
|
-
npm start -- <command>
|
|
351
|
-
# 或者
|
|
352
|
-
node dist/index.js <command>
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
### 测试
|
|
356
|
-
|
|
357
|
-
**运行测试:**
|
|
358
|
-
```bash
|
|
359
|
-
# 运行所有测试
|
|
360
|
-
npm test
|
|
361
|
-
|
|
362
|
-
# 监听模式(开发时推荐)
|
|
363
|
-
npm run test:watch
|
|
364
|
-
|
|
365
|
-
# 启动测试 UI 界面
|
|
366
|
-
npm run test:ui
|
|
367
|
-
|
|
368
|
-
# 生成测试覆盖率报告
|
|
369
|
-
npm run test:coverage
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
**测试要求:**
|
|
373
|
-
- 所有测试必须通过
|
|
374
|
-
- 新功能需要添加相应的测试
|
|
375
|
-
- 保持测试覆盖率在合理水平
|
|
376
|
-
|
|
377
|
-
### 提交规范
|
|
378
|
-
|
|
379
|
-
**提交信息格式:**
|
|
380
|
-
```
|
|
381
|
-
<type>: <description>
|
|
382
|
-
|
|
383
|
-
[optional body]
|
|
384
|
-
|
|
385
|
-
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
**提交类型(type):**
|
|
389
|
-
- `feat`: 新功能
|
|
390
|
-
- `fix`: 修复 bug
|
|
391
|
-
- `chore`: 构建过程或辅助工具的变动
|
|
392
|
-
- `docs`: 文档更新
|
|
393
|
-
- `refactor`: 重构(既不是新增功能,也不是修复 bug)
|
|
394
|
-
- `style`: 代码格式调整(不影响代码运行的变动)
|
|
395
|
-
- `test`: 增加测试
|
|
396
|
-
- `perf`: 性能优化
|
|
397
|
-
|
|
398
|
-
**示例:**
|
|
399
|
-
```bash
|
|
400
|
-
feat: 支持可配置的 daemon 启动超时时间
|
|
401
|
-
|
|
402
|
-
新增功能:
|
|
403
|
-
- 支持通过命令行参数 --timeout/-t 设置超时
|
|
404
|
-
- 支持通过环境变量 MCPS_DAEMON_TIMEOUT 设置超时
|
|
405
|
-
- 支持通过配置文件 daemonTimeout 字段设置超时
|
|
406
|
-
|
|
407
|
-
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
### PR 流程
|
|
411
|
-
|
|
412
|
-
**1. 创建功能分支:**
|
|
413
|
-
```bash
|
|
414
|
-
git checkout -b feature/your-feature-name
|
|
415
|
-
# 或
|
|
416
|
-
git checkout -b fix/your-bug-fix
|
|
417
|
-
```
|
|
418
|
-
|
|
419
|
-
**分支命名规范:**
|
|
420
|
-
- `feature/` - 新功能
|
|
421
|
-
- `fix/` - bug 修复
|
|
422
|
-
- `refactor/` - 重构
|
|
423
|
-
- `docs/` - 文档更新
|
|
424
|
-
- `chore/` - 构建/工具更新
|
|
425
|
-
|
|
426
|
-
**2. 开发并提交:**
|
|
427
|
-
```bash
|
|
428
|
-
# 进行开发...
|
|
429
|
-
npm run build # 确保构建成功
|
|
430
|
-
npm test # 确保测试通过
|
|
431
|
-
|
|
432
|
-
# 提交代码
|
|
433
|
-
git add .
|
|
434
|
-
git commit -m "feat: 你的功能描述"
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
**3. 更新版本号(如需要):**
|
|
438
|
-
```bash
|
|
439
|
-
# Patch 版本(bug 修复)
|
|
440
|
-
npm version patch
|
|
441
|
-
|
|
442
|
-
# Minor 版本(新功能)
|
|
443
|
-
npm version minor
|
|
444
|
-
|
|
445
|
-
# Major 版本(破坏性变更)
|
|
446
|
-
npm version major
|
|
447
|
-
```
|
|
448
|
-
|
|
449
|
-
**4. 推送并创建 PR:**
|
|
450
|
-
```bash
|
|
451
|
-
git push origin feature/your-feature-name
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
然后访问 GitHub 创建 Pull Request,或在命令行使用:
|
|
455
|
-
```bash
|
|
456
|
-
gh pr create --title "feat: 功能标题" --body "PR 描述"
|
|
457
|
-
```
|
|
458
|
-
|
|
459
|
-
**5. PR 检查清单:**
|
|
460
|
-
- ✅ CI 测试通过(GitHub Actions)
|
|
461
|
-
- ✅ 代码通过所有测试
|
|
462
|
-
- ✅ 新功能有对应的测试
|
|
463
|
-
- ✅ 提交信息符合规范
|
|
464
|
-
- ✅ PR 描述清晰说明了变更内容
|
|
465
|
-
- ✅ 版本号已正确更新(如需要)
|
|
466
|
-
|
|
467
|
-
**6. 解决冲突(如有):**
|
|
468
|
-
```bash
|
|
469
|
-
# 如果 main 分支有更新,先合并最新代码
|
|
470
|
-
git fetch origin
|
|
471
|
-
git merge origin/main
|
|
472
|
-
|
|
473
|
-
# 解决冲突后
|
|
474
|
-
git add .
|
|
475
|
-
git commit -m "chore: merge main and resolve conflicts"
|
|
476
|
-
git push origin feature/your-feature-name
|
|
477
|
-
```
|
|
478
|
-
|
|
479
|
-
### 发布流程
|
|
480
|
-
|
|
481
|
-
项目采用**自动化发布**流程:
|
|
482
|
-
|
|
483
|
-
**1. 版本管理:**
|
|
484
|
-
- 修改 `package.json` 中的版本号
|
|
485
|
-
- 或使用 `npm version` 命令
|
|
486
|
-
|
|
487
|
-
**2. 发布触发:**
|
|
488
|
-
- 当 PR 合并到 `main` 分支时
|
|
489
|
-
- 如果版本号发生变化
|
|
490
|
-
- GitHub Actions 自动发布到 npm
|
|
491
|
-
|
|
492
|
-
**3. 版本号规则:**
|
|
493
|
-
- `1.0.0` → `1.0.1` (Patch): bug 修复
|
|
494
|
-
- `1.0.1` → `1.1.0` (Minor): 新功能
|
|
495
|
-
- `1.1.0` → `2.0.0` (Major): 破坏性变更
|
|
496
|
-
|
|
497
|
-
**4. 预发布版本(可选):**
|
|
498
|
-
```bash
|
|
499
|
-
npm version prerelease --preid beta
|
|
500
|
-
# 生成 1.0.0-beta.0
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
预发布版本会发布到 npm 的 `beta` tag。
|
|
504
|
-
|
|
505
|
-
**5. 跳过发布:**
|
|
506
|
-
如果 PR 不需要发布,在标题中添加 `[skip release]`:
|
|
507
|
-
```
|
|
508
|
-
[skip release] chore: 更新文档
|
|
509
|
-
```
|
|
510
|
-
|
|
511
|
-
### CI/CD
|
|
512
|
-
|
|
513
|
-
**CI 检查(.github/workflows/ci.yml):**
|
|
514
|
-
- 每次 PR 和 push 都会触发
|
|
515
|
-
- 运行测试套件
|
|
516
|
-
- 构建项目
|
|
517
|
-
- 确保代码质量
|
|
518
|
-
|
|
519
|
-
**Release 自动化(.github/workflows/release.yml):**
|
|
520
|
-
- PR 合并后触发
|
|
521
|
-
- 检测版本号变化
|
|
522
|
-
- 自动发布到 npm
|
|
523
|
-
- 创建 GitHub Release
|
|
524
|
-
|
|
525
|
-
### 代码规范
|
|
526
|
-
|
|
527
|
-
**TypeScript:**
|
|
528
|
-
- 使用 TypeScript 进行类型检查
|
|
529
|
-
- 运行 `npm run build` 检查类型错误
|
|
530
|
-
|
|
531
|
-
**代码风格:**
|
|
532
|
-
- 遵循项目现有代码风格
|
|
533
|
-
- 使用有意义的变量和函数名
|
|
534
|
-
- 添加必要的注释
|
|
535
|
-
|
|
536
|
-
**项目结构:**
|
|
537
|
-
```
|
|
538
|
-
mcps/
|
|
539
|
-
├── src/
|
|
540
|
-
│ ├── commands/ # 命令实现
|
|
541
|
-
│ ├── core/ # 核心功能
|
|
542
|
-
│ ├── types/ # 类型定义
|
|
543
|
-
│ └── index.ts # 入口文件
|
|
544
|
-
├── test/ # 测试文件
|
|
545
|
-
├── dist/ # 构建输出
|
|
546
|
-
└── package.json
|
|
547
|
-
```
|
|
548
|
-
|
|
549
|
-
### 常见问题(开发)
|
|
550
|
-
|
|
551
|
-
**Q: 如何调试代码?**
|
|
552
|
-
```bash
|
|
553
|
-
# 使用开发模式运行
|
|
554
|
-
npm run dev -- start --verbose
|
|
555
|
-
|
|
556
|
-
# 或构建后直接运行
|
|
557
|
-
npm run build
|
|
558
|
-
node --inspect dist/index.js <command>
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
**Q: 测试失败了怎么办?**
|
|
562
|
-
```bash
|
|
563
|
-
# 运行特定测试文件
|
|
564
|
-
npm test -- <test-file>
|
|
565
|
-
|
|
566
|
-
# 查看详细输出
|
|
567
|
-
npm test -- --reporter=verbose
|
|
568
|
-
```
|
|
569
|
-
|
|
570
|
-
**Q: 如何本地测试 npm 包?**
|
|
571
|
-
```bash
|
|
572
|
-
# 在项目根目录
|
|
573
|
-
npm link
|
|
574
|
-
|
|
575
|
-
# 在其他项目中使用
|
|
576
|
-
npm link @maplezzk/mcps
|
|
577
|
-
mcps ls
|
|
578
|
-
```
|
|
342
|
+
Typical performance:
|
|
343
|
+
- Start daemon: 10-15 seconds (first time, depends on server count)
|
|
344
|
+
- Check status: ~200ms
|
|
345
|
+
- Call tool: ~50-100ms
|
|
579
346
|
|
|
580
|
-
##
|
|
347
|
+
## FAQ
|
|
581
348
|
|
|
582
|
-
**Q:
|
|
349
|
+
**Q: How to check the status of all servers?**
|
|
583
350
|
```bash
|
|
584
|
-
mcps status #
|
|
585
|
-
mcps ls #
|
|
351
|
+
mcps status # Check active connections
|
|
352
|
+
mcps ls # Check all configurations (including disabled)
|
|
586
353
|
```
|
|
587
354
|
|
|
588
|
-
**Q:
|
|
355
|
+
**Q: What if a server fails to connect?**
|
|
589
356
|
```bash
|
|
590
|
-
#
|
|
357
|
+
# View detailed logs
|
|
591
358
|
mcps start --verbose
|
|
592
359
|
|
|
593
|
-
#
|
|
360
|
+
# Restart that server
|
|
594
361
|
mcps restart my-server
|
|
595
362
|
```
|
|
596
363
|
|
|
597
|
-
**Q:
|
|
598
|
-
|
|
364
|
+
**Q: How to temporarily disable a server?**
|
|
365
|
+
Set `"disabled": true` in the configuration file, or use `mcps update` to modify the configuration.
|
|
599
366
|
|
|
600
|
-
**Q:
|
|
367
|
+
**Q: How to quickly find tools when there are many?**
|
|
601
368
|
```bash
|
|
602
|
-
#
|
|
369
|
+
# Filter tools by keyword
|
|
603
370
|
mcps tools my-server --tool keyword
|
|
604
371
|
|
|
605
|
-
#
|
|
372
|
+
# Show only names
|
|
606
373
|
mcps tools my-server --simple
|
|
607
374
|
```
|
|
608
375
|
|
|
609
|
-
##
|
|
376
|
+
## License
|
|
610
377
|
|
|
611
378
|
ISC
|