mcp-proxy-adapter 6.6.4__py3-none-any.whl → 6.6.7__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.
@@ -86,10 +86,20 @@ def create_lifespan(config_path: Optional[str] = None):
86
86
  public_port = reg_cfg.get("public_port")
87
87
 
88
88
  # Check SSL configuration from new structure
89
- protocol = config.get("server.protocol", "http")
90
- verify_client = config.get("transport.verify_client", False)
91
- ssl_enabled = protocol in ["https", "mtls"] or verify_client
92
- protocol = "https" if ssl_enabled else "http"
89
+ # Priority: registration.protocol > server.protocol > fallback to http
90
+ reg_cfg = config.get("registration", {})
91
+ registration_protocol = reg_cfg.get("protocol")
92
+ server_protocol = config.get("server.protocol", "http")
93
+
94
+ if registration_protocol:
95
+ # Use protocol from registration configuration
96
+ # Convert mtls to https for URL construction (mTLS is still HTTPS)
97
+ protocol = "https" if registration_protocol == "mtls" else registration_protocol
98
+ else:
99
+ # Fallback to server protocol
100
+ verify_client = config.get("transport.verify_client", False)
101
+ ssl_enabled = server_protocol in ["https", "mtls"] or verify_client
102
+ protocol = "https" if ssl_enabled else "http"
93
103
 
94
104
  import os
95
105
  docker_host_addr = os.getenv("DOCKER_HOST_ADDR", "172.17.0.1")
@@ -135,10 +145,20 @@ def create_lifespan(config_path: Optional[str] = None):
135
145
  public_port = reg_cfg.get("public_port")
136
146
 
137
147
  # Determine protocol using the new configuration structure
138
- protocol_cfg = final_config.get("server", {}).get("protocol", "http")
139
- verify_client_cfg = final_config.get("transport", {}).get("verify_client", False)
140
- ssl_enabled_final = protocol_cfg in ["https", "mtls"] or verify_client_cfg
141
- protocol = "https" if ssl_enabled_final else "http"
148
+ # Priority: registration.protocol > server.protocol > fallback to http
149
+ reg_cfg = final_config.get("registration", final_config.get("proxy_registration", {}))
150
+ registration_protocol = reg_cfg.get("protocol")
151
+ server_protocol = final_config.get("server", {}).get("protocol", "http")
152
+
153
+ if registration_protocol:
154
+ # Use protocol from registration configuration
155
+ # Convert mtls to https for URL construction (mTLS is still HTTPS)
156
+ protocol = "https" if registration_protocol == "mtls" else registration_protocol
157
+ else:
158
+ # Fallback to server protocol
159
+ verify_client_cfg = final_config.get("transport", {}).get("verify_client", False)
160
+ ssl_enabled_final = server_protocol in ["https", "mtls"] or verify_client_cfg
161
+ protocol = "https" if ssl_enabled_final else "http"
142
162
 
143
163
  import os
144
164
  docker_host_addr = os.getenv("DOCKER_HOST_ADDR", "172.17.0.1")
@@ -76,9 +76,27 @@ class ConfigBuilder:
76
76
  },
77
77
  "transport": {
78
78
  "type": "http",
79
- "port": None,
79
+ "port": None,
80
80
  "verify_client": False,
81
81
  "chk_hostname": False
82
+ },
83
+ "registration": {
84
+ "enabled": False,
85
+ "proxy_url": "http://localhost:3004",
86
+ "public_host": None,
87
+ "public_port": None,
88
+ "protocol": None, # Will be set based on server protocol
89
+ "server_id": "mcp_proxy_adapter",
90
+ "server_name": "MCP Proxy Adapter",
91
+ "description": "JSON-RPC API for interacting with MCP Proxy",
92
+ "version": "6.6.7",
93
+ "heartbeat": {
94
+ "enabled": True,
95
+ "interval": 30,
96
+ "timeout": 10,
97
+ "retry_attempts": 3,
98
+ "retry_delay": 5
99
+ }
82
100
  }
83
101
  }
84
102
 
@@ -86,6 +104,9 @@ class ConfigBuilder:
86
104
  """Set protocol configuration (HTTP, HTTPS, or mTLS)."""
87
105
  self.config["server"]["protocol"] = protocol.value
88
106
 
107
+ # Set registration protocol to match server protocol
108
+ self.config["registration"]["protocol"] = protocol.value
109
+
89
110
  if protocol == Protocol.HTTP:
90
111
  # HTTP - no SSL, no client verification
91
112
  self.config["transport"]["verify_client"] = False
@@ -150,6 +171,25 @@ class ConfigBuilder:
150
171
  self.config["security"]["roles_file"] = roles_file
151
172
  return self
152
173
 
