@mcp-s/cli 0.0.12 → 0.0.14

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 CHANGED
@@ -76,7 +76,7 @@ mcp-s-cli call <tool_name> '{"param": "value"}'
76
76
  mcp-s-cli [options] List all tools
77
77
  mcp-s-cli [options] info Show server details
78
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
79
+ mcp-s-cli [options] grep <query> Search tools by name
80
80
  mcp-s-cli [options] call <tool> Call a tool (reads JSON args from stdin)
81
81
  mcp-s-cli [options] call <tool> <json> Call a tool with inline JSON arguments
82
82
  mcp-s-cli init [--org <org>] [--base-url <url>] [...] Initialize global config
@@ -130,13 +130,13 @@ server
130
130
  ### Search Tools
131
131
 
132
132
  ```bash
133
- # Find tools matching a glob pattern
134
- $ mcp-s-cli grep "*ticket*"
133
+ # Find tools by name (case-insensitive substring match)
134
+ $ mcp-s-cli grep ticket
135
135
  create_ticket
136
136
  update_ticket
137
137
 
138
138
  # With descriptions
139
- $ mcp-s-cli grep "*search*" -d
139
+ $ mcp-s-cli grep search -d
140
140
  search_issues - Search Jira issues by query
141
141
  ```
142
142
 
@@ -406,7 +406,7 @@ Commands:
406
406
  mcp-s-cli # List all tools
407
407
  mcp-s-cli info # Show server details
408
408
  mcp-s-cli info <tool> # Get tool schema
409
- mcp-s-cli grep "<pattern>" # Search tools by name
409
+ mcp-s-cli grep <query> # Search tools by name
410
410
  mcp-s-cli call <tool> # Call tool (stdin for JSON args)
411
411
  mcp-s-cli call <tool> '{}' # Call tool with inline JSON
412
412
 
@@ -446,7 +446,7 @@ Each CLI invocation connects to the single configured server.
446
446
  | Command | Behaviour |
447
447
  | ---------------------------- | --------------------------------- |
448
448
  | `mcp-s-cli` (list all) | Connects to the configured server |
449
- | `mcp-s-cli grep "<pattern>"` | Connects to the configured server |
449
+ | `mcp-s-cli grep <query>` | Connects to the configured server |
450
450
  | `mcp-s-cli info` | Connects to the configured server |
451
451
  | `mcp-s-cli info <tool>` | Connects to the configured server |
452
452
  | `mcp-s-cli call <tool> '{}'` | Connects to the configured server |
package/SKILL.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
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.
3
+ description: Use when you need to interact with external tools, APIs, or data sources through MCP servers.
4
4
  ---
5
5
 
6
6
  # mcp-s-cli
@@ -9,17 +9,17 @@ Access a single MCP server through the command line. MCP enables interaction wit
9
9
 
10
10
  ## Commands
11
11
 
12
- | Command | Output |
13
- | -------------------------------- | --------------------------------------------------- |
14
- | `mcp-s-cli` | List all available tools |
15
- | `mcp-s-cli info <tool>` | Get tool JSON schema |
16
- | `mcp-s-cli grep "<pattern>"` | Search tools by name (names only, not descriptions) |
17
- | `mcp-s-cli call <tool>` | Call tool (reads JSON from stdin if no args) |
18
- | `mcp-s-cli call <tool> '<json>'` | Call tool with arguments |
12
+ | Command | Output |
13
+ | -------------------------------- | ------------------------------------------------- |
14
+ | `mcp-s-cli` | List all available tools |
15
+ | `mcp-s-cli info <tool>` | Get tool JSON schema |
16
+ | `mcp-s-cli grep <query>` | Search tools by name (case-insensitive substring) |
17
+ | `mcp-s-cli call <tool>` | Call tool (reads JSON from stdin if no args) |
18
+ | `mcp-s-cli call <tool> '<json>'` | Call tool with arguments |
19
19
 
20
20
  ## Workflow
21
21
 
22
- 1. **Discover**: `mcp-s-cli grep "<pattern>"` → find tools by keyword; fall back to `mcp-s-cli` only when you need a full inventory
22
+ 1. **Discover**: `mcp-s-cli grep <query>` → find tools by keyword; fall back to `mcp-s-cli` only when you need a full inventory
23
23
  2. **Inspect**: `mcp-s-cli info <tool>` → get full JSON schema
24
24
  3. **Execute**: `mcp-s-cli call <tool> '<json>'` → run with arguments
25
25
 
@@ -29,7 +29,7 @@ Every command consumes tokens. Pick the cheapest operation that gets the job don
29
29
 
