mcp-proxy-adapter 4.0.0__py3-none-any.whl → 4.1.1__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.
@@ -257,15 +257,31 @@ class CommandRegistry:
257
257
  commands_info[name] = self.get_command_info(name)
258
258
  return commands_info
259
259
 
260
- def discover_commands(self, package_path: str = "mcp_proxy_adapter.commands") -> None:
260
+ def discover_commands(self, package_path: Optional[str] = None) -> int:
261
261
  """
262
262
  Automatically discovers and registers commands in the specified package.
263
+ If package_path is not provided, uses configuration settings.
263
264
 
264
265
  Args:
265
- package_path: Path to package with commands.
266
- """
266
+ package_path: Path to package with commands. If None, uses config.
267
+
268
+ Returns:
269
+ Number of commands discovered and registered.
270
+ """
271
+ # Get package path from config if not provided
272
+ if package_path is None:
273
+ try:
274
+ from mcp_proxy_adapter.config import config
275
+ package_path = config.get("commands.discovery_path", "mcp_proxy_adapter.commands")
276
+ logger.info(f"Using commands discovery path from config: {package_path}")
277
+ except Exception as e:
278
+ logger.warning(f"Failed to get discovery path from config, using default: {e}")
279
+ package_path = "mcp_proxy_adapter.commands"
280
+
267
281
  logger.info(f"Discovering commands in package: {package_path}")
268
282
 
283
+ commands_discovered = 0
284
+
269
285
  try:
270
286
  package = importlib.import_module(package_path)
271
287
  package_dir = os.path.dirname(package.__file__ or "")
@@ -273,7 +289,7 @@ class CommandRegistry:
273
289
  for _, module_name, is_pkg in pkgutil.iter_modules([package_dir]):
274
290
  if is_pkg:
275
291
  # Recursively traverse subpackages
276
- self.discover_commands(f"{package_path}.{module_name}")
292
+ commands_discovered += self.discover_commands(f"{package_path}.{module_name}")
277
293
  elif module_name.endswith("_command"):
278
294
  # Import only command modules
279
295
  module_path = f"{package_path}.{module_name}"
@@ -297,6 +313,8 @@ class CommandRegistry:
297
313
  # Register the command only if it doesn't exist
298
314
  if not self.command_exists(command_name):
299
315
  self.register(cast(Type[Command], obj))
316
+ commands_discovered += 1
317
+ logger.debug(f"Registered command: {command_name}")
300
318
  else:
301
319
  logger.debug(f"Command '{command_name}' is already registered, skipping")
302
320
  except ValueError as e:
@@ -307,6 +325,8 @@ class CommandRegistry:
307
325
  except Exception as e:
308
326
  logger.error(f"Error discovering commands: {e}")
309
327
 
328
+ return commands_discovered
329
+
310
330
  def register_custom_command(self, command: Union[Type[Command], Command]) -> None:
311
331
  """
312
332
  Register a custom command with priority over built-in commands.
@@ -471,12 +491,12 @@ class CommandRegistry:
471
491
  self._instances.clear()
472
492
  self._custom_commands.clear()
473
493
 
