mcp-proxy-adapter 6.4.7__py3-none-any.whl → 6.4.8__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.
@@ -8,6 +8,7 @@ email: vasilyvz@gmail.com
8
8
  """
9
9
  import sys
10
10
  import argparse
11
+ import asyncio
11
12
  from pathlib import Path
12
13
 
13
14
  # Add the framework to the path
@@ -37,14 +38,14 @@ def main():
37
38
  print(f"📋 Configuration: {args.config}")
38
39
  print("=" * 50)
39
40
  # Use the factory method to create and run the server
40
- create_and_run_server(
41
+ asyncio.run(create_and_run_server(
41
42
  config_path=args.config,
42
43
  title="Basic Framework Example",
43
44
  description="Basic MCP Proxy Adapter with minimal configuration",
44
45
  version="1.0.0",
45
46
  host=config_overrides.get("host", "0.0.0.0"),
46
47
  log_level="debug" if config_overrides.get("debug", False) else "info",
47
- )
48
+ ))
48
49
 
49
50
 
50
51
  if __name__ == "__main__":
@@ -12,155 +12,13 @@ email: vasilyvz@gmail.com
12
12
  """
13
13
  import sys
14
14
  import argparse
15
+ import asyncio
15
16
  import logging
16
17
  from pathlib import Path
17
18
 
18
19
  # Add the framework to the path
19
20
  sys.path.insert(0, str(Path(__file__).parent.parent.parent))
20
21
  from mcp_proxy_adapter.core.app_factory import create_and_run_server