30
30
  ### Discovery: start narrow
31
31
 
32
- - **`grep "<pattern>"`** — cheapest. Use when you can guess a keyword from the user's request (e.g., "read a github file" → `grep "file"` or `grep "content"`).
32
+ - **`grep <query>`** — cheapest. Use when you can guess a keyword from the user's request (e.g., "read a github file" → `grep file` or `grep content`).
33
33
  - **`mcp-s-cli`** (names only) — moderate. Use when you need a full inventory (e.g., "what tools do I have?" or "analyze logs from all tools").
34
34
  - **`mcp-s-cli -d`** (names + descriptions) — most expensive. Use only when names alone aren't enough to pick the right tool.
35
35
 
@@ -45,7 +45,7 @@ Every command consumes tokens. Pick the cheapest operation that gets the job don
45
45
 
46
46
  When you pipe through a filter and get empty output, **do not** fall back to the raw unfiltered call. Use the **probe-then-filter** pattern:
47
47
 
48
- 1. **Probe**: fetch a *single* item (e.g., `limit: 1`, or a dedicated get-one tool) without any pipe.
48
+ 1. **Probe**: fetch a _single_ item (e.g., `limit: 1`, or a dedicated get-one tool) without any pipe.
49
49
  2. **Learn**: read the response to understand the actual field names, nesting, and types.
50
50
  3. **Re-run**: call the bulk tool again with a corrected filter based on what you learned.
51
51
 
@@ -76,7 +76,7 @@ mcp-s-cli call my-tool '{"arg-name": "arg-value"}'
76
76
  cat args.json | mcp-s-cli call my-tool
77
77
 
78
78
  # Search for tools
79
- mcp-s-cli grep "*file*"
79
+ mcp-s-cli grep file
80
80
 
81
81
  # Output is raw text (pipe-friendly)
82
82
  mcp-s-cli call read_file '{"path": "./file"}' | head -10
package/dist/SKILL.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
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.
3
+ description: Use when you need to interact with external tools, APIs, or data sources through MCP servers.
4
4
  ---
5
5
 
6
6
  # mcp-s-cli
@@ -9,17 +9,17 @@ Access a single MCP server through the command line. MCP enables interaction wit
9
9
 
10
10
  ## Commands
11
11
 
12
- | Command | Output |
13
- | -------------------------------- | --------------------------------------------------- |
14
- | `mcp-s-cli` | List all available tools |
15
- | `mcp-s-cli info <tool>` | Get tool JSON schema |
16
- | `mcp-s-cli grep "<pattern>"` | Search tools by name (names only, not descriptions) |
17
- | `mcp-s-cli call <tool>` | Call tool (reads JSON from stdin if no args) |
18
- | `mcp-s-cli call <tool> '<json>'` | Call tool with arguments |
12
+ | Command | Output |
13
+ | -------------------------------- | ------------------------------------------------- |
14
+ | `mcp-s-cli` | List all available tools |
15
+ | `mcp-s-cli info <tool>` | Get tool JSON schema |
16
+ | `mcp-s-cli grep <query>` | Search tools by name (case-insensitive substring) |
17
+ | `mcp-s-cli call <tool>` | Call tool (reads JSON from stdin if no args) |
18
+ | `mcp-s-cli call <tool> '<json>'` | Call tool with arguments |
19
19
 
20
20
  ## Workflow
21
21
 
22
- 1. **Discover**: `mcp-s-cli grep "<pattern>"` → find tools by keyword; fall back to `mcp-s-cli` only when you need a full inventory
22
+ 1. **Discover**: `mcp-s-cli grep <query>` → find tools by keyword; fall back to `mcp-s-cli` only when you need a full inventory
23
23
  2. **Inspect**: `mcp-s-cli info <tool>` → get full JSON schema
24
24
  3. **Execute**: `mcp-s-cli call <tool> '<json>'` → run with arguments
25
25
 
@@ -29,7 +29,7 @@ Every command consumes tokens. Pick the cheapest operation that gets the job don
29
29
 
30
30
  ### Discovery: start narrow
31
31
 
32
- - **`grep "<pattern>"`** — cheapest. Use when you can guess a keyword from the user's request (e.g., "read a github file" → `grep "file"` or `grep "content"`).
32
+ - **`grep <query>`** — cheapest. Use when you can guess a keyword from the user's request (e.g., "read a github file" → `grep file` or `grep content`).
33
33
  - **`mcp-s-cli`** (names only) — moderate. Use when you need a full inventory (e.g., "what tools do I have?" or "analyze logs from all tools").
