@mcp-s/cli 0.0.9
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 +14 -0
- package/README.md +475 -0
- package/SKILL.md +103 -0
- package/dist/SKILL.md +103 -0
- package/dist/daemon.js +1023 -0
- package/dist/index.js +3200 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Copyright (c) 2026 Webrix Ltd. All rights reserved.
|
|
2
|
+
https://webrix.ai
|
|
3
|
+
|
|
4
|
+
This software and associated documentation files (the "Software") are proprietary and confidential. The Software is licensed, not sold.
|
|
5
|
+
|
|
6
|
+
Use of this Software is permitted solely by users of Webrix Ltd. Unauthorized
|
|
7
|
+
copying, distribution, modification, sublicensing, or use of this Software,
|
|
8
|
+
in whole or in part, is strictly prohibited.
|
|
9
|
+
|
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
12
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
13
|
+
WEBRIX LTD. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY ARISING
|
|
14
|
+
FROM THE USE OF THIS SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
# mcp-s-cli
|
|
2
|
+
|
|
3
|
+
A lightweight CLI for connecting AI agents to the [Webrix](https://webrix.ai) MCP Gateway — Webrix's enterprise-grade identity and access layer for AI agents.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Webrix's MCP Gateway is the secure connection layer between AI agents and your enterprise systems (GitHub, Slack, Jira, internal APIs, etc.). This CLI lets you interact with a single Webrix MCP server from your terminal or from inside AI coding agents (Claude, Cursor, Gemini CLI, etc.).
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Lightweight** — Minimal dependencies, fast startup
|
|
12
|
+
- **Shell-friendly** — JSON output for `call`, pipes with `jq`, chaining support
|
|
13
|
+
- **Agent-optimized** — Designed for AI coding agents (Claude Code, Cursor, Gemini CLI, etc.)
|
|
14
|
+
- **Secure** — Supports OAuth login and Bearer token auth to the Webrix Gateway
|
|
15
|
+
- **Connection pooling** — Lazy-spawn daemon keeps connections warm (configurable idle timeout)
|
|
16
|
+
- **Tool filtering** — Allow/disable specific tools via config
|
|
17
|
+
- **Actionable errors** — Structured error messages with recovery suggestions
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
### 1. Install
|
|
24
|
+
|
|
25
|
+
Requires [Node.js](https://nodejs.org/) >= 18.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install -g @mcp-s/cli
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Or run without installing:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx @mcp-s/cli
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 2. Initialize config with your Webrix Gateway URL
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Interactive setup (recommended)
|
|
41
|
+
mcp-s-cli init
|
|
42
|
+
|
|
43
|
+
# Or non-interactive: HTTP server with a Bearer token
|
|
44
|
+
mcp-s-cli init --base-url https://<your-org>.webrix.ai/mcp --token <your-token>
|
|
45
|
+
|
|
46
|
+
# Or: OAuth-based (run login after init)
|
|
47
|
+
mcp-s-cli init --base-url https://<your-org>.webrix.ai/mcp
|
|
48
|
+
mcp-s-cli login
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 3. Discover available tools
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# List all tools
|
|
55
|
+
mcp-s-cli
|
|
56
|
+
|
|
57
|
+
# With descriptions
|
|
58
|
+
mcp-s-cli -d
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 4. Call a tool
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# View tool schema first
|
|
65
|
+
mcp-s-cli info <tool_name>
|
|
66
|
+
|
|
67
|
+
# Call the tool
|
|
68
|
+
mcp-s-cli call <tool_name> '{"param": "value"}'
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Usage
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
mcp-s-cli [options] List all tools
|
|
77
|
+
mcp-s-cli [options] info Show server details
|
|
78
|
+
mcp-s-cli [options] info <tool> Show schema for a specific tool
|
|
79
|
+
mcp-s-cli [options] grep <pattern> Search tools by glob pattern
|
|
80
|
+
mcp-s-cli [options] call <tool> Call a tool (reads JSON args from stdin)
|
|
81
|
+
mcp-s-cli [options] call <tool> <json> Call a tool with inline JSON arguments
|
|
82
|
+
mcp-s-cli init [--org <org>] [--base-url <url>] [...] Initialize global config
|
|
83
|
+
mcp-s-cli whoami Show config location and auth state
|
|
84
|
+
mcp-s-cli login Log in to the configured server via OAuth
|
|
85
|
+
mcp-s-cli logout Remove stored OAuth tokens
|
|
86
|
+
mcp-s-cli clear Reset server config
|
|
87
|
+
mcp-s-cli clear-auth Remove all stored auth data
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
> **Tip:** Add `-d` to any command to include tool descriptions.
|
|
91
|
+
|
|
92
|
+
### Options
|
|
93
|
+
|
|
94
|
+
| Option | Description |
|
|
95
|
+
| ------------------------- | ------------------------------------- |
|
|
96
|
+
| `-h, --help` | Show help message |
|
|
97
|
+
| `-v, --version` | Show version number |
|
|
98
|
+
| `-d, --with-descriptions` | Include tool descriptions in output |
|
|
99
|
+
| `-c, --config <path>` | Path to a custom `config.json` config |
|
|
100
|
+
|
|
101
|
+
### Output streams
|
|
102
|
+
|
|
103
|
+
| Stream | Content |
|
|
104
|
+
| ---------- | -------------------------------------- |
|
|
105
|
+
| **stdout** | Tool results and human-readable output |
|
|
106
|
+
| **stderr** | Errors and diagnostics |
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Commands
|
|
111
|
+
|
|
112
|
+
### List Tools
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Basic listing
|
|
116
|
+
$ mcp-s-cli
|
|
117
|
+
server
|
|
118
|
+
• search_issues
|
|
119
|
+
• create_ticket
|
|
120
|
+
• list_channels
|
|
121
|
+
|
|
122
|
+
# With descriptions
|
|
123
|
+
$ mcp-s-cli -d
|
|
124
|
+
server
|
|
125
|
+
• search_issues - Search Jira issues by query
|
|
126
|
+
• create_ticket - Create a new Jira ticket
|
|
127
|
+
• list_channels - List Slack channels
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Search Tools
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Find tools matching a glob pattern
|
|
134
|
+
$ mcp-s-cli grep "*ticket*"
|
|
135
|
+
create_ticket
|
|
136
|
+
update_ticket
|
|
137
|
+
|
|
138
|
+
# With descriptions
|
|
139
|
+
$ mcp-s-cli grep "*search*" -d
|
|
140
|
+
search_issues - Search Jira issues by query
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### View Server Details
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
$ mcp-s-cli info
|
|
147
|
+
Server: server
|
|
148
|
+
Transport: http
|
|
149
|
+
URL: https://<your-org>.webrix.ai/mcp
|
|
150
|
+
|
|
151
|
+
Tools (12):
|
|
152
|
+
search_issues
|
|
153
|
+
Search Jira issues by query
|
|
154
|
+
Parameters:
|
|
155
|
+
• query (string, required) - JQL or natural language query
|
|
156
|
+
• limit (number, optional) - Max results
|
|
157
|
+
...
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### View Tool Schema
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
$ mcp-s-cli info search_issues
|
|
164
|
+
|
|
165
|
+
Tool: search_issues
|
|
166
|
+
Server: server
|
|
167
|
+
|
|
168
|
+
Description:
|
|
169
|
+
Search Jira issues by query
|
|
170
|
+
|
|
171
|
+
Input Schema:
|
|
172
|
+
{
|
|
173
|
+
"type": "object",
|
|
174
|
+
"properties": {
|
|
175
|
+
"query": { "type": "string", "description": "JQL or natural language query" },
|
|
176
|
+
"limit": { "type": "number" }
|
|
177
|
+
},
|
|
178
|
+
"required": ["query"]
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Call a Tool
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# With inline JSON
|
|
186
|
+
$ mcp-s-cli call search_issues '{"query": "bug in authentication", "limit": 5}'
|
|
187
|
+
|
|
188
|
+
# Pipe the JSON output
|
|
189
|
+
$ mcp-s-cli call search_issues '{"query": "open bugs"}' | jq '.content[0].text'
|
|
190
|
+
|
|
191
|
+
# Read JSON args from stdin (no '-' needed)
|
|
192
|
+
$ echo '{"query": "urgent"}' | mcp-s-cli call search_issues
|
|
193
|
+
|
|
194
|
+
# Heredoc for complex JSON
|
|
195
|
+
$ mcp-s-cli call create_ticket <<EOF
|
|
196
|
+
{"title": "Fix login bug", "description": "Users can't log in with SSO"}
|
|
197
|
+
EOF
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Initialize Global Config
|
|
201
|
+
|
|
202
|
+
Set up `~/.config/mcp-s-cli/config.json` with your Webrix MCP Gateway:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# Interactive (prompts for connection type, credentials)
|
|
206
|
+
mcp-s-cli init
|
|
207
|
+
|
|
208
|
+
# HTTP mode — derive URL from org name
|
|
209
|
+
mcp-s-cli init --org <your-org>
|
|
210
|
+
|
|
211
|
+
# HTTP mode — provide a custom base URL
|
|
212
|
+
mcp-s-cli init --base-url https://<your-org>.mcp-s.com/mcp
|
|
213
|
+
|
|
214
|
+
# HTTP mode with optional mcp/toolkit headers
|
|
215
|
+
mcp-s-cli init --org <your-org> --mcp slack --toolkit my-tk
|
|
216
|
+
|
|
217
|
+
# stdio mode — add a user access key (runs via npx @mcp-s/mcp)
|
|
218
|
+
mcp-s-cli init --org <your-org> --mcp slack --toolkit my-tk --user-access-key <key>
|
|
219
|
+
mcp-s-cli init --base-url example.com --mcp slack --user-access-key <key>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
| Option | Description |
|
|
223
|
+
| ------------------------- | -------------------------------------------------------------- |
|
|
224
|
+
| `--org <org>` | Org name — derives URL as `https://<org>.mcp-s.com/mcp` |
|
|
225
|
+
| `--base-url <url>` | Custom server URL |
|
|
226
|
+
| `--mcp <id>` | MCP identifier (sent as `x-mcp` header or `MCP` env var) |
|
|
227
|
+
| `--toolkit <name>` | Toolkit name (sent as `x-toolkit` header or `TOOLKIT` env var) |
|
|
228
|
+
| `--user-access-key <key>` | User access key — triggers stdio mode |
|
|
229
|
+
|
|
230
|
+
**Mode selection:**
|
|
231
|
+
|
|
232
|
+
- `--user-access-key` absent → **HTTP mode**: produces a `baseUrl` + optional headers config
|
|
233
|
+
- `--user-access-key` present → **stdio mode**: produces a stdio config running `npx -y @mcp-s/mcp` with env vars
|
|
234
|
+
|
|
235
|
+
Either `--org` or `--base-url` is required; they are mutually exclusive.
|
|
236
|
+
|
|
237
|
+
> **Note:** `init` overwrites the global config file. It is intended as a quick-start helper.
|
|
238
|
+
|
|
239
|
+
### Authentication
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
# Log in via OAuth (opens browser)
|
|
243
|
+
mcp-s-cli login
|
|
244
|
+
|
|
245
|
+
# Log out (removes stored tokens from auth.json)
|
|
246
|
+
mcp-s-cli logout
|
|
247
|
+
|
|
248
|
+
# Show current auth state and config location
|
|
249
|
+
mcp-s-cli whoami
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Maintenance
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
# Reset server config (sets config.json to {})
|
|
256
|
+
mcp-s-cli clear
|
|
257
|
+
|
|
258
|
+
# Remove all stored OAuth tokens (sets auth.json to {})
|
|
259
|
+
mcp-s-cli clear-auth
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Config File Format
|
|
265
|
+
|
|
266
|
+
The config file lives at `~/.config/mcp-s-cli/config.json` (or a custom path via `-c`/`MCP_CONFIG_PATH`).
|
|
267
|
+
|
|
268
|
+
```json
|
|
269
|
+
{
|
|
270
|
+
"baseUrl": "https://<your-org>.mcp-s.com/mcp",
|
|
271
|
+
"mcp": "slack",
|
|
272
|
+
"toolkit": "my-tk",
|
|
273
|
+
"token": "<bearer-token>"
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
For stdio mode (using a user access key):
|
|
278
|
+
|
|
279
|
+
```json
|
|
280
|
+
{
|
|
281
|
+
"baseUrl": "https://<your-org>.mcp-s.com/mcp",
|
|
282
|
+
"mcp": "slack",
|
|
283
|
+
"toolkit": "my-tk",
|
|
284
|
+
"userAccessKey": "<key>"
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**Fields:**
|
|
289
|
+
|
|
290
|
+
| Field | Description |
|
|
291
|
+
| --------------- | ---------------------------------------------------------- |
|
|
292
|
+
| `baseUrl` | MCP server URL (required for HTTP mode) |
|
|
293
|
+
| `mcp` | MCP identifier header / env var |
|
|
294
|
+
| `toolkit` | Toolkit name header / env var |
|
|
295
|
+
| `token` | Static Bearer token for HTTP auth |
|
|
296
|
+
| `userAccessKey` | User access key — triggers stdio mode via `npx @mcp-s/mcp` |
|
|
297
|
+
| `allowedTools` | Glob patterns of tools to allow (optional) |
|
|
298
|
+
| `disabledTools` | Glob patterns of tools to exclude (optional) |
|
|
299
|
+
|
|
300
|
+
Environment variable substitution is supported: `"token": "${MY_TOKEN}"`.
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## Working with Complex JSON Arguments
|
|
305
|
+
|
|
306
|
+
For arguments containing single quotes, special characters, or multi-line content, use stdin to avoid shell escaping issues:
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
# Heredoc (clean, no escaping needed)
|
|
310
|
+
mcp-s-cli call create_ticket <<EOF
|
|
311
|
+
{"title": "It's broken", "description": "User said \"it doesn't work\""}
|
|
312
|
+
EOF
|
|
313
|
+
|
|
314
|
+
# From a file
|
|
315
|
+
cat args.json | mcp-s-cli call some_tool
|
|
316
|
+
|
|
317
|
+
# Using jq to build the payload
|
|
318
|
+
jq -n '{query: "open bugs", assignee: "me"}' | mcp-s-cli call search_issues
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## Chaining and Scripting
|
|
324
|
+
|
|
325
|
+
Chain MCP calls using shell pipes and `jq`:
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
# Find issues and extract URLs
|
|
329
|
+
mcp-s-cli call search_issues '{"query": "priority: high"}' \
|
|
330
|
+
| jq -r '.content[0].text | fromjson | .issues[].url'
|
|
331
|
+
|
|
332
|
+
# Conditional: check something exists before acting on it
|
|
333
|
+
mcp-s-cli call list_channels '{}' \
|
|
334
|
+
| jq -e '.content[0].text | contains("engineering")' \
|
|
335
|
+
&& mcp-s-cli call post_message '{"channel": "engineering", "text": "Deploy complete"}'
|
|
336
|
+
|
|
337
|
+
# Error handling in scripts
|
|
338
|
+
if result=$(mcp-s-cli call get_config '{}' 2>/dev/null); then
|
|
339
|
+
echo "$result" | jq '.content[0].text | fromjson'
|
|
340
|
+
else
|
|
341
|
+
echo "Failed to fetch config"
|
|
342
|
+
fi
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
**Tips:**
|
|
346
|
+
|
|
347
|
+
- Use `jq -r` for raw string output (no surrounding quotes)
|
|
348
|
+
- Use `jq -e` for conditional checks (exits 1 if false/null)
|
|
349
|
+
- Use `2>/dev/null` to suppress errors when testing existence
|
|
350
|
+
- Use `jq -s '.'` to merge multiple JSON outputs into an array
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## Configuration
|
|
355
|
+
|
|
356
|
+
### Environment Variables
|
|
357
|
+
|
|
358
|
+
| Variable | Description | Default |
|
|
359
|
+
| -------------------- | ------------------------------------------------- | ------- |
|
|
360
|
+
| `MCP_DEBUG` | Enable debug output | `false` |
|
|
361
|
+
| `MCP_TIMEOUT` | Request timeout (seconds) | `1800` |
|
|
362
|
+
| `MCP_MAX_RETRIES` | Retry attempts for transient errors (0 = disable) | `3` |
|
|
363
|
+
| `MCP_RETRY_DELAY` | Base retry delay (milliseconds) | `1000` |
|
|
364
|
+
| `MCP_STRICT_ENV` | Error on missing `${VAR}` in config | `true` |
|
|
365
|
+
| `MCP_DAEMON` | Enable connection caching (daemon mode) | `true` |
|
|
366
|
+
| `MCP_DAEMON_TIMEOUT` | Idle timeout for cached connections (seconds) | `300` |
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## Using with AI Agents
|
|
371
|
+
|
|
372
|
+
`mcp-s-cli` is designed to give AI coding agents direct access to the Webrix MCP Gateway via the shell. Rather than loading full tool schemas into the agent's context window (which consumes thousands of tokens), the CLI lets agents discover and call tools on demand.
|
|
373
|
+
|
|
374
|
+
### System Prompt Integration
|
|
375
|
+
|
|
376
|
+
Add this to your AI agent's system prompt:
|
|
377
|
+
|
|
378
|
+
```xml
|
|
379
|
+
## MCP Tools (via Webrix Gateway)
|
|
380
|
+
|
|
381
|
+
You have access to enterprise tools through the Webrix MCP Gateway via the `mcp-s-cli` CLI.
|
|
382
|
+
|
|
383
|
+
Commands:
|
|
384
|
+
mcp-s-cli # List all tools
|
|
385
|
+
mcp-s-cli info # Show server details
|
|
386
|
+
mcp-s-cli info <tool> # Get tool schema
|
|
387
|
+
mcp-s-cli grep "<pattern>" # Search tools by name
|
|
388
|
+
mcp-s-cli call <tool> # Call tool (stdin for JSON args)
|
|
389
|
+
mcp-s-cli call <tool> '{}' # Call tool with inline JSON
|
|
390
|
+
|
|
391
|
+
Workflow:
|
|
392
|
+
1. Discover: `mcp-s-cli` to see available tools
|
|
393
|
+
2. Inspect: `mcp-s-cli info <tool>` to get the schema
|
|
394
|
+
3. Execute: `mcp-s-cli call <tool> '<json>'` with the required args
|
|
395
|
+
|
|
396
|
+
Examples:
|
|
397
|
+
mcp-s-cli call search_issues '{"query": "open bugs"}'
|
|
398
|
+
echo '{"query": "urgent"}' | mcp-s-cli call search_issues
|
|
399
|
+
mcp-s-cli call create_ticket <<EOF
|
|
400
|
+
{"title": "Bug", "description": "Details here"}
|
|
401
|
+
EOF
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### Agents Skill
|
|
405
|
+
|
|
406
|
+
For AI agents that support Skill files (Cursor, Gemini CLI, Claude Code, etc.), use the included `SKILL.md` in your skills directory for a ready-made integration.
|
|
407
|
+
|
|
408
|
+
### Common Errors
|
|
409
|
+
|
|
410
|
+
| Wrong command | Error code | Fix |
|
|
411
|
+
| ------------------------------ | -------------------- | ---------------------------------- |
|
|
412
|
+
| `mcp-s-cli run tool` | `UNKNOWN_SUBCOMMAND` | Use `call` |
|
|
413
|
+
| `mcp-s-cli list` | `UNKNOWN_SUBCOMMAND` | Use `mcp-s-cli` (no subcommand) |
|
|
414
|
+
| `mcp-s-cli call tool bad_json` | `INVALID_JSON_ARGS` | Use valid JSON: `'{"key": "val"}'` |
|
|
415
|
+
|
|
416
|
+
---
|
|
417
|
+
|
|
418
|
+
## Architecture
|
|
419
|
+
|
|
420
|
+
### Connection Model
|
|
421
|
+
|
|
422
|
+
Each CLI invocation connects to the single configured server.
|
|
423
|
+
|
|
424
|
+
| Command | Behaviour |
|
|
425
|
+
| ---------------------------- | --------------------------------- |
|
|
426
|
+
| `mcp-s-cli` (list all) | Connects to the configured server |
|
|
427
|
+
| `mcp-s-cli grep "<pattern>"` | Connects to the configured server |
|
|
428
|
+
| `mcp-s-cli info` | Connects to the configured server |
|
|
429
|
+
| `mcp-s-cli info <tool>` | Connects to the configured server |
|
|
430
|
+
| `mcp-s-cli call <tool> '{}'` | Connects to the configured server |
|
|
431
|
+
|
|
432
|
+
### Connection Pooling (Daemon)
|
|
433
|
+
|
|
434
|
+
Daemon mode is enabled by default. The daemon keeps the MCP server connection open for `MCP_DAEMON_TIMEOUT` seconds (default: 300s) after the last request, avoiding repeated startup latency on subsequent calls.
|
|
435
|
+
|
|
436
|
+
```bash
|
|
437
|
+
mcp-s-cli call some_tool '{}' # Uses cached connection (default)
|
|
438
|
+
MCP_DAEMON=0 mcp-s-cli info # Disable daemon, use a fresh connection
|
|
439
|
+
MCP_DEBUG=1 mcp-s-cli info # See connection debug output
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
With daemon disabled, each CLI call opens a fresh connection and closes it when done.
|
|
443
|
+
|
|
444
|
+
### Error Handling and Retry
|
|
445
|
+
|
|
446
|
+
The CLI automatically retries transient failures with exponential backoff.
|
|
447
|
+
|
|
448
|
+
**Retried automatically:** network errors (`ECONNREFUSED`, `ETIMEDOUT`, `ECONNRESET`), HTTP `429`, `502`, `503`, `504`
|
|
449
|
+
|
|
450
|
+
**Fail immediately:** config errors, auth errors (`401`, `403`), tool not found, invalid JSON
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
## Error Messages
|
|
455
|
+
|
|
456
|
+
All errors include actionable recovery suggestions, optimized for humans and AI agents alike:
|
|
457
|
+
|
|
458
|
+
```
|
|
459
|
+
Error [CONFIG_MISSING_FIELD]: Config file is missing required server fields
|
|
460
|
+
Suggestion: Config must have at least "baseUrl" (HTTP) or "userAccessKey" (stdio). Run mcp-s-cli init to set up.
|
|
461
|
+
|
|
462
|
+
Error [TOOL_NOT_FOUND]: Tool "search" not found in server "server"
|
|
463
|
+
Details: Available tools: search_issues, create_ticket, list_channels (+5 more)
|
|
464
|
+
Suggestion: Run 'mcp-s-cli' to see all available tools
|
|
465
|
+
|
|
466
|
+
Error [INVALID_JSON_ARGUMENTS]: Invalid JSON in tool arguments
|
|
467
|
+
Details: Parse error: Unexpected identifier "test"
|
|
468
|
+
Suggestion: Arguments must be valid JSON. Use single quotes: '{"key": "value"}'
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
## License
|
|
474
|
+
|
|
475
|
+
MIT License — see [LICENSE](LICENSE) for details.
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mcp-s-cli
|
|
3
|
+
description: Interface for MCP (Model Context Protocol) servers via CLI. Use when you need to interact with external tools, APIs, or data sources through MCP servers.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# mcp-s-cli
|
|
7
|
+
|
|
8
|
+
Access a single MCP server through the command line. MCP enables interaction with external systems like GitHub, filesystems, databases, and APIs.
|
|
9
|
+
|
|
10
|
+
## Commands
|
|
11
|
+
|
|
12
|
+
| Command | Output |
|
|
13
|
+
| -------------------------------- | -------------------------------------------- |
|
|
14
|
+
| `mcp-s-cli` | List all available tools |
|
|
15
|
+
| `mcp-s-cli info` | Show server details |
|
|
16
|
+
| `mcp-s-cli info <tool>` | Get tool JSON schema |
|
|
17
|
+
| `mcp-s-cli grep "<pattern>"` | Search tools by name |
|
|
18
|
+
| `mcp-s-cli call <tool>` | Call tool (reads JSON from stdin if no args) |
|
|
19
|
+
| `mcp-s-cli call <tool> '<json>'` | Call tool with arguments |
|
|
20
|
+
|
|
21
|
+
## Workflow
|
|
22
|
+
|
|
23
|
+
1. **Discover**: `mcp-s-cli` → see all available tools
|
|
24
|
+
2. **Inspect**: `mcp-s-cli info <tool>` → get full JSON schema
|
|
25
|
+
3. **Execute**: `mcp-s-cli call <tool> '<json>'` → run with arguments
|
|
26
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# List all tools
|
|
31
|
+
mcp-s-cli
|
|
32
|
+
|
|
33
|
+
# With descriptions
|
|
34
|
+
mcp-s-cli -d
|
|
35
|
+
|
|
36
|
+
# Show server details
|
|
37
|
+
mcp-s-cli info
|
|
38
|
+
|
|
39
|
+
# Get tool schema
|
|
40
|
+
mcp-s-cli info read_file
|
|
41
|
+
|
|
42
|
+
# Call tool
|
|
43
|
+
mcp-s-cli call read_file '{"path": "./README.md"}'
|
|
44
|
+
|
|
45
|
+
# Pipe from stdin (no '-' needed!)
|
|
46
|
+
cat args.json | mcp-s-cli call read_file
|
|
47
|
+
|
|
48
|
+
# Search for tools
|
|
49
|
+
mcp-s-cli grep "*file*"
|
|
50
|
+
|
|
51
|
+
# Output is raw text (pipe-friendly)
|
|
52
|
+
mcp-s-cli call read_file '{"path": "./file"}' | head -10
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Advanced Chaining
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Chain: search files → read first match
|
|
59
|
+
mcp-s-cli call search_files '{"path": ".", "pattern": "*.md"}' \
|
|
60
|
+
| head -1 \
|
|
61
|
+
| xargs -I {} mcp-s-cli call read_file '{"path": "{}"}'
|
|
62
|
+
|
|
63
|
+
# Loop: process multiple files
|
|
64
|
+
mcp-s-cli call list_directory '{"path": "./src"}' \
|
|
65
|
+
| while read f; do mcp-s-cli call read_file "{\"path\": \"$f\"}"; done
|
|
66
|
+
|
|
67
|
+
# Save to file
|
|
68
|
+
mcp-s-cli call get_file_contents '{"owner": "x", "repo": "y", "path": "z"}' > output.txt
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Note:** `call` outputs raw text content directly (no jq needed for text extraction)
|
|
72
|
+
|
|
73
|
+
## Options
|
|
74
|
+
|
|
75
|
+
| Flag | Purpose |
|
|
76
|
+
| ----------- | -------------------- |
|
|
77
|
+
| `-d` | Include descriptions |
|
|
78
|
+
| `-c <path>` | Specify config file |
|
|
79
|
+
|
|
80
|
+
## Config
|
|
81
|
+
|
|
82
|
+
The config file (`~/.config/mcp-s-cli/config.json`) uses a flat structure:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{ "org": "myorg" }
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
This derives the server URL as `https://myorg.mcp-s.com/mcp`. Alternatively, use `baseUrl` for a custom URL, or `userAccessKey` for stdio mode.
|
|
89
|
+
|
|
90
|
+
## Common Errors
|
|
91
|
+
|
|
92
|
+
| Wrong Command | Error | Fix |
|
|
93
|
+
| --------------------------- | ------------------ | -------------------------------------- |
|
|
94
|
+
| `mcp-s-cli run tool` | UNKNOWN_SUBCOMMAND | Use `call` instead of `run` |
|
|
95
|
+
| `mcp-s-cli call` | MISSING_ARGUMENT | Add tool name |
|
|
96
|
+
| `mcp-s-cli call tool {bad}` | INVALID_JSON | Use valid JSON with quoted string keys |
|
|
97
|
+
|
|
98
|
+
## Exit Codes
|
|
99
|
+
|
|
100
|
+
- `0`: Success
|
|
101
|
+
- `1`: Client error (bad args, missing config)
|
|
102
|
+
- `2`: Server error (tool failed)
|
|
103
|
+
- `3`: Network error
|
package/dist/SKILL.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mcp-s-cli
|
|
3
|
+
description: Interface for MCP (Model Context Protocol) servers via CLI. Use when you need to interact with external tools, APIs, or data sources through MCP servers.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# mcp-s-cli
|
|
7
|
+
|
|
8
|
+
Access a single MCP server through the command line. MCP enables interaction with external systems like GitHub, filesystems, databases, and APIs.
|
|
9
|
+
|
|
10
|
+
## Commands
|
|
11
|
+
|
|
12
|
+
| Command | Output |
|
|
13
|
+
| -------------------------------- | -------------------------------------------- |
|
|
14
|
+
| `mcp-s-cli` | List all available tools |
|
|
15
|
+
| `mcp-s-cli info` | Show server details |
|
|
16
|
+
| `mcp-s-cli info <tool>` | Get tool JSON schema |
|
|
17
|
+
| `mcp-s-cli grep "<pattern>"` | Search tools by name |
|
|
18
|
+
| `mcp-s-cli call <tool>` | Call tool (reads JSON from stdin if no args) |
|
|
19
|
+
| `mcp-s-cli call <tool> '<json>'` | Call tool with arguments |
|
|
20
|
+
|
|
21
|
+
## Workflow
|
|
22
|
+
|
|
23
|
+
1. **Discover**: `mcp-s-cli` → see all available tools
|
|
24
|
+
2. **Inspect**: `mcp-s-cli info <tool>` → get full JSON schema
|
|
25
|
+
3. **Execute**: `mcp-s-cli call <tool> '<json>'` → run with arguments
|
|
26
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# List all tools
|
|
31
|
+
mcp-s-cli
|
|
32
|
+
|
|
33
|
+
# With descriptions
|
|
34
|
+
mcp-s-cli -d
|
|
35
|
+
|
|
36
|
+
# Show server details
|
|
37
|
+
mcp-s-cli info
|
|
38
|
+
|
|
39
|
+
# Get tool schema
|
|
40
|
+
mcp-s-cli info read_file
|
|
41
|
+
|
|
42
|
+
# Call tool
|
|
43
|
+
mcp-s-cli call read_file '{"path": "./README.md"}'
|
|
44
|
+
|
|
45
|
+
# Pipe from stdin (no '-' needed!)
|
|
46
|
+
cat args.json | mcp-s-cli call read_file
|
|
47
|
+
|
|
48
|
+
# Search for tools
|
|
49
|
+
mcp-s-cli grep "*file*"
|
|
50
|
+
|
|
51
|
+
# Output is raw text (pipe-friendly)
|
|
52
|
+
mcp-s-cli call read_file '{"path": "./file"}' | head -10
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Advanced Chaining
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Chain: search files → read first match
|
|
59
|
+
mcp-s-cli call search_files '{"path": ".", "pattern": "*.md"}' \
|
|
60
|
+
| head -1 \
|
|
61
|
+
| xargs -I {} mcp-s-cli call read_file '{"path": "{}"}'
|
|
62
|
+
|
|
63
|
+
# Loop: process multiple files
|
|
64
|
+
mcp-s-cli call list_directory '{"path": "./src"}' \
|
|
65
|
+
| while read f; do mcp-s-cli call read_file "{\"path\": \"$f\"}"; done
|
|
66
|
+
|
|
67
|
+
# Save to file
|
|
68
|
+
mcp-s-cli call get_file_contents '{"owner": "x", "repo": "y", "path": "z"}' > output.txt
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Note:** `call` outputs raw text content directly (no jq needed for text extraction)
|
|
72
|
+
|
|
73
|
+
## Options
|
|
74
|
+
|
|
75
|
+
| Flag | Purpose |
|
|
76
|
+
| ----------- | -------------------- |
|
|
77
|
+
| `-d` | Include descriptions |
|
|
78
|
+
| `-c <path>` | Specify config file |
|
|
79
|
+
|
|
80
|
+
## Config
|
|
81
|
+
|
|
82
|
+
The config file (`~/.config/mcp-s-cli/config.json`) uses a flat structure:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{ "org": "myorg" }
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
This derives the server URL as `https://myorg.mcp-s.com/mcp`. Alternatively, use `baseUrl` for a custom URL, or `userAccessKey` for stdio mode.
|
|
89
|
+
|
|
90
|
+
## Common Errors
|
|
91
|
+
|
|
92
|
+
| Wrong Command | Error | Fix |
|
|
93
|
+
| --------------------------- | ------------------ | -------------------------------------- |
|
|
94
|
+
| `mcp-s-cli run tool` | UNKNOWN_SUBCOMMAND | Use `call` instead of `run` |
|
|
95
|
+
| `mcp-s-cli call` | MISSING_ARGUMENT | Add tool name |
|
|
96
|
+
| `mcp-s-cli call tool {bad}` | INVALID_JSON | Use valid JSON with quoted string keys |
|
|
97
|
+
|
|
98
|
+
## Exit Codes
|
|
99
|
+
|
|
100
|
+
- `0`: Success
|
|
101
|
+
- `1`: Client error (bad args, missing config)
|
|
102
|
+
- `2`: Server error (tool failed)
|
|
103
|
+
- `3`: Network error
|