21
- from mcp_proxy_adapter.api.app import create_app
22
- from mcp_proxy_adapter.config import Config
23
- from mcp_proxy_adapter.commands.command_registry import CommandRegistry
24
-
25
-
26
- class FullApplication:
27
- """Full application example with all framework features."""
28
-
29
- def __init__(self, config_path: str):
30
- self.config_path = config_path
31
- self.config = Config(config_path)
32
- self.app = None
33
- self.command_registry = None
34
- # Setup logging
35
- logging.basicConfig(level=logging.INFO)
36
- self.logger = logging.getLogger(__name__)
37
-
38
- def setup_hooks(self):
39
- """Setup application hooks."""
40
- try:
41
- # Import hooks
42
- from hooks.application_hooks import ApplicationHooks
43
- from hooks.builtin_command_hooks import BuiltinCommandHooks
44
-
45
- # Register application hooks
46
- self.logger.info("🔧 Setting up application hooks...")
47
- # Register built-in command hooks
48
- self.logger.info("🔧 Setting up built-in command hooks...")
49
- # Note: In a real implementation, these hooks would be registered
50
- # with the framework's hook system
51
- self.logger.info("✅ Hooks setup completed")
52
- except ImportError as e:
53
- self.logger.warning(f"⚠️ Could not import hooks: {e}")
54
-
55
- def setup_custom_commands(self):
56
- """Setup custom commands."""
57
- try:
58
- self.logger.info("🔧 Setting up custom commands...")
59
- # Import custom commands
60
- from commands.custom_echo_command import CustomEchoCommand
61
- from commands.dynamic_calculator_command import DynamicCalculatorCommand
62
-
63
- # Register custom commands
64
- # Note: In a real implementation, these would be registered
65
- # with the framework's command registry
66
- self.logger.info("✅ Custom commands setup completed")
67
- except ImportError as e:
68
- self.logger.warning(f"⚠️ Could not import custom commands: {e}")
69
-
70
- def setup_proxy_endpoints(self):
71
- """Setup proxy registration endpoints."""
72
- try:
73
- self.logger.info("🔧 Setting up proxy endpoints...")
74
- # Import proxy endpoints
75
- from proxy_endpoints import router as proxy_router
76
-
77
- # Add proxy router to the application
78
- self.app.include_router(proxy_router)
79
- self.logger.info("✅ Proxy endpoints setup completed")
80
- except ImportError as e:
81
- self.logger.warning(f"⚠️ Could not import proxy endpoints: {e}")
82
-
83
- def create_application(self):
84
- """Create the FastAPI application."""
85
- self.logger.info("🔧 Creating application...")
86
- # Setup hooks and commands before creating app
87
- self.setup_hooks()
88
- self.setup_custom_commands()
89
- # Create application with configuration
90
- self.app = create_app(app_config=self.config)
91
- # Setup proxy endpoints after app creation
92
- self.setup_proxy_endpoints()
93
- self.logger.info("✅ Application created successfully")
94
-
95
- def run(self, host: str = None, port: int = None, debug: bool = False):
96
- """Run the application using the factory method."""
97
- # Override configuration if specified
98
- config_overrides = {}
99
- if host:
100
- config_overrides["host"] = host
101
- if port:
102
- config_overrides["port"] = port
103
- if debug:
104
- config_overrides["debug"] = True
105
- print(f"🚀 Starting Full Application Example")
106
- print(f"📋 Configuration: {self.config_path}")
107
- print(
108
- f"🔧 Features: Built-in commands, Custom commands, Dynamic commands, Hooks, Proxy endpoints"
109
- )
110
- print("=" * 60)
111
- # Create application with configuration
112
- self.create_application()
113
- # Get server configuration
114
- server_host = self.config.get("server.host", "0.0.0.0")
115
- server_port = self.config.get("server.port", 8000)
116
- server_debug = self.config.get("server.debug", False)
117
- # Get SSL configuration
118
- ssl_enabled = self.config.get("ssl.enabled", False)
119
- ssl_cert_file = self.config.get("ssl.cert_file")
120
- ssl_key_file = self.config.get("ssl.key_file")
121
- ssl_ca_cert = self.config.get("ssl.ca_cert")
122
- verify_client = self.config.get("ssl.verify_client", False)
123
- print(f"🌐 Server: {server_host}:{server_port}")
124
- print(f"🔧 Debug: {server_debug}")
125
- if ssl_enabled:
126
- print(f"🔐 SSL: Enabled")
127
- print(f" Certificate: {ssl_cert_file}")
128
- print(f" Key: {ssl_key_file}")
129
- if ssl_ca_cert:
130
- print(f" CA: {ssl_ca_cert}")
131
- print(f" Client verification: {verify_client}")
132
- print("=" * 60)
133
- # Use hypercorn directly to run the application with proxy endpoints
134
- try:
135
- import hypercorn.asyncio
136
- import hypercorn.config
137
- import asyncio
138
-
139
- # Configure hypercorn
140
- config_hypercorn = hypercorn.config.Config()
141
- config_hypercorn.bind = [f"{server_host}:{server_port}"]
142
- config_hypercorn.loglevel = "debug" if server_debug else "info"
143
- if ssl_enabled and ssl_cert_file and ssl_key_file:
144
- config_hypercorn.certfile = ssl_cert_file
145
- config_hypercorn.keyfile = ssl_key_file
146
- if ssl_ca_cert:
147
- config_hypercorn.ca_certs = ssl_ca_cert
148
- if verify_client:
149
- import ssl
150
-
151
- config_hypercorn.verify_mode = ssl.CERT_REQUIRED
152
- print(f"🔐 Starting HTTPS server with hypercorn...")
153
- else:
154
- print(f"🌐 Starting HTTP server with hypercorn...")
155
- # Run the server
156
- asyncio.run(hypercorn.asyncio.serve(self.app, config_hypercorn))
157
- except ImportError:
158
- print("❌ hypercorn not installed. Installing...")
159
- import subprocess
160
-
161
- subprocess.run([sys.executable, "-m", "pip", "install", "hypercorn"])
162
- print("✅ hypercorn installed. Please restart the application.")
163
- return
164
22
 
165
23
 
166
24
  def main():
@@ -173,25 +31,30 @@ def main():
173
31
  parser.add_argument("--port", type=int, help="Server port")
174
32
  parser.add_argument("--debug", action="store_true", help="Enable debug mode")
175
33
  args = parser.parse_args()