34
34
  - **`mcp-s-cli -d`** (names + descriptions) — most expensive. Use only when names alone aren't enough to pick the right tool.
35
35
 
@@ -45,7 +45,7 @@ Every command consumes tokens. Pick the cheapest operation that gets the job don
45
45
 
46
46
  When you pipe through a filter and get empty output, **do not** fall back to the raw unfiltered call. Use the **probe-then-filter** pattern:
47
47
 
48
- 1. **Probe**: fetch a *single* item (e.g., `limit: 1`, or a dedicated get-one tool) without any pipe.
48
+ 1. **Probe**: fetch a _single_ item (e.g., `limit: 1`, or a dedicated get-one tool) without any pipe.
49
49
  2. **Learn**: read the response to understand the actual field names, nesting, and types.
50
50
  3. **Re-run**: call the bulk tool again with a corrected filter based on what you learned.
51
51
 
@@ -76,7 +76,7 @@ mcp-s-cli call my-tool '{"arg-name": "arg-value"}'
76
76
  cat args.json | mcp-s-cli call my-tool
77
77
 
78
78
  # Search for tools
79
- mcp-s-cli grep "*file*"
79
+ mcp-s-cli grep file
80
80
 
81
81
  # Output is raw text (pipe-friendly)
82
82
  mcp-s-cli call read_file '{"path": "./file"}' | head -10
package/dist/daemon.js CHANGED
@@ -414,7 +414,7 @@ import { join as join2 } from "path";
414
414
  import { fileURLToPath } from "url";
415
415
 
416
416
  // src/version.ts
417
- var VERSION = "0.0.12";
417
+ var VERSION = "0.0.14";
418
418
 
419
419
  // src/client.ts
