@wuyax/mcps 0.1.0-beta.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.
- package/README.md +318 -0
- package/bin/mcps.mjs +11 -0
- package/dist/chunk-XW2KL6W3.js +2360 -0
- package/dist/cli.cjs +2534 -0
- package/dist/cli.d.cts +2 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +228 -0
- package/dist/index.cjs +2453 -0
- package/dist/index.d.cts +378 -0
- package/dist/index.d.ts +378 -0
- package/dist/index.js +111 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
# mcps (@wuyax/mcps)
|
|
2
|
+
|
|
3
|
+
Cross-platform MCP (Model Context Protocol) server installer, synchronizer, and configuration manager for AI coding agents.
|
|
4
|
+
|
|
5
|
+
`mcps` bridges configuration divergence across AI coding tools. It parses MCP server sources, auto-detects installed coding agents, converts configuration shapes into agent-specific dialects, and persists settings into native configuration files across multiple formats (`json`, `jsonc`, `yaml`, `toml`).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Key Features
|
|
10
|
+
|
|
11
|
+
- **23 Supported Agents**: Supports Cursor, VS Code, Claude Code, Claude Desktop, Antigravity, Amp, Augment, Codex, Goose, Grok, Kimi Code, Kiro, OpenCode, Pi, Qoder, Qwen Code, Trae, Zed, and more.
|
|
12
|
+
- **Multi-Format Persistence**: Native read and write support for JSON, JSONC (preserving comments), YAML, and TOML.
|
|
13
|
+
- **Dialect Transforms**: Declarative transformation layer mapping standard MCP server definitions into agent-specific field structures (`command` vs `cmd`, array vs string, transport types, headers, timeouts).
|
|
14
|
+
- **Source Auto-Detection**: Supports npm packages (via `npx -y`), remote HTTP and SSE URLs, and custom stdio commands/Docker containers. Automatically strips scopes, extensions, and server affixes to infer clean server names.
|
|
15
|
+
- **Cross-Agent Synchronization**: Inspect installed MCP servers and clone configurations across agents with automatic format and schema conversion.
|
|
16
|
+
- **Dual Mode (Interactive TTY + Non-Interactive CLI)**: Interactive terminal wizards with password masking for secrets, plus full flag support for headless scripts and CI automation.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
Run directly via `npx`:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx @wuyax/mcps
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Or install globally:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install -g @wuyax/mcps
|
|
32
|
+
# or
|
|
33
|
+
pnpm add -g @wuyax/mcps
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
You can run directly via `npx @wuyax/mcps [command]`, or run `mcps [command]` if installed globally.
|
|
41
|
+
|
|
42
|
+
### Interactive Wizard (Default)
|
|
43
|
+
|
|
44
|
+
Launch the interactive terminal wizard:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx @wuyax/mcps
|
|
48
|
+
# or if installed globally:
|
|
49
|
+
mcps
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The interactive wizard provides:
|
|
53
|
+
1. **Add MCP Server**: Step-by-step wizard to install npm packages, remote endpoints, or stdio commands. Supports multi-line `.env` pasting with password masking for sensitive tokens.
|
|
54
|
+
2. **Manage & Sync Installed MCP Servers**: Inspect installed servers in project or global scope, view parsed details, and sync/clone any server to other detected or selected agents.
|
|
55
|
+
3. **Remove MCP Server**: Select and remove MCP servers from target agent configs.
|
|
56
|
+
|
|
57
|
+
### Non-Interactive CLI
|
|
58
|
+
|
|
59
|
+
Install an npm MCP server into auto-detected project agents:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
mcps add @modelcontextprotocol/server-filesystem
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Install a remote SSE server to specific agents with authentication headers:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
mcps add https://mcp.example.com/sse --transport sse --header "Authorization: Bearer token123" -a cursor vscode
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
List installed servers in the current project:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
mcps list
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Remove a server from all agents globally:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
mcps remove server-filesystem -g --all
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Supported Agents
|
|
86
|
+
|
|
87
|
+
| Agent | Identifier | Aliases | Scopes | Transports | Config Format | Config Path (Project / Global) |
|
|
88
|
+
| :--- | :--- | :--- | :--- | :--- | :--- | :--- |
|
|
89
|
+
| **Amp** | `amp` | `amp-cli`, `amp-code`, `ampcode` | Project, Global | stdio, http, sse | `jsonc` | `.amp/settings.json` / `~/.config/amp/settings.jsonc` |
|
|
90
|
+
| **Antigravity** | `antigravity` | - | Project, Global | stdio, http, sse | `jsonc` | `.agents/mcp_config.json` / `~/.gemini/config/mcp_config.json` |
|
|
91
|
+
| **Antigravity CLI** | `antigravity-cli` | `agy` | Project, Global | stdio, http, sse | `jsonc` | `.agents/mcp_config.json` / `~/.gemini/config/mcp_config.json` |
|
|
92
|
+
| **Augment** | `augment` | `auggie`, `augment-code`, `augmentcode` | Project, Global | stdio, http, sse | `jsonc` | `.augment/settings.json` / `~/.augment/settings.jsonc` |
|
|
93
|
+
| **Claude Code** | `claude-code` | - | Project, Global | stdio, http, sse | `jsonc` | `.mcp.json` / `~/.claude.json` |
|
|
94
|
+
| **Claude Desktop** | `claude-desktop` | - | Global | stdio | `jsonc` | User Application Support / Roaming `claude_desktop_config.json` |
|
|
95
|
+
| **Cline (VS Code)** | `cline` | `cline-vscode` | Project, Global | stdio, http, sse | `jsonc` | `.cline/mcp.json` / VS Code global storage `cline_mcp_settings.json` |
|
|
96
|
+
| **Cline CLI** | `cline-cli` | - | Project, Global | stdio, http, sse | `jsonc` | `.cline/mcp.json` / `~/.cline/mcp.json` |
|
|
97
|
+
| **Codex** | `codex` | - | Project, Global | stdio, http, sse | `toml` | `.codex/config.toml` / `~/.codex/config.toml` |
|
|
98
|
+
| **Cursor** | `cursor` | - | Project, Global | stdio, http, sse | `jsonc` | `.cursor/mcp.json` / `~/.cursor/mcp.json` |
|
|
99
|
+
| **Gemini CLI** | `gemini-cli` | `gemini` | Project, Global | stdio, http, sse | `jsonc` | `.gemini/settings.json` / `~/.gemini/settings.json` |
|
|
100
|
+
| **GitHub Copilot CLI** | `github-copilot-cli` | - | Project, Global | stdio, http, sse | `jsonc` | `.mcp.json` / `~/.copilot/mcp-config.json` |
|
|
101
|
+
| **Goose** | `goose` | - | Project, Global | stdio, http, sse | `yaml` | `.goose/config.yaml` / `~/.config/goose/config.yaml` |
|
|
102
|
+
| **Grok** | `grok` | `grok-cli`, `xai`, `xai-grok` | Project, Global | stdio, http, sse | `toml` | `.grok/config.toml` / `~/.grok/config.toml` |
|
|
103
|
+
| **Kimi Code CLI** | `kimi-code-cli` | `kimi`, `kimi-cli`, `kimi-code` | Project, Global | stdio, http, sse | `jsonc` | `.kimi-code/mcp.json` / `~/.kimi-code/mcp.json` |
|
|
104
|
+
| **Kiro** | `kiro` | `kiro-cli`, `kiro-ide` | Project, Global | stdio, http, sse | `jsonc` | `.kiro/settings/mcp.json` / `~/.kiro/settings/mcp.json` |
|
|
105
|
+
| **OpenCode** | `opencode` | - | Project, Global | stdio, http, sse | `jsonc` | `opencode.json` / `~/.config/opencode/opencode.json` |
|
|
106
|
+
| **Pi** | `pi` | `pi-agent` | Project, Global | stdio, http, sse | `jsonc` | `.pi/mcp.json` / `~/.pi/agent/mcp.json` |
|
|
107
|
+
| **Qoder** | `qoder` | `qoder-cli` | Project, Global | stdio, http, sse | `jsonc` | `.mcp.json` / `~/.qoder/settings.json` |
|
|
108
|
+
| **Qwen Code** | `qwen-code` | `qwen`, `qwen-cli`, `qwencode` | Project, Global | stdio, http, sse | `jsonc` | `.qwen/settings.json` / `~/.qwen/settings.json` |
|
|
109
|
+
| **Trae** | `trae` | `trae-code`, `traecode`, `trae-ide` | Project, Global | stdio, http, sse | `jsonc` | `.trae/mcp.json` / `~/.trae/mcp.json` |
|
|
110
|
+
| **VS Code** | `vscode` | `github-copilot` | Project, Global | stdio, http, sse | `jsonc` | `.vscode/mcp.json` / User `mcp.json` |
|
|
111
|
+
| **Zed** | `zed` | - | Project, Global | stdio, http, sse | `jsonc` | `.zed/settings.json` / `~/.config/zed/settings.json` |
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## CLI Reference
|
|
116
|
+
|
|
117
|
+
### Global Options
|
|
118
|
+
|
|
119
|
+
- `-v, --version`: Display version number.
|
|
120
|
+
- `-h, --help`: Display command-line help.
|
|
121
|
+
|
|
122
|
+
### `mcps add [source]`
|
|
123
|
+
|
|
124
|
+
Adds an MCP server to one or more agent configurations.
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
mcps add [source] [options]
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### Arguments
|
|
131
|
+
- `[source]`: Remote URL (`http://...`, `https://...`), npm package (`@modelcontextprotocol/server-git`), or shell command (`python -m my_server`). If omitted in TTY mode, opens the interactive wizard.
|
|
132
|
+
|
|
133
|
+
#### Options
|
|
134
|
+
- `-a, --agent <agents...>`: Target agents by identifier or alias. Pass `'*'` to target all agents.
|
|
135
|
+
- `--all`: Install to all supported agents for the specified scope.
|
|
136
|
+
- `-g, --global`: Install to user-level configuration files instead of the current project.
|
|
137
|
+
- `-t, --transport <type>`: Transport type for remote servers (`http` or `sse`).
|
|
138
|
+
- `--header <header...>`: HTTP headers formatted as `Key: Value`. Repeatable.
|
|
139
|
+
- `--env <env...>`: Environment variables formatted as `KEY=VALUE`. Repeatable.
|
|
140
|
+
- `--args <args...>`: Additional command-line arguments for stdio/package servers.
|
|
141
|
+
- `-n, --name <name>`: Explicit override for server name.
|
|
142
|
+
- `-y, --yes`: Non-interactive mode, bypass all confirmation prompts.
|
|
143
|
+
|
|
144
|
+
#### Examples
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Auto-detect project agents and install npm package
|
|
148
|
+
mcps add @modelcontextprotocol/server-postgres
|
|
149
|
+
|
|
150
|
+
# Install with explicit environment variables and custom arguments
|
|
151
|
+
mcps add @modelcontextprotocol/server-github \
|
|
152
|
+
--env "GITHUB_PERSONAL_ACCESS_TOKEN=ghp_xxx" \
|
|
153
|
+
-a cursor claude-code
|
|
154
|
+
|
|
155
|
+
# Install custom python command with name override
|
|
156
|
+
mcps add "python -m my_mcp_server" -n custom-server -a vscode
|
|
157
|
+
|
|
158
|
+
# Install remote server with SSE transport and authorization header globally
|
|
159
|
+
mcps add https://mcp.company.internal/sse \
|
|
160
|
+
-t sse \
|
|
161
|
+
--header "Authorization: Bearer sse_secret" \
|
|
162
|
+
-g -a cursor
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### `mcps list` (alias: `mcps ls`)
|
|
166
|
+
|
|
167
|
+
Lists installed MCP servers across agents.
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
mcps list [options]
|
|
171
|
+
mcps ls [options]
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
#### Options
|
|
175
|
+
- `-g, --global`: List global configurations instead of current project.
|
|
176
|
+
- `-a, --agent <agents...>`: Filter listing by specific agent identifiers or aliases.
|
|
177
|
+
- `--json`: Output server configurations as structured JSON.
|
|
178
|
+
|
|
179
|
+
#### Examples
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# List all servers configured in the current project
|
|
183
|
+
mcps list
|
|
184
|
+
|
|
185
|
+
# List all global servers as JSON
|
|
186
|
+
mcps list -g --json
|
|
187
|
+
|
|
188
|
+
# List servers configured in Cursor and VS Code
|
|
189
|
+
mcps list -a cursor vscode
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### `mcps remove [name]` (alias: `mcps rm`)
|
|
193
|
+
|
|
194
|
+
Removes an MCP server from agent configuration files.
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
mcps remove [name] [options]
|
|
198
|
+
mcps rm [name] [options]
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
#### Arguments
|
|
202
|
+
- `[name]`: Name of the MCP server to remove. If omitted in TTY mode, opens the interactive removal wizard.
|
|
203
|
+
|
|
204
|
+
#### Options
|
|
205
|
+
- `-g, --global`: Remove from global user-level configurations.
|
|
206
|
+
- `-a, --agent <agents...>`: Filter removal to specific agents. Pass `'*'` for all agents.
|
|
207
|
+
- `-y, --yes`: Skip confirmation prompt.
|
|
208
|
+
|
|
209
|
+
#### Examples
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# Remove from all configured project agents
|
|
213
|
+
mcps remove postgres
|
|
214
|
+
|
|
215
|
+
# Remove from Cursor in global scope without prompt
|
|
216
|
+
mcps remove github -a cursor -g -y
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Source Parsing Mechanics
|
|
222
|
+
|
|
223
|
+
When a source string is provided to `mcps add`, `mcps` classifies and normalizes it automatically:
|
|
224
|
+
|
|
225
|
+
1. **Remote URL**: Any source starting with `http://` or `https://`.
|
|
226
|
+
- Transport defaults to `sse` if the URL contains `/sse`, otherwise `http`.
|
|
227
|
+
- Server name is derived from the primary hostname label, stripping common TLDs and generic prefixes (`api`, `mcp`, `app`).
|
|
228
|
+
2. **npm Package**: Single token matching npm package naming rules.
|
|
229
|
+
- Command is normalized to `npx -y <package>`.
|
|
230
|
+
- Server name is inferred by stripping npm scope prefixes (`@modelcontextprotocol/`), package affixes (`mcp-server-`, `-mcp-server`, `mcp-`, `-mcp`, `-server`, `server-`), and script extensions.
|
|
231
|
+
3. **Command**: Any string containing spaces or command runners (`python`, `uvx`, `node`, `docker`).
|
|
232
|
+
- Command runner and flags are parsed, extracting the target package or command name as the inferred server name.
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Programmatic Node API
|
|
237
|
+
|
|
238
|
+
`mcps` provides a strongly-typed TypeScript/ESM and CommonJS API.
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
import {
|
|
242
|
+
installMcpServer,
|
|
243
|
+
listInstalledMcpServers,
|
|
244
|
+
removeMcpServer,
|
|
245
|
+
parseMcpSource,
|
|
246
|
+
resolveTargetAgents,
|
|
247
|
+
transformServerConfigForAgent,
|
|
248
|
+
getMcpAgentConfig,
|
|
249
|
+
} from "mcps";
|
|
250
|
+
|
|
251
|
+
// 1. Install an MCP server
|
|
252
|
+
const installResult = installMcpServer({
|
|
253
|
+
source: "@modelcontextprotocol/server-postgres",
|
|
254
|
+
agents: ["cursor", "vscode", "codex"],
|
|
255
|
+
env: {
|
|
256
|
+
POSTGRES_CONNECTION_STRING: "postgresql://localhost/db",
|
|
257
|
+
},
|
|
258
|
+
global: false,
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
console.log(`Configured ${installResult.serverName}:`);
|
|
262
|
+
for (const res of installResult.results) {
|
|
263
|
+
console.log(`- ${res.agent}: ${res.success ? "OK" : res.error} (${res.path})`);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// 2. List installed servers
|
|
267
|
+
const installedServers = listInstalledMcpServers({
|
|
268
|
+
global: false,
|
|
269
|
+
agents: ["cursor"],
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
// 3. Parse an MCP source string
|
|
273
|
+
const parsed = parseMcpSource("https://api.github.com/mcp/sse");
|
|
274
|
+
// { type: "remote", value: "https://api.github.com/mcp/sse", inferredName: "github" }
|
|
275
|
+
|
|
276
|
+
// 4. Remove an MCP server
|
|
277
|
+
const removeResults = removeMcpServer({
|
|
278
|
+
name: "postgres",
|
|
279
|
+
agents: ["cursor"],
|
|
280
|
+
global: false,
|
|
281
|
+
});
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Architecture & Seams
|
|
287
|
+
|
|
288
|
+
`mcps` is structured as a collection of decoupled deep modules:
|
|
289
|
+
|
|
290
|
+
- **CLI Commands (`src/cli/`)**: Built on `commander`. Guarantees clean separation between non-interactive execution and interactive TTY fallback.
|
|
291
|
+
- **Interactive Wizards (`src/interactive/`)**: Terminal interface built with `@inquirer/prompts`. Handles scoped inspection, password masking for credentials, and cross-agent synchronization.
|
|
292
|
+
- **Target Agent Resolver (`src/resolve-target-agents.ts`)**: Resolves target agents by combining CLI arguments, wildcards, filesystem auto-detection, and transport capability filtering (e.g. preventing remote servers on stdio-only agents).
|
|
293
|
+
- **Agent Config Store (`src/config-store.ts`)**: Unified persistence engine managing path resolution, atomic updates, and format-specific serialization.
|
|
294
|
+
- **Format Adapters (`src/formats/`)**: Isolated adapters for `json`, `jsonc` (comment-preserving via `jsonc-parser`), `yaml` (`yaml`), and `toml` (`@iarna/toml`).
|
|
295
|
+
- **Server Config Dialects (`src/transforms/`)**: Declarative transformations standardizing variations in agent configuration schemas (e.g., Goose's `cmd`/`envs`, VS Code's `servers` and `type`, OpenCode's command arrays).
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## Development & Verification
|
|
300
|
+
|
|
301
|
+
Every change must pass all three gates:
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
# 1. Type check
|
|
305
|
+
pnpm run typecheck
|
|
306
|
+
|
|
307
|
+
# 2. Unit and integration tests
|
|
308
|
+
pnpm test
|
|
309
|
+
|
|
310
|
+
# 3. Build ESM and CJS bundles
|
|
311
|
+
pnpm build
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## License
|
|
317
|
+
|
|
318
|
+
MIT
|