176
- # Create and run application
177
- app = FullApplication(args.config)
178
- app.run(host=args.host, port=args.port, debug=args.debug)
179
-
180
-
181
- # Create global app instance for import
182
- app = None
183
-
184
-
185
- def get_app():
186
- """Get the FastAPI application instance."""
187
- global app
188
- if app is None:
189
- # Create a default configuration for import
190
- config = Config("configs/mtls_with_roles.json") # Default config
191
- app_instance = FullApplication("configs/mtls_with_roles.json")
192
- app_instance.create_application()
193
- app = app_instance.app
194
- return app
34
+
35
+ # Override configuration if specified
36
+ config_overrides = {}
37
+ if args.host:
38
+ config_overrides["host"] = args.host
39
+ if args.port:
40
+ config_overrides["port"] = args.port
41
+ if args.debug:
42
+ config_overrides["debug"] = True
43
+
44
+ print(f"🚀 Starting Full Application Example")
45
+ print(f"📋 Configuration: {args.config}")
46
+ print(f"🔧 Features: Built-in commands, Custom commands, Dynamic commands, Hooks, Proxy endpoints")
47
+ print("=" * 60)
48
+
49
+ # Use the factory method to create and run the server
50
+ asyncio.run(create_and_run_server(
51
+ config_path=args.config,
52
+ title="Full Application Example",
53
+ description="Complete MCP Proxy Adapter with all features",
54
+ version="1.0.0",
55
+ host=config_overrides.get("host", "0.0.0.0"),
56
+ log_level="debug" if config_overrides.get("debug", False) else "info",
57
+ ))
195
58
 
196
59
 
197
60
  if __name__ == "__main__":
@@ -2,4 +2,4 @@
2
2
  Version information for MCP Proxy Adapter.