420
420
  function getRetryConfig(settings) {
package/dist/index.js CHANGED
@@ -1298,7 +1298,7 @@ async function cleanupOrphanedDaemons() {
1298
1298
  }
1299
1299
 
1300
1300
  // src/version.ts
1301
- var VERSION = "0.0.12";
1301
+ var VERSION = "0.0.14";
1302
1302
 
1303
1303
  // src/client.ts
1304
1304
  function getRetryConfig(settings) {
@@ -2183,32 +2183,8 @@ function configCommand(opts) {
2183
2183
  }
2184
2184
 
2185
2185
  // src/commands/grep.ts
2186
- function globToRegex(pattern) {
2187
- let escaped = "";
2188
- let i = 0;
2189
- while (i < pattern.length) {
2190
- const char = pattern[i];
2191
- if (char === "*" && pattern[i + 1] === "*") {
2192
- escaped += ".*";
2193
- i += 2;
2194
- while (pattern[i] === "*") {
2195
- i++;
2196
- }
2197
- } else if (char === "*") {
2198
- escaped += "[^/]*";
2199
- i += 1;
2200
- } else if (char === "?") {
2201
- escaped += "[^/]";
2202
- i += 1;
2203
- } else if ("[.+^${}()|\\]".includes(char)) {
2204
- escaped += `\\${char}`;
2205
- i += 1;
2206
- } else {
2207
- escaped += char;
2208
- i += 1;
2209
- }
2210
- }
2211
- return new RegExp(`^${escaped}$`, "i");
2186
+ function matchesToolName(name, query) {
2187
+ return name.toLowerCase().includes(query.toLowerCase());
2212
2188
  }
2213
2189
  async function grepCommand(options) {
2214
2190
  let loaded;
@@ -2220,8 +2196,7 @@ async function grepCommand(options) {
2220
2196
  }
2221
2197
  const { serverConfig, settings } = loaded;
2222
2198
  const serverLabel = "server";
2223
- const pattern = globToRegex(options.pattern);
2224
- debug(`Searching for pattern "${options.pattern}"`);
2199
+ debug(`Searching for "${options.pattern}"`);
2225
2200
  let connection = null;
2226
2201
  const allResults = [];
2227
2202
  let searchError;
@@ -2229,7 +2204,7 @@ async function grepCommand(options) {
2229
2204
  connection = await getConnection(serverLabel, serverConfig, settings);
2230
2205
  const tools = await connection.listTools();
2231
2206
  for (const tool of tools) {
2232
- if (pattern.test(tool.name)) {
2207
+ if (matchesToolName(tool.name, options.pattern)) {
2233
2208
  allResults.push({ server: serverLabel, tool });
2234
2209
  }
2235
2210
  }
@@ -2247,8 +2222,9 @@ async function grepCommand(options) {
2247
2222
  }
2248
2223
  if (allResults.length === 0) {
2249
2224
  console.log(`No tools found matching "${options.pattern}"`);
2250
- console.log(" Tip: Pattern matches tool names only");
2251
- console.log(` Tip: Use '*' for wildcards, e.g. '*file*' or 'read_*'`);
2225
+ console.log(
2226
+ " Tip: Search matches tool names only (substring, case-insensitive)"
2227
+ );
2252
2228
  console.log(` Tip: Run 'mcp-s-cli' to list all available tools`);
2253
2229
  return;
2254
2230
  }
@@ -2538,12 +2514,20 @@ function getSkillInstallInfo() {
2538
2514
  // src/commands/login.ts
2539
2515
  async function loginCommand(options) {
2540
2516
  const { configPath } = options;
2541
- const { serverConfig } = await loadConfig(configPath);
2517
+ const { raw, serverConfig } = await loadConfig(configPath);
2542
2518
  if (!isHttpServer(serverConfig)) {
2543
2519
  throw new Error(
2544
2520
  "Current server is a stdio server. OAuth login is only supported for HTTP servers."
2545
2521
  );
2546
2522
  }
2523
+ const THREE_HOURS_MS = 3 * 60 * 60 * 1e3;
2524
+ const storedTokens = await getStoredTokens(serverConfig.url);
2525
+ const expiredAt = storedTokens?.access_token_expired_at;
2526
+ const displayName = raw.org ?? serverConfig.url;
2527
+ if (expiredAt && expiredAt - Date.now() > THREE_HOURS_MS) {
2528
+ console.log(`Logged in to ${displayName}.`);
2529
+ return;
2530
+ }
2547
2531
  const resourceMetadataUrl = `${new URL(serverConfig.url).origin}/.well-known/oauth-protected-resource`;
2548
2532
  const resourceMetadata = await fetchProtectedResourceMetadata(resourceMetadataUrl);
2549
2533
  if (!resourceMetadata?.authorization_servers?.[0]) {
@@ -2553,12 +2537,12 @@ async function loginCommand(options) {
2553
2537
  }
2554
2538
  const authServerUrl = resourceMetadata.authorization_servers[0];
2555
2539
  const resourceUrl = resourceMetadata.resource;
2556
- console.error(`Logging in to ${serverConfig.url}...`);
2540
+ console.error(`Logging in to ${displayName}...`);
2557
2541
  const tokens = await performOAuthFlow(authServerUrl, resourceUrl);
2558
2542
  if (!tokens) {
2559
2543
  throw new Error("Login failed. OAuth flow did not return tokens.");
2560
2544
  }
2561
- console.log(`Logged in to ${serverConfig.url} successfully.`);
2545
+ console.log(`Logged in to ${displayName} successfully.`);
2562
2546
  }
2563
2547
 
2564
2548
  // src/commands/init.ts
@@ -3313,7 +3297,7 @@ Usage:
3313
3297
  mcp-s-cli [options] List all tools
3314
3298
  mcp-s-cli [options] info Show server details
3315
3299
  mcp-s-cli [options] info <tool> Show tool schema
3316
- mcp-s-cli [options] grep <pattern> Search tools by glob pattern
3300
+ mcp-s-cli [options] grep <query> Search tools by name
3317
3301
  mcp-s-cli [options] call <tool> Call tool (reads JSON from stdin if no args)
3318
3302
  mcp-s-cli [options] call <tool> <json> Call tool with JSON arguments
3319
3303
  mcp-s-cli init --org <org> [--mcp <id>] [--toolkit <tk>] [--user-access-key <key>] Initialize with org
@@ -3344,14 +3328,14 @@ Options:
3344
3328
  --user-access-key <key> User access key \u2014 triggers stdio mode (used with init)
3345
3329
 
3346
3330
  Output:
3347
- mcp-s-cli/info/grep Human-readable text to stdout
3331
+ mcp-s-cli/info/grep Human-readable text to stdout
3348
3332
  call Raw JSON to stdout (for piping)
3349
3333
  Errors Always to stderr
3350
3334
 
3351
3335
  Examples:
3352
3336
  mcp-s-cli # List all tools
3353
3337
  mcp-s-cli -d # List with descriptions
3354
- mcp-s-cli grep "*file*" # Search for file tools
3338
+ mcp-s-cli grep file # Search for file tools
3355
3339
  mcp-s-cli info # Show server details
3356
3340
  mcp-s-cli info read_file # Show tool schema
3357
3341
  mcp-s-cli call read_file '{}' # Call tool
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-s/cli",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "A lightweight CLI for connecting AI agents to the Webrix MCP Gateway",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",