mcp-cli-skill 0.4.8__tar.gz → 0.5.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-cli-skill
3
- Version: 0.4.8
3
+ Version: 0.5.0
4
4
  Summary: Call any MCP server tool from the command line with shell composition support
5
5
  Project-URL: Homepage, https://github.com/wise-toddler/mcp-cli-skill
6
6
  Project-URL: Repository, https://github.com/wise-toddler/mcp-cli-skill
@@ -54,6 +54,20 @@ mcp-call --remove myserver
54
54
  mcp-call --sync # re-sync from Claude configs
55
55
  ```
56
56
 
57
+ ### Environment variables
58
+
59
+ `${VAR}` patterns in URLs, headers, command args, and env values are expanded at runtime:
60
+
61
+ ```json
62
+ {
63
+ "myapi": {
64
+ "type": "http",
65
+ "url": "https://${API_HOST}/mcp",
66
+ "headers": { "X-API-Key": "${MY_API_KEY}" }
67
+ }
68
+ }
69
+ ```
70
+
57
71
  ## Why?
58
72
 
59
73
  MCP tool calls can't use shell composition. This CLI lets agents (or you) use:
@@ -38,6 +38,20 @@ mcp-call --remove myserver
38
38
  mcp-call --sync # re-sync from Claude configs
39
39
  ```
40
40
 
41
+ ### Environment variables
42
+
43
+ `${VAR}` patterns in URLs, headers, command args, and env values are expanded at runtime:
44
+
45
+ ```json
46
+ {
47
+ "myapi": {
48
+ "type": "http",
49
+ "url": "https://${API_HOST}/mcp",
50
+ "headers": { "X-API-Key": "${MY_API_KEY}" }
51
+ }
52
+ }
53
+ ```
54
+
41
55
  ## Why?
42
56
 
43
57
  MCP tool calls can't use shell composition. This CLI lets agents (or you) use:
@@ -7,7 +7,8 @@ description: Call any MCP server tool as a CLI command with shell composition. U
7
7
 
8
8
  Call any configured MCP server tool from the command line with `--flag=value` style args and full shell composition support.
9
9
 
10
- If `mcp-call` is not found, install it: `pipx install mcp-cli-skill` or `uvx mcp-cli-skill`
10
+ If `mcp-call` is not found, install it first: `uv tool install mcp-cli-skill`
11
+ Always use `mcp-call` as the command, never `uvx mcp-cli-skill`.
11
12
 
12
13
  ## Commands
13
14
 
@@ -6,6 +6,7 @@ import os
6
6
  import subprocess
7
7
  import sys
8
8
  import tempfile
9
+ import re
9
10
  import urllib.request
10
11
  import urllib.error
11
12
 
@@ -193,15 +194,20 @@ def _print_content(items):
193
194
  print(path)
194
195
 
195
196
 
197
+ def _expand_env(val):
198
+ """Expand ${VAR} patterns in a string using env variables."""
199
+ return re.sub(r'\$\{(\w+)\}', lambda m: os.environ.get(m.group(1), m.group(0)), val)
200
+
201
+
196
202
  # --- HTTP transport ---
197
203
 
198
204
  class HttpSession:
199
205
  """Manages HTTP MCP session with session ID tracking."""
200
206
 
201
207
  def __init__(self, url, extra_headers=None):
202
- self.url = url
208
+ self.url = _expand_env(url)
203
209
  self.session_id = None
204
- self.extra_headers = extra_headers or {}
210
+ self.extra_headers = {k: _expand_env(v) for k, v in (extra_headers or {}).items()}
205
211
 
206
212
  def rpc(self, method, params=None, msg_id=1):
207
213
  """Send JSON-RPC over HTTP and return response."""
@@ -333,8 +339,8 @@ def recv(proc, expected_id=None):
333
339
 
334
340
  def spawn_server(config):
335
341
  """Spawn MCP server subprocess."""
336
- cmd = [config["command"]] + config.get("args", [])
337
- env = {**os.environ, **config.get("env", {})}
342
+ cmd = [_expand_env(config["command"])] + [_expand_env(a) for a in config.get("args", [])]
343
+ env = {**os.environ, **{k: _expand_env(v) for k, v in config.get("env", {}).items()}}
338
344
  return subprocess.Popen(
339
345
  cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
340
346
  stderr=subprocess.PIPE, text=True, env=env
@@ -1,2 +1,2 @@
1
1
  """MCP CLI - Call any MCP server tool from the command line."""
2
- __version__ = "0.4.8"
2
+ __version__ = "0.5.0"
@@ -6,6 +6,7 @@ import os
6
6
  import subprocess
7
7
  import sys
8
8
  import tempfile
9
+ import re
9
10
  import urllib.request
10
11
  import urllib.error
11
12
 
@@ -193,15 +194,20 @@ def _print_content(items):
193
194
  print(path)
194
195
 
195
196
 
197
+ def _expand_env(val):
198
+ """Expand ${VAR} patterns in a string using env variables."""
199
+ return re.sub(r'\$\{(\w+)\}', lambda m: os.environ.get(m.group(1), m.group(0)), val)
200
+
201
+
196
202
  # --- HTTP transport ---
197
203
 
198
204
  class HttpSession:
199
205
  """Manages HTTP MCP session with session ID tracking."""
200
206
 
201
207
  def __init__(self, url, extra_headers=None):
202
- self.url = url
208
+ self.url = _expand_env(url)
203
209
  self.session_id = None
204
- self.extra_headers = extra_headers or {}
210
+ self.extra_headers = {k: _expand_env(v) for k, v in (extra_headers or {}).items()}
205
211
 
206
212
  def rpc(self, method, params=None, msg_id=1):
207
213
  """Send JSON-RPC over HTTP and return response."""
@@ -333,8 +339,8 @@ def recv(proc, expected_id=None):
333
339
 
334
340
  def spawn_server(config):
335
341
  """Spawn MCP server subprocess."""
336
- cmd = [config["command"]] + config.get("args", [])
337
- env = {**os.environ, **config.get("env", {})}
342
+ cmd = [_expand_env(config["command"])] + [_expand_env(a) for a in config.get("args", [])]
343
+ env = {**os.environ, **{k: _expand_env(v) for k, v in config.get("env", {}).items()}}
338
344
  return subprocess.Popen(
339
345
  cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
340
346
  stderr=subprocess.PIPE, text=True, env=env