3
3
  """
4
4
 
5
- __version__ = "6.4.7"
5
+ __version__ = "6.4.8"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-proxy-adapter
3
- Version: 6.4.7
3
+ Version: 6.4.8
4
4
  Summary: Powerful JSON-RPC microservices framework with built-in security, authentication, and proxy registration
5
5
  Home-page: https://github.com/maverikod/mcp-proxy-adapter
6
6
  Author: Vasiliy Zdanovskiy
@@ -4,7 +4,7 @@ mcp_proxy_adapter/config.py,sha256=-7iVS0mUWWKNeao7nqTAFlUD6FcMwRlDkchN7OwYsr0,2
4
4
  mcp_proxy_adapter/custom_openapi.py,sha256=yLle4CntYK9wpivgn9NflZyJhy-YNrmWjJzt0ai5nP0,14672
5
5
  mcp_proxy_adapter/main.py,sha256=idp3KUR7CT7kTXLVPvvclJlNnt8d_HYl8_jY98uknmo,4677
6
6
  mcp_proxy_adapter/openapi.py,sha256=2UZOI09ZDRJuBYBjKbMyb2U4uASszoCMD5o_4ktRpvg,13480
7
- mcp_proxy_adapter/version.py,sha256=U9VBJQppSkQjL5EOllLdKKVHjyl_Tk1lHG4K0_MDaQ4,74
7
+ mcp_proxy_adapter/version.py,sha256=wRDfQ38mdcKlH3kpuhrq_rulJb1ijxBlJvKG-4iCCA4,74
8
8
  mcp_proxy_adapter/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  mcp_proxy_adapter/api/app.py,sha256=dIsAWbQFWMa8zxhPro9hxUnUuqnLWlqutWAKrqJIHGE,33386
10
10
  mcp_proxy_adapter/api/handlers.py,sha256=iyFGoEuUS1wxbV1ELA0zmaxIyQR7j4zw-4MrD-uIO6E,8294
@@ -111,11 +111,11 @@ mcp_proxy_adapter/examples/basic_framework/commands/__init__.py,sha256=_VQNLUEds
111
111
  mcp_proxy_adapter/examples/basic_framework/hooks/__init__.py,sha256=IE_EIXMnkdXuakZn7wLD9kBFyfDF5lYi56ejgiBeb-A,70
112
112
  mcp_proxy_adapter/examples/commands/__init__.py,sha256=zvY_OpH_B1bVc_khrNIl6O8vqCw1FH6gGMAsJAkGWGY,170
113
113
  mcp_proxy_adapter/examples/examples/basic_framework/__init__.py,sha256=4aYD--R6hy9n9CUxj7Osb9HcdVUMJ6_cfpu4ujkbCwI,345
114
- mcp_proxy_adapter/examples/examples/basic_framework/main.py,sha256=tumfMyKV45eC7sdUM-Uz4ePIlgP01BC5zzGqEmttHYc,1748
114
+ mcp_proxy_adapter/examples/examples/basic_framework/main.py,sha256=Vg8LMaXPsHUccfZlNWA2XVaJ1t7FDCK8nPshAVJAhxU,1776
115
115
  mcp_proxy_adapter/examples/examples/basic_framework/commands/__init__.py,sha256=_VQNLUEdsxUG-4yt9BZI_vtOxHAdGG0OUSsP6Wj-Vz4,76
116
116
  mcp_proxy_adapter/examples/examples/basic_framework/hooks/__init__.py,sha256=IE_EIXMnkdXuakZn7wLD9kBFyfDF5lYi56ejgiBeb-A,70
117
117
  mcp_proxy_adapter/examples/examples/full_application/__init__.py,sha256=xGiPYhRAzs1Fh9wA8HoowV-Gg9QMLaMZn-OamExq1TI,320
118
- mcp_proxy_adapter/examples/examples/full_application/main.py,sha256=V61KoAxnl3w9CSbC0rZBjJ61j24qQyXaRL67ZDgbku0,7848
118
+ mcp_proxy_adapter/examples/examples/full_application/main.py,sha256=i5o9prWKQv6EXUyNZQERlfah9q-GoloKMQHOVqnQIgo,1991
119
119
  mcp_proxy_adapter/examples/examples/full_application/proxy_endpoints.py,sha256=Kt_WAsG61HLTMkKQ1mQqjvlX9I4TcfwYq0NaRR9HKvM,6179
120
120
  mcp_proxy_adapter/examples/examples/full_application/commands/__init__.py,sha256=yQHxVSFkAyFLUOdk42QOebUODPlQV9IbydPgF3UKsGM,217
121
121
  mcp_proxy_adapter/examples/examples/full_application/commands/custom_echo_command.py,sha256=H7FPJmVJNWT61rPWxep06-7hsYRt8XYBUSBiwqpBurU,3096
@@ -140,8 +140,8 @@ mcp_proxy_adapter/schemas/base_schema.json,sha256=v9G9cGMd4dRhCZsOQ_FMqOi5VFyVbI
140
140
  mcp_proxy_adapter/schemas/openapi_schema.json,sha256=C3yLkwmDsvnLW9B5gnKKdBGl4zxkeU-rEmjTrNVsQU0,8405
141
141
  mcp_proxy_adapter/utils/config_generator.py,sha256=UXxuxxAyKTesAS3DOofQ26e20v771inA7EfBV8PZD1c,47543
142
142
  mcp_proxy_adapter_issue_package/demonstrate_issue.py,sha256=O54fwWQvUAjEGiHhQGm1JLnARkhVCwAqjBk_89HyRbY,7894
143
- mcp_proxy_adapter-6.4.7.dist-info/METADATA,sha256=FFvSaqYb_wpUR3D-nMam7Ovtc8iqWn9AaV2kr56bWE4,22403
144
- mcp_proxy_adapter-6.4.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
145
- mcp_proxy_adapter-6.4.7.dist-info/entry_points.txt,sha256=J3eV6ID0lt_VSp4lIdIgBFTqLCThgObNNxRCbyfiMHw,70
146
- mcp_proxy_adapter-6.4.7.dist-info/top_level.txt,sha256=CHk-Mc-AxjO-tRheegA2qLiQnU4vZRnxuTF81So6SAc,50
147
- mcp_proxy_adapter-6.4.7.dist-info/RECORD,,
143
+ mcp_proxy_adapter-6.4.8.dist-info/METADATA,sha256=aXTynCvsrABCBcjbhnf1ooGNqwaEi6sZ3J_oHlyimUo,22403
144
+ mcp_proxy_adapter-6.4.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
145
+ mcp_proxy_adapter-6.4.8.dist-info/entry_points.txt,sha256=J3eV6ID0lt_VSp4lIdIgBFTqLCThgObNNxRCbyfiMHw,70
146
+ mcp_proxy_adapter-6.4.8.dist-info/top_level.txt,sha256=CHk-Mc-AxjO-tRheegA2qLiQnU4vZRnxuTF81So6SAc,50
147
+ mcp_proxy_adapter-6.4.8.dist-info/RECORD,,