mcp-proxy-adapter 6.4.5__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.
@@ -340,38 +340,41 @@ async def create_and_run_server(
340
340
  print(" Use Ctrl+C to stop the server")
341
341
  print("=" * 60)
342
342
 
343
- # Use uvicorn for better FastAPI compatibility
344
- import uvicorn
343
+ # Use hypercorn directly
344
+ import hypercorn.asyncio
345
+ import hypercorn.config
345
346
  import asyncio
346
347
 
347
- # Configure uvicorn
348
- uvicorn_config = uvicorn.Config(
349
- app=app,
350
- host=server_config["host"],
351
- port=server_config["port"],
352
- log_level=server_config.get("log_level", "info"),
353
- reload=False,
354
- )
348
+ # Configure hypercorn
349
+ config_hypercorn = hypercorn.config.Config()
350
+ config_hypercorn.bind = [f"{server_config['host']}:{server_config['port']}"]
351
+ config_hypercorn.loglevel = server_config.get("log_level", "info")
355
352
 
356
353
  # Add SSL configuration if present
357
354
  if "certfile" in server_config:
358
- uvicorn_config.ssl_certfile = server_config["certfile"]
355
+ config_hypercorn.certfile = server_config["certfile"]
359
356
  if "keyfile" in server_config:
360
- uvicorn_config.ssl_keyfile = server_config["keyfile"]
357
+ config_hypercorn.keyfile = server_config["keyfile"]
361
358
  if "ca_certs" in server_config:
362
- uvicorn_config.ssl_ca_certs = server_config["ca_certs"]
359
+ config_hypercorn.ca_certs = server_config["ca_certs"]
360
+ if "verify_mode" in server_config:
361
+ import ssl
362
+ # Use the verify_mode from configuration, default to CERT_NONE
363
+ verify_mode = getattr(ssl, server_config["verify_mode"], ssl.CERT_NONE)
364
+ config_hypercorn.verify_mode = verify_mode
363
365
 
364
366
  # Determine if SSL is enabled
365
367
  ssl_enabled = any(key in server_config for key in ["certfile", "keyfile"])
366
368
 
367
369
  if ssl_enabled:
368
- print(f"🔐 Starting HTTPS server with uvicorn...")
370
+ print(f"🔐 Starting HTTPS server with hypercorn...")
369
371
  else:
370
- print(f"🌐 Starting HTTP server with uvicorn...")
372
+ print(f"🌐 Starting HTTP server with hypercorn...")
371
373
 
372
- # Create and run uvicorn server
373
- server = uvicorn.Server(uvicorn_config)
374
- await server.serve()
374
+ # Run the server
375
+ # hypercorn.asyncio.serve() should be run with asyncio.run(), not awaited
376
+ # The function is designed to be the main entry point, not a coroutine to await
377
+ await hypercorn.asyncio.serve(app, config_hypercorn)
375
378
 
376
379
  except KeyboardInterrupt:
377
380
  print("\n🛑 Server stopped by user")
@@ -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.5"
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.5
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
@@ -30,7 +30,6 @@ Description-Content-Type: text/markdown
30
30
  Requires-Dist: fastapi<1.0.0,>=0.95.0
31
31
  Requires-Dist: pydantic>=2.0.0
32
32
  Requires-Dist: hypercorn<1.0.0,>=0.15.0
33
- Requires-Dist: uvicorn<1.0.0,>=0.22.0
34
33
  Requires-Dist: docstring-parser<1.0.0,>=0.15
35
34
  Requires-Dist: typing-extensions<5.0.0,>=4.5.0
36
35
  Requires-Dist: jsonrpc>=1.2.0
@@ -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=zK2Dhs_fouIY-JZmk040_rQOrWZz-U3znGMwhn_7O3Q,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
@@ -53,7 +53,7 @@ mcp_proxy_adapter/commands/token_management_command.py,sha256=tCVjhWqAQ3KhcwSsZU
53
53
  mcp_proxy_adapter/commands/transport_management_command.py,sha256=HEnUyL4S014jheyBwO90u9gnzk0qxBlOJdC_0Sxhq9E,4585
54
54
  mcp_proxy_adapter/commands/unload_command.py,sha256=6CUM9B9c-mNxw7uvt2vcvZSnxMySfoMT5UmDhzNXq38,4984
55
55
  mcp_proxy_adapter/core/__init__.py,sha256=3yt0CFZdsIG8Ln4bg-r4ISYzipm3ZUAxTn0twYTs9FI,867
56
- mcp_proxy_adapter/core/app_factory.py,sha256=5Kug6gPqC0JU_OUgDgHOsnEdsP8Z8KtDDZQThD5A7vg,19127
56
+ mcp_proxy_adapter/core/app_factory.py,sha256=oMVEmQIrk6GYyi78rpAzQSH6K0Fq9auv_ByjaQWDUww,19539
57
57
  mcp_proxy_adapter/core/app_runner.py,sha256=1t9p_UkWb1IvZDTD7FOCRMNSpOSgtNeHM3i7PP7x6xc,10605
58
58
  mcp_proxy_adapter/core/auth_validator.py,sha256=q8TNkdolvP-gM6Bvecc6nrVG9al5J31pocdwhguhTBk,19742
59
59
  mcp_proxy_adapter/core/certificate_utils.py,sha256=yeDwi-j42CxK_g-r5_ragGFY_HdSgDfTWHVUjDHF6nI,38480
@@ -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.5.dist-info/METADATA,sha256=ZjmpgjQpSQgbvCfR6KZFiSpKF3LtLoybzscadY9cb-I,22441
144
- mcp_proxy_adapter-6.4.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
145
- mcp_proxy_adapter-6.4.5.dist-info/entry_points.txt,sha256=J3eV6ID0lt_VSp4lIdIgBFTqLCThgObNNxRCbyfiMHw,70
146
- mcp_proxy_adapter-6.4.5.dist-info/top_level.txt,sha256=CHk-Mc-AxjO-tRheegA2qLiQnU4vZRnxuTF81So6SAc,50
147
- mcp_proxy_adapter-6.4.5.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,,