474
- def reload_config_and_commands(self, package_path: str = "mcp_proxy_adapter.commands") -> Dict[str, Any]:
494
+ def reload_config_and_commands(self, package_path: Optional[str] = None) -> Dict[str, Any]:
475
495
  """
476
496
  Reload configuration and rediscover commands.
477
497
 
478
498
  Args:
479
- package_path: Path to package with commands.
499
+ package_path: Path to package with commands. If None, uses config.
480
500
 
481
501
  Returns:
482
502
  Dictionary with reload information including:
@@ -53,7 +53,7 @@ class Config:
53
53
  },
54
54
  "commands": {
55
55
  "auto_discovery": True,
56
- "discovery_path": "mcp_proxy_adapter.commands",
56
+ "discovery_path": "mcp_proxy_adapter.commands", # Path to package with commands (e.g., "myproject.commands")
57
57
  "custom_commands_path": None
58
58
  }
59
59
  }
@@ -57,6 +57,7 @@ def main():
57
57
  print(f" • Log Level: {logging_settings['level']}")
58
58
  print(f" • Log Directory: {logging_settings['log_dir']}")
59
59
  print(f" • Auto Discovery: {commands_settings['auto_discovery']}")
60
+ print(f" • Discovery Path: {commands_settings['discovery_path']}")
60
61
  print()
61
62
  print("🔧 Available Commands:")
62
63
  print(" • help - Built-in help command")
@@ -64,6 +65,10 @@ def main():
64
65
  print(" • config - Built-in config command")
65
66
  print(" • reload - Built-in reload command")
66
67
  print()
68
+ print("📁 Command Discovery:")
69
+ print(f" • Commands will be discovered from: {commands_settings['discovery_path']}")
70
+ print(" • This path is configured in config.json under 'commands.discovery_path'")
71
+ print()
67
72
  print("🎯 Features:")
68
73
  print(" • Standard JSON-RPC API")
69
74
  print(" • Built-in command discovery")
@@ -11,8 +11,8 @@
11
11
  "log_file": "custom_commands.log",
12
12
  "error_log_file": "custom_commands_error.log",
13
13
  "access_log_file": "custom_commands_access.log",
14
- "max_file_size": "10MB",
15
- "backup_count": 5,
14
+ "max_file_size": "5MB",
15
+ "backup_count": 3,
16
16
  "format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s",
17
17
  "date_format": "%Y-%m-%d %H:%M:%S",
18
18
  "console_output": true,
@@ -20,43 +20,16 @@
20
20
  },
21
21
  "commands": {
22
22
  "auto_discovery": true,
23
- "discovery_path": "mcp_proxy_adapter.commands",
24
- "custom_commands_path": "./custom_commands",
25
- "auto_commands_path": "mcp_proxy_adapter.examples.custom_commands.auto_commands"
23
+ "discovery_path": "mcp_proxy_adapter.examples.custom_commands.auto_commands",
24
+ "custom_commands_path": null
26
25
  },
27
26
  "custom": {
28
- "server_name": "Advanced MCP Proxy Server with Hooks",
29
- "description": "Extended example server with custom commands and hooks",
27
+ "server_name": "Custom Commands MCP Proxy Server",
28
+ "description": "Example server with custom commands",
30
29
  "features": {
31
30
  "hooks_enabled": true,
32
31
  "custom_commands_enabled": true,
33
- "advanced_logging": true,
34
- "data_transformation": true,
35
- "command_interception": true
36
- },
37
- "hooks": {
38
- "data_transform": {
39
- "enabled": true,
40
- "transform_types": ["uppercase", "lowercase", "reverse"]
41
- },
42
- "intercept": {
43
- "enabled": true,
44
- "bypass_conditions": ["input_value == 0"]
45
- }
46
- },
47
- "custom_commands": {
48
- "manual_echo": {
49
- "enabled": true,
50
- "description": "Manually registered echo command"
51
- },
52
- "data_transform": {
53
- "enabled": true,
54
- "description": "Data transformation command"
55
- },
56
- "intercept": {
57
- "enabled": true,
58
- "description": "Command interception example"
59
- }
32
+ "advanced_logging": true
60
33
  }
61
34
  }
62
35
  }
@@ -195,6 +195,11 @@ def main():
195
195
  # Register custom commands
196
196
  register_custom_commands()
197
197
 
198
+ # Discover standard commands first
199
+ logger.info("Discovering standard commands...")
200
+ standard_commands_path = commands_settings.get("discovery_path", "mcp_proxy_adapter.commands")
201
+ registry.discover_commands(standard_commands_path)
202
+
198
203
  # Discover auto-registered commands
199
204
  logger.info("Discovering auto-registered commands...")
200
205
  auto_commands_path = commands_settings.get("auto_commands_path", "mcp_proxy_adapter.examples.custom_commands.auto_commands")
@@ -1,3 +1,3 @@
1
1
  """Version information for MCP Microservice."""
2
2
 
3
- __version__ = "4.0.0"
3
+ __version__ = "4.1.1"
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-proxy-adapter
3
- Version: 4.0.0
3
+ Version: 4.1.1
4
4
  Summary: Reliable microservice with unified JSON-RPC endpoint
5
- Home-page: https://github.com/yourusername/mcp-proxy-adapter
6
- Author: MCP Team
5
+ Home-page: https://github.com/maverikod/mcp-proxy-adapter
6
+ Author: Vasiliy Zdanovskiy
7
7
  Author-email: Vasiliy Zubarev <vasiliy.zubarev@example.com>
8
8
  License: MIT License
9
9
 
@@ -1,8 +1,8 @@
1
1
  mcp_proxy_adapter/__init__.py,sha256=B7m1YWyv_Wb87-Q-JqVpHQgwajnfIgDyZ_iIxzdTbBY,1021
2
- mcp_proxy_adapter/config.py,sha256=FS-Zwg8F5lfb0WqaXRrVlPLgjHEvPCV5MtTmE6Qj0Cw,6447
2
+ mcp_proxy_adapter/config.py,sha256=snoninhOygGDitA5zFZTS7KRcLao5SZNUbVp9R_hXlI,6509
3
3
  mcp_proxy_adapter/custom_openapi.py,sha256=1A7y8r65WfZSqhhzhJyEIpwqwV-qbTXzRrRX04amluk,14472
4
4
  mcp_proxy_adapter/openapi.py,sha256=36vOEbJjGnVZR6hUhl6mHCD29HYOEFKo2bL0JdGSm-4,13952
5
- mcp_proxy_adapter/version.py,sha256=pZH64hpMX6h1LI8B0EIOOH2Az1Ddq7bHT-eXKNOvy2Y,71
5
+ mcp_proxy_adapter/version.py,sha256=MvxgbADLVcTNg6BxI1LaFYcWytWx20UzR7OsZk5uSRo,71
6
6
  mcp_proxy_adapter/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  mcp_proxy_adapter/api/app.py,sha256=Haj0ogy70KRMyAAwU2PQhQFPf28On9ynnUX2FPk0l94,16602
8
8
  mcp_proxy_adapter/api/handlers.py,sha256=LqPMRMGYtepoZUoJiKjjycRE2fJxsE545osoEsgHKQg,7208
@@ -18,7 +18,7 @@ mcp_proxy_adapter/api/middleware/performance.py,sha256=dHBxTF43LEGXMKHMH3A8ybKmw
18
18
  mcp_proxy_adapter/api/middleware/rate_limit.py,sha256=DIv_-ZUVmL-jEo_A5BlfnasZf25zT84AiIJDUUnXkpM,5041
19
19
  mcp_proxy_adapter/commands/__init__.py,sha256=bHZZcVYkXVL9g-YZOnWkHOxSP2WzT-I4_OleYycQhbw,610
20
20
  mcp_proxy_adapter/commands/base.py,sha256=-OwzKXVwt9Ov4BLmHE6CAu9966__RgMOl1bkstlWCuE,14719
21
- mcp_proxy_adapter/commands/command_registry.py,sha256=Dd78qQ0N7ApsbJ_S0NHG4h9I4wjlILR9M85EFbfs_So,20146
21
+ mcp_proxy_adapter/commands/command_registry.py,sha256=6bOxSc2Vz93wHxD_8_kFzYoAURMtAg338sDIYR9MpLE,21134
22
22
  mcp_proxy_adapter/commands/config_command.py,sha256=-Z6BGaEQTf859l56zZpHYBeZFeIVdpMYybDrd7LOPIg,3553
23
23
  mcp_proxy_adapter/commands/dependency_container.py,sha256=Uz9OPRAUZN7tsVrMVgXgPQcsRD2N-e2Ixg9XarPOlnY,3410
24
24
  mcp_proxy_adapter/commands/health_command.py,sha256=_tzxHwB_8vo53VBC6HnBv5fSfZL1pEuwlbrCcy_K78c,4087
@@ -40,11 +40,11 @@ mcp_proxy_adapter/examples/basic_server/__init__.py,sha256=63tFue2XfrlkNpIMC3foQ
40
40
  mcp_proxy_adapter/examples/basic_server/basic_custom_settings.json,sha256=OQGAT2TUERhnznpOV0IsUix5JM-am7VCEvG97BWUxos,1003
41
41
  mcp_proxy_adapter/examples/basic_server/config.json,sha256=wz0niZ2Q8zr1XPeNZBGsAXOZgciYnEn3XDW5FrOEqzQ,929
42
42
  mcp_proxy_adapter/examples/basic_server/custom_settings_example.py,sha256=9VM7_D5OzSZ-eezH17gthsLo3DvklOtzkx-3QM9j8RU,8218
43
- mcp_proxy_adapter/examples/basic_server/server.py,sha256=U6X9m7zCAlwMztFft5wfu6MdaLt2dppkyFlcUa_7BDc,3424
43
+ mcp_proxy_adapter/examples/basic_server/server.py,sha256=6APjF7-1J_I_0kPVwkkxM1UBEvABjxVlZWYErPQaQOY,3732
44
44
  mcp_proxy_adapter/examples/custom_commands/README.md,sha256=nkrZ-mbz0AfnYUVb57hPsO4jUadWvDaUTWkIDUwY0VY,3881
45
45
  mcp_proxy_adapter/examples/custom_commands/__init__.py,sha256=vqAm7c4crDMupwh0hAGPC8XE2inu0o-tAG5GHW04ZkE,684
46
46
  mcp_proxy_adapter/examples/custom_commands/advanced_hooks.py,sha256=MCL7OkkrOMc8zEt9qlZ_dV9YIGnB_fe4Ge6mjVq6qPE,9516
47
- mcp_proxy_adapter/examples/custom_commands/config.json,sha256=4CZ01rT5d9QX4zUzEAQvHzin4LQheHxgtk6Wph5bnp4,1750
47
+ mcp_proxy_adapter/examples/custom_commands/config.json,sha256=GMpSxQH8AoW4OGShhkgeKPfsT9k4_erkYNBUg_dGr4k,965
48
48
  mcp_proxy_adapter/examples/custom_commands/custom_health_command.py,sha256=V7qqFRgFQAxriEnUtkJ_sHjIOCjGjeqgsHjcfZrd26w,5473
49
49
  mcp_proxy_adapter/examples/custom_commands/custom_help_command.py,sha256=3HPj4peKcwbwSfXW2ATQ4vFGvbsXLxfZXfxjjPYiowU,7486
50
50
  mcp_proxy_adapter/examples/custom_commands/custom_openapi_generator.py,sha256=txm6oC8jP-nOHNgWlB2B0_YIYf2YQFSqLYpObNyDDq4,2408
@@ -55,7 +55,7 @@ mcp_proxy_adapter/examples/custom_commands/echo_command.py,sha256=5cP0MQiTcpEiix
55
55
  mcp_proxy_adapter/examples/custom_commands/hooks.py,sha256=Zfd-9T2XYJF7XMgQmEGdzWtM8Gz2EF8dn-jNJbYOgb4,7486
56
56
  mcp_proxy_adapter/examples/custom_commands/intercept_command.py,sha256=06xPpS-9kC6Lu-b6anES1ah8gLtP0sgFL4N1JkDkOrk,3716
57
57
  mcp_proxy_adapter/examples/custom_commands/manual_echo_command.py,sha256=4Bma586HU17IpuVuCuG-_rk-kycDx_oN6gKJ-q3DQr4,2787
58
- mcp_proxy_adapter/examples/custom_commands/server.py,sha256=WA3kh1kqWtk_tG834oHTnfgCichiAZn1xyzrLU_WJfI,9209
58
+ mcp_proxy_adapter/examples/custom_commands/server.py,sha256=4tFPJSMrYK3WhqHSzMa7mGjhinWcPxEO7Qff03EdSMA,9459
59
59
  mcp_proxy_adapter/examples/custom_commands/test_hooks.py,sha256=0VUwENRAAYGDYMUxXVEA_EByKiHQiqJmdkul1LvebQE,5288
60
60
  mcp_proxy_adapter/examples/custom_commands/auto_commands/__init__.py,sha256=AN5b9FNYobhDL5MWaftVy0imcAlbEuLIxwRQYX1U-_o,161
61
61
  mcp_proxy_adapter/examples/custom_commands/auto_commands/auto_echo_command.py,sha256=M0QlkCdSY9rD1b88JdZLlVMo2zU9iCnWC4DeSWCtU44,2725
@@ -103,8 +103,8 @@ mcp_proxy_adapter/tests/stubs/echo_command.py,sha256=Y7SA4IB5Lo_ncn78SDm9iRZvJSK
103
103
  mcp_proxy_adapter/tests/unit/__init__.py,sha256=RS-5UoSCcLKtr2jrAaZw_NG9MquA6BZmxq-P6cTw9ok,53
104
104
  mcp_proxy_adapter/tests/unit/test_base_command.py,sha256=iCJzmfcvknS6pnzqu9TSkpgKBGoYCLWu0aQekcj1AME,18183
105
105
  mcp_proxy_adapter/tests/unit/test_config.py,sha256=SZ62LXFOv_fsV0fmSIBdHWvapEyexKrioFRQo0I4pkg,5900
106
- mcp_proxy_adapter-4.0.0.dist-info/licenses/LICENSE,sha256=OkApFEwdgMCt_mbvUI-eIwKMSTe38K3XnU2DT5ub-wI,1072
107
- mcp_proxy_adapter-4.0.0.dist-info/METADATA,sha256=e6Os1z7lPFN940_oTni0A07rkIV9QBb-iWBThps3Agw,7537
108
- mcp_proxy_adapter-4.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
109
- mcp_proxy_adapter-4.0.0.dist-info/top_level.txt,sha256=JZT7vPLBYrtroX-ij68JBhJYbjDdghcV-DFySRy-Nnw,18
110
- mcp_proxy_adapter-4.0.0.dist-info/RECORD,,
106
+ mcp_proxy_adapter-4.1.1.dist-info/licenses/LICENSE,sha256=OkApFEwdgMCt_mbvUI-eIwKMSTe38K3XnU2DT5ub-wI,1072
107
+ mcp_proxy_adapter-4.1.1.dist-info/METADATA,sha256=pGeDYfEOP0H005Twd8INFo7TWfyAFpScB4tLXZcd23Q,7544
108
+ mcp_proxy_adapter-4.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
109
+ mcp_proxy_adapter-4.1.1.dist-info/top_level.txt,sha256=JZT7vPLBYrtroX-ij68JBhJYbjDdghcV-DFySRy-Nnw,18
110
+ mcp_proxy_adapter-4.1.1.dist-info/RECORD,,