174
+ def set_proxy_registration(self, enabled: bool = True, proxy_url: str = "http://localhost:3004",
175
+ public_host: Optional[str] = None, public_port: Optional[int] = None,
176
+ server_id: str = "mcp_proxy_adapter", server_name: str = "MCP Proxy Adapter",
177
+ description: str = "JSON-RPC API for interacting with MCP Proxy"):
178
+ """Set proxy registration configuration."""
179
+ self.config["registration"]["enabled"] = enabled
180
+ self.config["registration"]["proxy_url"] = proxy_url
181
+ self.config["registration"]["public_host"] = public_host
182
+ self.config["registration"]["public_port"] = public_port
183
+ self.config["registration"]["server_id"] = server_id
184
+ self.config["registration"]["server_name"] = server_name
185
+ self.config["registration"]["description"] = description
186
+
187
+ # Set protocol to match server protocol if not explicitly set
188
+ if self.config["registration"]["protocol"] is None:
189
+ self.config["registration"]["protocol"] = self.config["server"]["protocol"]
190
+
191
+ return self
192
+
153
193
  def build(self) -> Dict[str, Any]:
154
194
  """Build and return the configuration."""
155
195
  return self.config.copy()
@@ -240,9 +280,37 @@ class ConfigFactory:
240
280
  .set_auth(AuthMethod.TOKEN_ROLES)
241
281
  .set_server(port=port)
242
282
  .build())
283
+
284
+ @staticmethod
285
+ def create_http_with_proxy_config(port: int = 8009, proxy_url: str = "http://localhost:3004") -> Dict[str, Any]:
286
+ """Create HTTP configuration with proxy registration."""
287
+ return (ConfigBuilder()
288
+ .set_protocol(Protocol.HTTP)
289
+ .set_server(port=port)
290
+ .set_proxy_registration(proxy_url=proxy_url)
291
+ .build())
292
+
293
+ @staticmethod
294
+ def create_https_with_proxy_config(port: int = 8010, proxy_url: str = "https://localhost:3004") -> Dict[str, Any]:
295
+ """Create HTTPS configuration with proxy registration."""
296
+ return (ConfigBuilder()
297
+ .set_protocol(Protocol.HTTPS)
298
+ .set_server(port=port)
299
+ .set_proxy_registration(proxy_url=proxy_url)
300
+ .build())
301
+
302
+ @staticmethod
303
+ def create_mtls_with_proxy_config(port: int = 8011, proxy_url: str = "https://localhost:3004") -> Dict[str, Any]:
304
+ """Create mTLS configuration with proxy registration."""
305
+ return (ConfigBuilder()
306
+ .set_protocol(Protocol.MTLS)
307
+ .set_server(port=port)
308
+ .set_proxy_registration(proxy_url=proxy_url)
309
+ .build())
243
310
 
244
311
 
245
- def create_config_from_flags(protocol: str, token: bool = False, roles: bool = False, port: int = 8000) -> Dict[str, Any]:
312
+ def create_config_from_flags(protocol: str, token: bool = False, roles: bool = False, port: int = 8000,
313
+ proxy_registration: bool = False, proxy_url: str = "http://localhost:3004") -> Dict[str, Any]:
246
314
  """
247
315
  Create configuration from command line flags.
248
316
 
@@ -251,6 +319,8 @@ def create_config_from_flags(protocol: str, token: bool = False, roles: bool = F
251
319
  token: Enable token authentication
252
320
  roles: Enable role-based access control
253
321
  port: Server port
322
+ proxy_registration: Enable proxy registration
323
+ proxy_url: Proxy URL for registration
254
324
 
255
325
  Returns:
256
326
  Configuration dictionary
@@ -273,6 +343,10 @@ def create_config_from_flags(protocol: str, token: bool = False, roles: bool = F
273
343
  else:
274
344
  builder.set_auth(AuthMethod.NONE)
275
345
 
346
+ # Enable proxy registration if requested
347
+ if proxy_registration:
348
+ builder.set_proxy_registration(proxy_url=proxy_url)
349
+
276
350
  return builder.build()
277
351
 
278
352
 
@@ -26,7 +26,9 @@ def create_config_from_flags(
26
26
  port: int = 8000,
27
27
  cert_dir: str = "./certs",
28
28
  key_dir: str = "./keys",
29
- output_dir: str = "./configs"
29
+ output_dir: str = "./configs",
30
+ proxy_registration: bool = False,
31
+ proxy_url: str = "http://localhost:3004"
30
32
  ) -> Dict[str, Any]:
31
33
  """
32
34
  Create configuration based on command line flags.
