mcp-proxy-adapter 2.1.14__py3-none-any.whl → 2.1.16__py3-none-any.whl

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.
@@ -0,0 +1 @@
1
+
@@ -79,7 +79,7 @@ class JsonRpcDispatcher(BaseDispatcher):
79
79
  ),
80
80
  summary="Command help",
81
81
  params={
82
- "command": {
82
+ "cmdname": {
83
83
  "type": "string",
84
84
  "description": "Command name for detailed information",
85
85
  "required": False
@@ -197,7 +197,7 @@ class JsonRpcDispatcher(BaseDispatcher):
197
197
 
198
198
  Args:
199
199
  params: Command parameters
200
- command: Command name for detailed information
200
+ cmdname: Command name for detailed information
201
201
 
202
202
  Returns:
203
203
  Dict[str, Any]: Command help information
@@ -206,8 +206,8 @@ class JsonRpcDispatcher(BaseDispatcher):
206
206
  params = {}
207
207
 
208
208
  # If specific command is specified, return information only about it
209
- if "command" in params and params["command"]:
210
- command = params["command"]
209
+ if "cmdname" in params and params["cmdname"]:
210
+ command = params["cmdname"]
211
211
  if command not in self._metadata:
212
212
  return {
213
213
  "error": f"Command '{command}' not found",
@@ -231,5 +231,5 @@ class JsonRpcDispatcher(BaseDispatcher):
231
231
  return {
232
232
  "commands": commands_info,
233
233
  "total": len(commands_info),
234
- "note": "Use the 'command' parameter to get detailed information about a specific command"
234
+ "note": "Use the 'cmdname' parameter to get detailed information about a specific command"
235
235
  }
@@ -20,7 +20,7 @@ class MyRegistry:
20
20
  self.commands = {"ping": self.ping, "help": self.help_command}
21
21
  self.commands_info = {
22
22
  "ping": {"description": "Ping command (returns pong)", "params": {}},
23
- "help": {"description": "Show help for commands", "params": {"command": {"type": "string", "description": "Command name", "required": False}}}
23
+ "help": {"description": "Show help for commands", "params": {"cmdname": {"type": "string", "description": "Command name", "required": False}}}
24
24
  }
25
25
  def get_valid_commands(self):
26
26
  return list(self.commands.keys())
@@ -33,7 +33,7 @@ class MyRegistry:
33
33
  command = args[0]
34
34
  params = {k: v for k, v in params.items()}
35
35
  else:
36
- command = params.pop("command", None)
36
+ command = params.pop("cmdname", None)
37
37
  if command == "ping":
38
38
  return self.ping()
39
39
  if command == "help":
@@ -44,13 +44,13 @@ class MyRegistry:
44
44
  def ping(self):
45
45
  """Ping command."""
46
46
  return {"result": "pong"}
47
- def help_command(self, command: str = None):
47
+ def help_command(self, cmdname: str = None):
48
48
  """Custom help logic: returns info for command or all commands."""
49
- if not command:
49
+ if not cmdname:
50
50
  return {"commands": list(self.commands_info.keys())}
51
- if command in self.commands_info:
52
- return {"command": command, "info": self.commands_info[command]}
53
- return {"error": f"Command '{command}' not found"}
51
+ if cmdname in self.commands_info:
52
+ return {"command": cmdname, "info": self.commands_info[cmdname]}
53
+ return {"error": f"Command '{cmdname}' not found"}
54
54
 
55
55
  if __name__ == "__main__":
56
56
  registry = MyRegistry()
@@ -64,9 +64,9 @@ if __name__ == "__main__":
64
64
  print("Help (all)", result_help_all)
65
65
 
66
66
  # Call help (ping)
67
- result_help_ping = registry.execute("help", command="ping")
67
+ result_help_ping = registry.execute("help", cmdname="ping")
68
68
  print("Help (ping)", result_help_ping)
69
69
 
70
70
  # Call help (notfound)
71
- result_help_notfound = registry.execute("help", command="notfound")
71
+ result_help_notfound = registry.execute("help", cmdname="notfound")
72
72
  print("Help (notfound)", result_help_notfound)
@@ -21,33 +21,33 @@ from mcp_proxy_adapter.testing_utils import MockRegistry
21
21
  registry = MockRegistry()
22
22
  adapter = MCPProxyAdapter(registry)
23
23
 
24
- def robust_help(command: str = None) -> Dict[str, Any]:
24
+ def robust_help(cmdname: str = None) -> Dict[str, Any]:
25
25
  """
26
26
  Best practice: always check for project help, handle errors, fallback to adapter help.
27
27
  """
28
28
  dispatcher = registry.dispatcher
29
29
  if "help" in dispatcher.get_valid_commands():
30
30
  try:
31
- if command:
32
- return dispatcher.help_command(command=command)
31
+ if cmdname:
32
+ return dispatcher.help_command(cmdname=cmdname)
33
33
  return dispatcher.help_command()
34
34
  except Exception as e:
35
35
  # Log error, fallback to adapter help
36
36
  print(f"[WARN] Project help failed: {e}. Fallback to adapter help.")
37
- return fallback_adapter_help(command)
37
+ return fallback_adapter_help(cmdname)
38
38
  else:
39
- return fallback_adapter_help(command)
39
+ return fallback_adapter_help(cmdname)
40
40
 
41
- def fallback_adapter_help(command: str = None) -> Dict[str, Any]:
41
+ def fallback_adapter_help(cmdname: str = None) -> Dict[str, Any]:
42
42
  """
43
43
  Fallback: call adapter's help (simulate REST/JSON-RPC call).
44
44
  """
45
45
  dispatcher = registry.dispatcher
46
- if not command:
46
+ if not cmdname:
47
47
  return {"source": "adapter", "commands": dispatcher.get_valid_commands()}
48
- if command in dispatcher.get_valid_commands():
49
- return {"source": "adapter", "command": command, "info": {"description": "Adapter help for command"}}
50
- return {"source": "adapter", "error": f"Command '{command}' not found (adapter)", "available_commands": dispatcher.get_valid_commands()}
48
+ if cmdname in dispatcher.get_valid_commands():
49
+ return {"source": "adapter", "command": cmdname, "info": {"description": "Adapter help for command"}}
50
+ return {"source": "adapter", "error": f"Command '{cmdname}' not found (adapter)", "available_commands": dispatcher.get_valid_commands()}
51
51
 
52
52
  # --- Example test cases ---
53
53
  def test_help():
@@ -24,29 +24,29 @@ registry = MockRegistry()
24
24
  adapter = MCPProxyAdapter(registry)
25
25
 
26
26
  # --- Best practice: always check if 'help' is in commands ---
27
- def call_help(command: str = None) -> Dict[str, Any]:
27
+ def call_help(cmdname: str = None) -> Dict[str, Any]:
28
28
  """Call help command with or without parameter."""
29
29
  dispatcher = registry.dispatcher
30
30
  if "help" in dispatcher.get_valid_commands():
31
- if command:
31
+ if cmdname:
32
32
  try:
33
- return dispatcher.help_command(command=command)
33
+ return dispatcher.help_command(cmdname=cmdname)
34
34
  except Exception as e:
35
35
  print(f"Project help failed: {e}. Fallback to adapter help.")
36
- return adapter_help(command)
36
+ return adapter_help(cmdname)
37
37
  else:
38
38
  return dispatcher.help_command()
39
39
  else:
40
- return adapter_help(command)
40
+ return adapter_help(cmdname)
41
41
 
42
- def adapter_help(command: str = None) -> Dict[str, Any]:
42
+ def adapter_help(cmdname: str = None) -> Dict[str, Any]:
43
43
  """Fallback: call adapter's help (simulate)."""
44
44
  dispatcher = registry.dispatcher
45
- if not command:
45
+ if not cmdname:
46
46
  return {"source": "adapter", "commands": dispatcher.get_valid_commands()}
47
- if command in dispatcher.get_valid_commands():
48
- return {"source": "adapter", "command": command, "info": {"description": "Adapter help for command"}}
49
- return {"source": "adapter", "error": f"Command '{command}' not found (adapter)", "available_commands": dispatcher.get_valid_commands()}
47
+ if cmdname in dispatcher.get_valid_commands():
48
+ return {"source": "adapter", "command": cmdname, "info": {"description": "Adapter help for command"}}
49
+ return {"source": "adapter", "error": f"Command '{cmdname}' not found (adapter)", "available_commands": dispatcher.get_valid_commands()}
50
50
 
51
51
  if __name__ == "__main__":
52
52
  print("=== Project help (no param) ===")
@@ -171,7 +171,7 @@ class MockDispatcher:
171
171
  "help": {
172
172
  "description": "Show information about available commands or a specific command.",
173
173
  "params": {
174
- "command": {
174
+ "cmdname": {
175
175
  "type": "string",
176
176
  "description": "Command name for detailed info",
177
177
  "required": False
@@ -278,19 +278,18 @@ class MockDispatcher:
278
278
 
279
279
  def help_command(self, **params):
280
280
  """Return info about all commands or a specific command."""
281
- # Если в будущем появится пользовательская команда help, можно реализовать её здесь
282
- command = params.get("command")
283
- if command:
284
- info = self.commands_info.get(command)
281
+ cmdname = params.get("cmdname")
282
+ if cmdname:
283
+ info = self.commands_info.get(cmdname)
285
284
  if info:
286
- return {"command": command, "info": info}
285
+ return {"command": cmdname, "info": info}
287
286
  else:
288
- return {"error": f"Command '{command}' not found", "available_commands": list(self.commands_info.keys())}
289
- # Если параметр command не указан, возвращаем краткую информацию обо всех
287
+ return {"error": f"Command '{cmdname}' not found", "available_commands": list(self.commands_info.keys())}
288
+ # Если параметр cmdname не указан, возвращаем краткую информацию обо всех
290
289
  return {
291
290
  "commands": {cmd: {"description": info["description"], "params": info["params"]} for cmd, info in self.commands_info.items()},
292
291
  "total": len(self.commands_info),
293
- "note": "Use the 'command' parameter to get detailed information about a specific command"
292
+ "note": "Use the 'cmdname' parameter to get detailed information about a specific command"
294
293
  }
295
294
 
296
295
  # --- Создание registry и FastAPI-приложения на верхнем уровне ---
@@ -0,0 +1 @@
1
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-proxy-adapter
3
- Version: 2.1.14
3
+ Version: 2.1.16
4
4
  Summary: Adapter for exposing Command Registry commands as tools for AI models via MCP Proxy.
5
5
  Home-page: https://github.com/vasilyvz/mcp-proxy-adapter
6
6
  Author: Vasiliy VZ
@@ -1,3 +1,4 @@
1
+ mcp_proxy_adapter/__init__.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
1
2
  mcp_proxy_adapter/adapter.py,sha256=76dkVeDuqLsJ5AhuftzLlwy2M6yr_PfNbmNfo9dXVhc,28844
2
3
  mcp_proxy_adapter/models.py,sha256=8zVWU6ly18pWozOnKQ2gsGpmTgL37-fFE_Fr1SDW-Nk,2530
3
4
  mcp_proxy_adapter/registry.py,sha256=jgC4TKaPbMbAsoxvGp2ToaOE4drD-VfZug7WJbm4IW4,15853
@@ -8,21 +9,22 @@ mcp_proxy_adapter/analyzers/docstring_analyzer.py,sha256=T3FLJEo_uChShfiEKRl8GpV
8
9
  mcp_proxy_adapter/analyzers/type_analyzer.py,sha256=6Wac7osKwF03waFSwQ8ZM0Wqn_zAP2D-I4WMEpR0hQM,5230
9
10
  mcp_proxy_adapter/dispatchers/__init__.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
10
11
  mcp_proxy_adapter/dispatchers/base_dispatcher.py,sha256=S5_Xri058jAmOWeit1tedB_GMZQ9RLcNcYabA83ZF6k,2288
11
- mcp_proxy_adapter/dispatchers/json_rpc_dispatcher.py,sha256=sdRwvI5f-2dtI7U_sv6-pqUvxBMirgUDl_P7la3EV0A,8054
12
+ mcp_proxy_adapter/dispatchers/json_rpc_dispatcher.py,sha256=HO3RY5AzCQF3UPqnOIauB7Sq9rJC9jv7h7FTM1eDR90,8054
12
13
  mcp_proxy_adapter/examples/analyze_config.py,sha256=vog7TNHDw5ZoYhQLbAvZvEoufmQwH54KJzQBJrSq5w4,4283
13
14
  mcp_proxy_adapter/examples/basic_integration.py,sha256=mtRval4VSUgTb_C2p8U_DPPSEKA08dZYKZk-bOrE4H4,4470
14
15
  mcp_proxy_adapter/examples/docstring_and_schema_example.py,sha256=wFg3Cf2Jgve0J5kFzApvFSII8JOsOGaych64hIC7FqQ,2183
15
- mcp_proxy_adapter/examples/extension_example.py,sha256=2UnrcHw0yRZuFzyvW6zsJ8_NTmGWU79fnCEG6w8VRDY,2525
16
- mcp_proxy_adapter/examples/help_best_practices.py,sha256=Bit9Ywl9vGvM_kuV8DJ6pIDK4mY4mF2Gia9rLc56RpI,2646
17
- mcp_proxy_adapter/examples/help_usage.py,sha256=JIUsZofdLFyI7FcwPF-rLxipF1-HaZINzVK1KBh0vxA,2577
16
+ mcp_proxy_adapter/examples/extension_example.py,sha256=W5fcvPHjpDSPQnmhAWDJqZtLoUfY7h58ZzFoFXDF3Fc,2525
17
+ mcp_proxy_adapter/examples/help_best_practices.py,sha256=ByHMDiBT9V-cHoSMr2q0PmbteKELY8mTGeJrvAxOWpY,2646
18
+ mcp_proxy_adapter/examples/help_usage.py,sha256=pEwb8-QhiWuBPCK9cbHW-oMKxk4WMo345SHIAl-dosg,2577
18
19
  mcp_proxy_adapter/examples/mcp_proxy_client.py,sha256=z4IzFlGigVTQSb8TpcrQ_a0migsmC58LnNwc8wZmTfw,3811
19
- mcp_proxy_adapter/examples/openapi_server.py,sha256=5gRM-EHvMsnNtS_M6l_pNPN5EkSf4X1Lcq4E1Xs5tp0,13387
20
+ mcp_proxy_adapter/examples/openapi_server.py,sha256=HUcnv_XEEur1kLuAotHuwwAhykApVXgVj4miOgk8DYA,13229
20
21
  mcp_proxy_adapter/examples/project_structure_example.py,sha256=sswTo6FZb1F5juHa0FYG3cgvrh3wfgGfJu2bBy5tCm4,1460
21
22
  mcp_proxy_adapter/examples/testing_example.py,sha256=OxFUhGP9OXiu9eWjSpytpQ5MzoR9uww3M4jYb0_v7dc,2004
23
+ mcp_proxy_adapter/validators/__init__.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
22
24
  mcp_proxy_adapter/validators/docstring_validator.py,sha256=Onpq2iNJ1qF4ejkJJIlBkLROuSNIVALHVmXIgkCpaFI,2934
23
25
  mcp_proxy_adapter/validators/metadata_validator.py,sha256=uCrn38-VYYn89l6f5CC_GoTAHAweaOW2Z6Esro1rtGw,3155
24
- mcp_proxy_adapter-2.1.14.dist-info/licenses/LICENSE,sha256=OkApFEwdgMCt_mbvUI-eIwKMSTe38K3XnU2DT5ub-wI,1072
25
- mcp_proxy_adapter-2.1.14.dist-info/METADATA,sha256=7Pdio5dg10wtV5ClYd4TYAERlEhV13qXLcc9RKqCN2c,8886
26
- mcp_proxy_adapter-2.1.14.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
27
- mcp_proxy_adapter-2.1.14.dist-info/top_level.txt,sha256=JZT7vPLBYrtroX-ij68JBhJYbjDdghcV-DFySRy-Nnw,18
28
- mcp_proxy_adapter-2.1.14.dist-info/RECORD,,
26
+ mcp_proxy_adapter-2.1.16.dist-info/licenses/LICENSE,sha256=OkApFEwdgMCt_mbvUI-eIwKMSTe38K3XnU2DT5ub-wI,1072
27
+ mcp_proxy_adapter-2.1.16.dist-info/METADATA,sha256=ww2i2m0f6txplRMYCb65rU1h9tDAm-FL-4hq2ZBzlUE,8886
28
+ mcp_proxy_adapter-2.1.16.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
29
+ mcp_proxy_adapter-2.1.16.dist-info/top_level.txt,sha256=JZT7vPLBYrtroX-ij68JBhJYbjDdghcV-DFySRy-Nnw,18
30
+ mcp_proxy_adapter-2.1.16.dist-info/RECORD,,