@@ -47,7 +49,7 @@ def create_config_from_flags(
47
49
  # Use the simplified config builder
48
50
  from config_builder import create_config_from_flags as simple_create_config
49
51
 
50
- return simple_create_config(protocol, token, roles, port)
52
+ return simple_create_config(protocol, token, roles, port, proxy_registration, proxy_url)
51
53
 
52
54
 
53
55
  def save_config(config: Dict[str, Any], filename: str, output_dir: str) -> Path:
@@ -238,6 +240,9 @@ Examples:
238
240
 
239
241
  # Generate mTLS configuration with roles
240
242
  python generate_config.py --protocol mtls --roles
243
+
244
+ # Generate mTLS configuration with proxy registration
245
+ python generate_config.py --protocol mtls --proxy-registration --proxy-url https://mcp-proxy:3004
241
246
  """
242
247
  )
243
248
 
@@ -248,6 +253,10 @@ Examples:
248
253
  help="Enable token authentication")
249
254
  parser.add_argument("--roles", action="store_true",
250
255
  help="Enable role-based access control")
256
+ parser.add_argument("--proxy-registration", action="store_true",
257
+ help="Enable proxy registration")
258
+ parser.add_argument("--proxy-url", default="http://localhost:3004",
259
+ help="Proxy URL for registration (default: http://localhost:3004)")
251
260
  parser.add_argument("--all", action="store_true",
252
261
  help="Generate all standard configurations")
253
262
  parser.add_argument("--full-config", action="store_true",
@@ -307,7 +316,9 @@ Examples:
307
316
  port=args.port,
308
317
  cert_dir=args.cert_dir,
309
318
  key_dir=args.key_dir,
310
- output_dir=args.output_dir
319
+ output_dir=args.output_dir,
320
+ proxy_registration=args.proxy_registration,
321
+ proxy_url=args.proxy_url
311
322
  )
312
323
 
313
324
  if args.stdout:
@@ -2,4 +2,4 @@
2
2
  Version information for MCP Proxy Adapter.
3
3
  """
4
4
 
5
- __version__ = "6.6.4"
5
+ __version__ = "6.6.7"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-proxy-adapter
3
- Version: 6.6.4
3
+ Version: 6.6.7
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,9 +4,9 @@ mcp_proxy_adapter/config.py,sha256=QpoPaUKcWJ-eu6HYphhIZmkc2M-p1JgpLFAgolf_l5s,2
4
4
  mcp_proxy_adapter/custom_openapi.py,sha256=XRviX-C-ZkSKdBhORhDTdeN_1FWyEfXZADiASft3t9I,28149
5
5
  mcp_proxy_adapter/main.py,sha256=eXIRMLgDgCox9p2WDcOS9D6tiZjcFit8ePbFCfGbs3Q,5849
6
6
  mcp_proxy_adapter/openapi.py,sha256=2UZOI09ZDRJuBYBjKbMyb2U4uASszoCMD5o_4ktRpvg,13480
7
- mcp_proxy_adapter/version.py,sha256=iHKhx47r6lqg0YU6oEtF4CqcNCHws1gitETKpsxxgRs,74
7
+ mcp_proxy_adapter/version.py,sha256=1KGkkI9iAy3ZsUkZ-JR6TtuRIwky4wIxyf7FsGAVGeQ,74
8
8
  mcp_proxy_adapter/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- mcp_proxy_adapter/api/app.py,sha256=c6QgiKBYC4YlPW-a8ZnsQ05CJqjtGEMfEnbvdp19ylE,35148
9
+ mcp_proxy_adapter/api/app.py,sha256=WxSQeYSSDrh-Z3A4TzqNRDaTCsWGZNdhR7qiB7Psk1I,36306
10
10
  mcp_proxy_adapter/api/handlers.py,sha256=X-hcMNVeTAu4yVkKJEChEsj2bFptUS6sLNN-Wysjkow,10011
11
11
  mcp_proxy_adapter/api/schemas.py,sha256=mevUvQnYgWQfkJAs3-vq3HalBzh6-Saa-Au1VVf0peE,12377
12
12
  mcp_proxy_adapter/api/tool_integration.py,sha256=AeUyvJVN-c3FrX5fHdagHL51saRH5d1ZKqc2YEx0rTE,10147
@@ -86,14 +86,14 @@ mcp_proxy_adapter/examples/__init__.py,sha256=k1F-EotAFbJ3JvK_rNgiH4bUztmxIWtYn0
86
86
  mcp_proxy_adapter/examples/bugfix_certificate_config.py,sha256=YGBE_SI6wYZUJLWl7-fP1OWXiSH4mHJAZHApgQWvG7s,10529
87
87
  mcp_proxy_adapter/examples/cert_manager_bugfix.py,sha256=UWUwItjqHqSnOMHocsz40_3deoZE8-vdROLW9y2fEns,7259
88
88
  mcp_proxy_adapter/examples/check_config.py,sha256=oDP3cymq76TqEpPztPihH-_sBktiEb2cG0MdVrY1Sj8,14104
89
- mcp_proxy_adapter/examples/config_builder.py,sha256=Bd4Opggi9Nut4yQ5Mo_qETMcWRTls3BwwnNZd33Mvjs,9652
89
+ mcp_proxy_adapter/examples/config_builder.py,sha256=Vczefn_kqvdDzgmj0RMop3gfw_db4Gn8IqrWNZ-xhcE,13240
90
90
  mcp_proxy_adapter/examples/config_cli.py,sha256=ZhVG6XEpTFe5-MzELByVsUh0AD4bHPBZeoXnGWbqifs,11059
91
91
  mcp_proxy_adapter/examples/create_test_configs.py,sha256=9TrvLa4-bWLPu0SB1JXwWuCsjj-4Vz3yAdowcHtCSSA,8228
92
92
  mcp_proxy_adapter/examples/debug_request_state.py,sha256=Z3Gy2-fWtu7KIV9OkzGDLVz7TpL_h9V_99ica40uQBU,4489
93
93
  mcp_proxy_adapter/examples/debug_role_chain.py,sha256=GLVXC2fJUwP8UJnXHchd1t-H53cjWLJI3RqTPrKmaak,8750
94
94
  mcp_proxy_adapter/examples/demo_client.py,sha256=en2Rtb70B1sQmhL-vdQ4PDpKNNl_mfll2YCFT_jFCAg,10191
95
95
  mcp_proxy_adapter/examples/generate_certificates.py,sha256=cIfTHBziGiOTy9vldAmaULD6bXBpl2a5KfB8MLIRSww,16391
96
- mcp_proxy_adapter/examples/generate_config.py,sha256=hkjfCY7OdgMcqAJZH6I3JSKWI1VB64IEyT7RaokTb48,11461
96
+ mcp_proxy_adapter/examples/generate_config.py,sha256=Q0jxMnOh4U6f7MAxn0yTfqjRP5CNokXqeyTKcQhDlO8,12128
97
97
  mcp_proxy_adapter/examples/proxy_registration_example.py,sha256=vemRhftnjbiOBCJkmtDGqlWQ8syTG0a8755GCOnaQsg,12503
98
98
  mcp_proxy_adapter/examples/required_certificates.py,sha256=YW9-V78oFiZ-FmHlGP-8FQFS569VdDVyq9hfvCv31pk,7133
99
99
  mcp_proxy_adapter/examples/run_example.py,sha256=yp-a6HIrSk3ddQmbn0KkuKwErId0aNfj028TE6U-zmY,2626
@@ -130,8 +130,8 @@ mcp_proxy_adapter/schemas/base_schema.json,sha256=v9G9cGMd4dRhCZsOQ_FMqOi5VFyVbI
130
130
  mcp_proxy_adapter/schemas/openapi_schema.json,sha256=C3yLkwmDsvnLW9B5gnKKdBGl4zxkeU-rEmjTrNVsQU0,8405
131
131
  mcp_proxy_adapter/schemas/roles.json,sha256=pgf_ZyqKyXbfGUxvobpiLiSJz9zzxrMuoVWEkEpz3N8,764
132
132
  mcp_proxy_adapter/schemas/roles_schema.json,sha256=deHgI7L6GwfBXacOlNtDgDJelDThppClC3Ti4Eh8rJY,5659
133
- mcp_proxy_adapter-6.6.4.dist-info/METADATA,sha256=EEJhXaGOOOhiN-esLAqkguvXi_XGuyEDexIW1WqXSE0,8510
134
- mcp_proxy_adapter-6.6.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
135
- mcp_proxy_adapter-6.6.4.dist-info/entry_points.txt,sha256=Bf-O5Aq80n22Ayu9fI9BgidzWqwzIVaqextAddTuHZw,563
136
- mcp_proxy_adapter-6.6.4.dist-info/top_level.txt,sha256=JZT7vPLBYrtroX-ij68JBhJYbjDdghcV-DFySRy-Nnw,18
137
- mcp_proxy_adapter-6.6.4.dist-info/RECORD,,
133
+ mcp_proxy_adapter-6.6.7.dist-info/METADATA,sha256=Njb1B_VRuEjYawCnTtUicbRkYAb8q-iH7DHWd6bgeRI,8510
134
+ mcp_proxy_adapter-6.6.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
135
+ mcp_proxy_adapter-6.6.7.dist-info/entry_points.txt,sha256=Bf-O5Aq80n22Ayu9fI9BgidzWqwzIVaqextAddTuHZw,563
136
+ mcp_proxy_adapter-6.6.7.dist-info/top_level.txt,sha256=JZT7vPLBYrtroX-ij68JBhJYbjDdghcV-DFySRy-Nnw,18
137
+ mcp_proxy_adapter-6.6.7.dist-info/RECORD,,