mcp-proxy-adapter 6.2.0__py3-none-any.whl → 6.2.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.
@@ -16,7 +16,7 @@ from mcp_proxy_adapter.api.app import create_app
16
16
 
17
17
  def main():
18
18
  """Main CLI entry point."""
19
- print("MCP Proxy Adapter v6.2.0")
19
+ print("MCP Proxy Adapter v6.2.1")
20
20
  print("========================")
21
21
  print()
22
22
  print("Usage:")
@@ -13,4 +13,4 @@ Examples include:
13
13
  For detailed documentation, see the main README.md file.
14
14
  """
15
15
 
16
- __version__ = "6.2.0"
16
+ __version__ = "6.2.1"
@@ -2,5 +2,5 @@
2
2
  Version information for MCP Proxy Adapter.
3
3
  """
4
4
 
5
- __version__ = "6.2.0"
5
+ __version__ = "6.2.1"
6
6
 
@@ -1,35 +1,31 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-proxy-adapter
3
- Version: 6.2.0
4
- Summary: Model Context Protocol Proxy Adapter with Security Framework
3
+ Version: 6.2.1
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
7
- Author-email: Vasiliy Zdanovskiy <vasilyvz@gmail.com>
8
- Maintainer-email: Vasiliy Zdanovskiy <vasilyvz@gmail.com>
9
- License: MIT
7
+ Author-email: vasilyvz@gmail.com
10
8
  Project-URL: Homepage, https://github.com/maverikod/mcp-proxy-adapter
11
9
  Project-URL: Documentation, https://github.com/maverikod/mcp-proxy-adapter#readme
12
10
  Project-URL: Source, https://github.com/maverikod/mcp-proxy-adapter
13
11
  Project-URL: Tracker, https://github.com/maverikod/mcp-proxy-adapter/issues
14
12
  Project-URL: PyPI, https://pypi.org/project/mcp-proxy-adapter/
15
13
  Keywords: json-rpc,microservices,fastapi,security,authentication,authorization,proxy,mcp,mtls,ssl,rest,api
16
- Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Development Status :: 4 - Beta
17
15
  Classifier: Intended Audience :: Developers
18
16
  Classifier: License :: OSI Approved :: MIT License
19
17
  Classifier: Operating System :: OS Independent
20
18
  Classifier: Programming Language :: Python :: 3
21
- Classifier: Programming Language :: Python :: 3.8
22
19
  Classifier: Programming Language :: Python :: 3.9
23
20
  Classifier: Programming Language :: Python :: 3.10
24
21
  Classifier: Programming Language :: Python :: 3.11
25
22
  Classifier: Programming Language :: Python :: 3.12
26
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Framework :: FastAPI
27
24
  Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
28
25
  Classifier: Topic :: Security
29
- Classifier: Framework :: FastAPI
26
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
30
27
  Requires-Python: >=3.9
31
28
  Description-Content-Type: text/markdown
32
- License-File: LICENSE
33
29
  Requires-Dist: fastapi<1.0.0,>=0.95.0
34
30
  Requires-Dist: pydantic>=2.0.0
35
31
  Requires-Dist: hypercorn<1.0.0,>=0.15.0
@@ -40,29 +36,22 @@ Requires-Dist: psutil>=5.9.0
40
36
  Requires-Dist: mcp_security_framework>=1.0.0
41
37
  Provides-Extra: dev
42
38
  Requires-Dist: pytest>=7.0.0; extra == "dev"
43
- Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
39
+ Requires-Dist: pytest-asyncio>=0.20.0; extra == "dev"
44
40
  Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
45
41
  Requires-Dist: black>=23.0.0; extra == "dev"
46
42
  Requires-Dist: isort>=5.12.0; extra == "dev"
47
- Requires-Dist: flake8>=6.0.0; extra == "dev"
48
- Requires-Dist: mypy>=1.0.0; extra == "dev"
49
- Requires-Dist: pre-commit>=3.0.0; extra == "dev"
50
- Requires-Dist: httpx>=0.24.0; extra == "dev"
51
- Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
52
- Provides-Extra: test
53
- Requires-Dist: pytest>=7.0.0; extra == "test"
54
- Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
55
- Requires-Dist: pytest-cov>=4.0.0; extra == "test"
56
- Requires-Dist: httpx>=0.24.0; extra == "test"
57
- Requires-Dist: pytest-mock>=3.10.0; extra == "test"
58
- Provides-Extra: docs
59
- Requires-Dist: mkdocs>=1.4.0; extra == "docs"
60
- Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
61
- Requires-Dist: mkdocstrings[python]>=0.20.0; extra == "docs"
62
43
  Dynamic: author
44
+ Dynamic: author-email
45
+ Dynamic: classifier
46
+ Dynamic: description
47
+ Dynamic: description-content-type
63
48
  Dynamic: home-page
64
- Dynamic: license-file
49
+ Dynamic: keywords
50
+ Dynamic: project-url
51
+ Dynamic: provides-extra
52
+ Dynamic: requires-dist
65
53
  Dynamic: requires-python
54
+ Dynamic: summary
66
55
 
67
56
  # MCP Proxy Adapter
68
57
 
@@ -656,7 +645,7 @@ MIT License - see [LICENSE](https://github.com/maverikod/mcp-proxy-adapter/blob/
656
645
 
657
646
  ## 📊 Version
658
647
 
659
- **6.2.0** - Production-ready release with comprehensive security, proxy registration, and PyPI optimization.
648
+ **6.2.1** - Production-ready release with comprehensive security, proxy registration, and PyPI optimization.
660
649
 
661
650
  ---
662
651
 
@@ -1,10 +1,10 @@
1
1
  mcp_proxy_adapter/__init__.py,sha256=B7m1YWyv_Wb87-Q-JqVpHQgwajnfIgDyZ_iIxzdTbBY,1021
2
- mcp_proxy_adapter/__main__.py,sha256=zqP3eDdflTGyieH1Ji0wUC6sFsIGF8bz1wvQxqmQh54,768
2
+ mcp_proxy_adapter/__main__.py,sha256=jxXP9WnXJvuIlurBnTCu3dt9jL-K1wA6VfPnjdGatg0,768
3
3
  mcp_proxy_adapter/config.py,sha256=z4rUbJdxYj6vYw05OM_kMXs1Qn2HRQXGHI9PB4hgPd4,12867
4
4
  mcp_proxy_adapter/custom_openapi.py,sha256=jYUrCy8C1mShh3sjKj-JkzSMLAvxDLTvtzSJFj5HUNg,15023
5
5
  mcp_proxy_adapter/main.py,sha256=_DJwMZdN0393UR-U7xfQh59EpbDDgv1oWPFf-v2MoII,2147
6
6
  mcp_proxy_adapter/openapi.py,sha256=36vOEbJjGnVZR6hUhl6mHCD29HYOEFKo2bL0JdGSm-4,13952
7
- mcp_proxy_adapter/version.py,sha256=5XpB9jkhQ99ZBEmurIcfaHU0LT9H9I25B95HAPSeUO4,75
7
+ mcp_proxy_adapter/version.py,sha256=7alALj2xnhN0mIeNQ1R7XRGv1R6iGUjP4UWziMB1Kys,75
8
8
  mcp_proxy_adapter/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  mcp_proxy_adapter/api/app.py,sha256=pYrsDWhZAYoYbxujD0MGeOWdTnBUGueIGmZqeAbaB9A,27884
10
10
  mcp_proxy_adapter/api/handlers.py,sha256=DcZT7MVBV33q-0EJ0iFqxE0VgBkFt6d_SqoRkntwyvc,8477
@@ -80,7 +80,7 @@ mcp_proxy_adapter/core/ssl_utils.py,sha256=_2mhpuoiRpSbUBifnQvtuziQfBRrXQUKtB58A
80
80
  mcp_proxy_adapter/core/transport_manager.py,sha256=ppcgjO-7Ulrk1ovlzlXVM89Iw4VOGA3awKgLf7FFAJ0,9518
81
81
  mcp_proxy_adapter/core/unified_config_adapter.py,sha256=cpN_VrliIFGDH3JsfRkTlFdQvLcmuMYYedq0QEzlb0Y,22857
82
82
  mcp_proxy_adapter/core/utils.py,sha256=ly8Ttg2v1OBukThJLxudRvmttU1hxJFLJUfat4b2dOI,3268
83
- mcp_proxy_adapter/examples/__init__.py,sha256=QoJygjdbKmwcW2x113M_TwYp_6hMtKt8XuGvK4Gxl74,449
83
+ mcp_proxy_adapter/examples/__init__.py,sha256=vmf512vnxGHNoHQVJOEoLQ3pFZYO2P7Owhf4ot_c7SE,449
84
84
  mcp_proxy_adapter/examples/create_certificates_simple.py,sha256=2KS-s3amvAqasvdh-cxY7ARuFAHVjtbtr_EJF2SKVQ0,23221
85
85
  mcp_proxy_adapter/examples/debug_request_state.py,sha256=x_H3NIlkmIS6lZimvEM6kCXxGdpgFw99Sdui8qa_qeU,4347
86
86
  mcp_proxy_adapter/examples/debug_role_chain.py,sha256=33l2Tk5mrcnwPFwqm2NTHcrWaJrXUU2wxW2I6Y4uIg4,8344
@@ -113,10 +113,7 @@ mcp_proxy_adapter/examples/full_application/commands/dynamic_calculator_command.
113
113
  mcp_proxy_adapter/examples/full_application/hooks/__init__.py,sha256=ORG4cL8cSXEMmZ0CEPz75OVuwg54pdDm2GIBpP4dtcs,200
114
114
  mcp_proxy_adapter/examples/full_application/hooks/application_hooks.py,sha256=TYXuHI-KW_mH5r8mSKgNMJCr3moeEKrqC4Eex0U298k,3457
115
115
  mcp_proxy_adapter/examples/full_application/hooks/builtin_command_hooks.py,sha256=IaskSrckZS6bE3aGxSBL8aTj-iJTSI2ysfsFjhjncyM,2975
116
- mcp_proxy_adapter/utils/config_generator.py,sha256=9vFN2UqUXkO-DgztZSnA0cH3cmMQar6WdtTOzz6xBio,32074
117
- mcp_proxy_adapter-6.2.0.dist-info/licenses/LICENSE,sha256=6KdtUcTwmTRbJrAmYjVn7e6S-V42ubeDJ-AiVEzZ510,1075
118
- mcp_proxy_adapter-6.2.0.dist-info/METADATA,sha256=3n-3nXervlNaJb7fUgKIqXSLZ9REI_4ZSgXAWqH6Yhs,22688
119
- mcp_proxy_adapter-6.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
120
- mcp_proxy_adapter-6.2.0.dist-info/entry_points.txt,sha256=J3eV6ID0lt_VSp4lIdIgBFTqLCThgObNNxRCbyfiMHw,70
121
- mcp_proxy_adapter-6.2.0.dist-info/top_level.txt,sha256=JZT7vPLBYrtroX-ij68JBhJYbjDdghcV-DFySRy-Nnw,18
122
- mcp_proxy_adapter-6.2.0.dist-info/RECORD,,
116
+ mcp_proxy_adapter-6.2.1.dist-info/METADATA,sha256=XlCYkwOYXSpXiOawdUWc6TV6Bpu8jQDF2_2H-1tx3nE,22047
117
+ mcp_proxy_adapter-6.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
118
+ mcp_proxy_adapter-6.2.1.dist-info/top_level.txt,sha256=JZT7vPLBYrtroX-ij68JBhJYbjDdghcV-DFySRy-Nnw,18
119
+ mcp_proxy_adapter-6.2.1.dist-info/RECORD,,
@@ -1,727 +0,0 @@
1
- """
2
- Configuration Generator Utility
3
-
4
- This module provides utilities for generating comprehensive configuration files
5
- that combine mcp_proxy_adapter and mcp_security_framework configurations.
6
-
7
- Author: Vasiliy Zdanovskiy
8
- email: vasilyvz@gmail.com
9
- """
10
-
11
- import json
12
- import logging
13
- from pathlib import Path
14
- from typing import Dict, Any, Optional
15
-
16
- # Use standard logging instead of project logger to avoid circular imports
17
- logger = logging.getLogger(__name__)
18
-
19
-
20
- class ConfigGenerator:
21
- """
22
- Configuration generator for unified mcp_proxy_adapter and mcp_security_framework configs.
23
-
24
- Generates comprehensive configuration files with detailed comments and examples
25
- for both the proxy adapter and security framework components.
26
- """
27
-
28
- def __init__(self):
29
- """Initialize configuration generator."""
30
- self.template_config = self._get_template_config()
31
-
32
- def _get_template_config(self) -> Dict[str, Any]:
33
- """Get template configuration with all available options."""
34
- return {
35
- "server": {
36
- "host": "0.0.0.0",
37
- "port": 8000,
38
- "debug": False,
39
- "log_level": "INFO",
40
- "workers": 1,
41
- "reload": False
42
- },
43
- "ssl": {
44
- "enabled": False,
45
- "cert_file": None,
46
- "key_file": None,
47
- "ca_cert": None,
48
- "verify_client": False,
49
- "client_cert_required": False,
50
- "cipher_suites": ["TLS_AES_256_GCM_SHA384", "TLS_CHACHA20_POLY1305_SHA256"],
51
- "min_tls_version": "TLSv1.2",
52
- "max_tls_version": "1.3"
53
- },
54
- "security": {
55
- "framework": "mcp_security_framework",
56
- "enabled": True,
57
- "debug": False,
58
- "environment": "dev",
59
- "version": "1.0.0",
60
-
61
- "ssl": {
62
- "enabled": False,
63
- "cert_file": None,
64
- "key_file": None,
65
- "ca_cert_file": None,
66
- "client_cert_file": None,
67
- "client_key_file": None,
68
- "verify_mode": "CERT_REQUIRED",
69
- "min_tls_version": "TLSv1.2",
70
- "max_tls_version": None,
71
- "cipher_suite": None,
72
- "check_hostname": True,
73
- "check_expiry": True,
74
- "expiry_warning_days": 30
75
- },
76
-
77
- "auth": {
78
- "enabled": False,
79
- "methods": [],
80
- "api_keys": {},
81
- "user_roles": {},
82
- "jwt_secret": None,
83
- "jwt_algorithm": "HS256",
84
- "jwt_expiry_hours": 24,
85
- "certificate_auth": False,
86
- "certificate_roles_oid": "1.3.6.1.4.1.99999.1.1",
87
- "certificate_permissions_oid": "1.3.6.1.4.1.99999.1.2",
88
- "basic_auth": False,
89
- "oauth2_config": None,
90
- "public_paths": ["/health", "/docs", "/openapi.json"],
91
- "security_headers": {
92
- "X-Content-Type-Options": "nosniff",
93
- "X-Frame-Options": "DENY",
94
- "X-XSS-Protection": "1; mode=block",
95
- "Strict-Transport-Security": "max-age=31536000; includeSubDomains"
96
- }
97
- },
98
-
99
- "certificates": {
100
- "enabled": False,
101
- "ca_cert_path": None,
102
- "ca_key_path": None,
103
- "cert_storage_path": "mcp_proxy_adapter/examples/certs",
104
- "key_storage_path": "mcp_proxy_adapter/examples/keys",
105
- "default_validity_days": 365,
106
- "key_size": 2048,
107
- "hash_algorithm": "sha256",
108
- "crl_enabled": False,
109
- "crl_path": None,
110
- "crl_validity_days": 30,
111
- "auto_renewal": False,
112
- "renewal_threshold_days": 30
113
- },
114
-
115
- "permissions": {
116
- "enabled": False,
117
- "roles_file": None,
118
- "default_role": "guest",
119
- "admin_role": "admin",
120
- "role_hierarchy": {},
121
- "permission_cache_enabled": False,
122
- "permission_cache_ttl": 300,
123
- "wildcard_permissions": False,
124
- "strict_mode": False,
125
- "roles": {}
126
- },
127
-
128
- "rate_limit": {
129
- "enabled": False,
130
- "default_requests_per_minute": 60,
131
- "default_requests_per_hour": 1000,
132
- "burst_limit": 2,
133
- "window_size_seconds": 60,
134
- "storage_backend": "memory",
135
- "redis_config": None,
136
- "cleanup_interval": 300,
137
- "exempt_paths": ["/health", "/docs", "/openapi.json"],
138
- "exempt_roles": ["admin"]
139
- },
140
-
141
- "logging": {
142
- "enabled": True,
143
- "level": "INFO",
144
- "format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s",
145
- "date_format": "%Y-%m-%d %H:%M:%S",
146
- "file_path": "./logs/security.log",
147
- "max_file_size": 10,
148
- "backup_count": 5,
149
- "console_output": True,
150
- "json_format": False,
151
- "include_timestamp": True,
152
- "include_level": True,
153
- "include_module": True
154
- }
155
- },
156
-
157
- "registration": {
158
- "enabled": False,
159
- "server_url": "https://proxy-registry.example.com",
160
- "auth_method": "certificate",
161
- "certificate": {
162
- "enabled": False,
163
- "cert_file": "mcp_proxy_adapter/examples/certs/proxy_client.crt",
164
- "key_file": "mcp_proxy_adapter/examples/keys/proxy_client.key",
165
- "ca_cert_file": "mcp_proxy_adapter/examples/certs/ca.crt",
166
- "verify_server": True
167
- },
168
- "token": {
169
- "enabled": False,
170
- "token": "proxy_registration_token_123",
171
- "token_type": "bearer",
172
- "refresh_interval": 3600
173
- },
174
- "api_key": {
175
- "enabled": False,
176
- "key": "proxy_api_key_456",
177
- "key_header": "X-Proxy-API-Key"
178
- },
179
- "proxy_info": {
180
- "name": "mcp_proxy_adapter",
181
- "version": "1.0.0",
182
- "description": "MCP Proxy Adapter with security framework",
183
- "capabilities": ["jsonrpc", "rest", "security", "certificates"],
184
- "endpoints": {
185
- "jsonrpc": "/api/jsonrpc",
186
- "rest": "/cmd",
187
- "health": "/health"
188
- }
189
- },
190
- "heartbeat": {
191
- "enabled": True,
192
- "interval": 300,
193
- "timeout": 30,
194
- "retry_attempts": 3,
195
- "retry_delay": 60
196
- },
197
- "auto_discovery": {
198
- "enabled": False,
199
- "discovery_urls": [],
200
- "discovery_interval": 3600,
201
- "register_on_discovery": True
202
- }
203
- },
204
-
205
- "logging": {
206
- "level": "INFO",
207
- "console_output": True,
208
- "file_output": False,
209
- "file_path": None,
210
- "max_file_size": 10,
211
- "backup_count": 5,
212
- "format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
213
- },
214
-
215
- "commands": {
216
- "auto_discovery": True,
217
- "commands_directory": "./commands",
218
- "builtin_commands": ["echo", "health", "config"],
219
- "custom_commands": [],
220
- "command_timeout": 30
221
- },
222
-
223
- "hooks": {
224
- "enabled": True,
225
- "application_hooks": {
226
- "on_startup": [],
227
- "on_shutdown": [],
228
- "before_request": [],
229
- "after_request": [],
230
- "on_error": []
231
- },
232
- "command_hooks": {
233
- "before_echo_command": [],
234
- "after_echo_command": [],
235
- "before_health_command": [],
236
- "after_health_command": [],
237
- "before_config_command": [],
238
- "after_config_command": []
239
- }
240
- },
241
-
242
- "protocols": {
243
- "enabled": True,
244
- "allowed_protocols": ["http", "https"],
245
- "default_protocol": "http",
246
- "strict_mode": False
247
- }
248
- }
249
-
250
- def generate_config_with_comments(self, config_type: str = "full") -> str:
251
- """
252
- Generate configuration with detailed comments.
253
-
254
- Args:
255
- config_type: Type of configuration to generate
256
- - "full": Complete configuration with all options
257
- - "minimal": Minimal working configuration
258
- - "secure": Secure configuration with all security features
259
- - "development": Development configuration with debug enabled
260
- - "basic_http": Basic HTTP configuration
261
- - "http_token": HTTP with token authentication
262
- - "https": HTTPS configuration
263
- - "https_token": HTTPS with token authentication
264
- - "mtls": mTLS configuration
265
-
266
- Returns:
267
- JSON configuration string with comments
268
- """
269
- config = self._get_config_by_type(config_type)
270
-
271
- # Convert to JSON with comments
272
- json_str = json.dumps(config, indent=2, ensure_ascii=False)
273
-
274
- # Add comments
275
- commented_config = self._add_comments(json_str, config_type)
276
-
277
- return commented_config
278
-
279
- def _get_config_by_type(self, config_type: str) -> Dict[str, Any]:
280
- """Get configuration based on type."""
281
- base_config = self.template_config.copy()
282
-
283
- if config_type == "minimal":
284
- return self._get_minimal_config(base_config)
285
- elif config_type == "secure":
286
- return self._get_secure_config(base_config)
287
- elif config_type == "development":
288
- return self._get_development_config(base_config)
289
- elif config_type == "basic_http":
290
- return self._get_basic_http_config(base_config)
291
- elif config_type == "http_token":
292
- return self._get_http_token_config(base_config)
293
- elif config_type == "https":
294
- return self._get_https_config(base_config)
295
- elif config_type == "https_token":
296
- return self._get_https_token_config(base_config)
297
- elif config_type == "https_no_protocol_middleware":
298
- return self._get_https_no_protocol_middleware_config(base_config)
299
- elif config_type == "mtls":
300
- return self._get_mtls_config(base_config)
301
- elif config_type == "mtls_no_protocol_middleware":
302
- return self._get_mtls_no_protocol_middleware_config(base_config)
303
- else: # full
304
- return base_config
305
-
306
- def _get_minimal_config(self, base_config: Dict[str, Any]) -> Dict[str, Any]:
307
- """Get minimal working configuration."""
308
- config = base_config.copy()
309
-
310
- # Disable security for minimal config
311
- config["security"]["enabled"] = False
312
- config["security"]["auth"]["enabled"] = False
313
- config["security"]["permissions"]["enabled"] = False
314
- config["security"]["rate_limit"]["enabled"] = False
315
-
316
- # Disable registration for minimal config
317
- config["registration"]["enabled"] = False
318
-
319
- # Keep only essential settings
320
- config["server"]["port"] = 8000
321
- config["server"]["debug"] = False
322
-
323
- return config
324
-
325
- def _get_basic_http_config(self, base_config: Dict[str, Any]) -> Dict[str, Any]:
326
- """Get basic HTTP configuration."""
327
- config = base_config.copy()
328
-
329
- # Basic HTTP settings
330
- config["server"]["port"] = 8000
331
- config["ssl"]["enabled"] = False
332
- config["security"]["ssl"]["enabled"] = False
333
- config["security"]["auth"]["enabled"] = False
334
- config["security"]["permissions"]["enabled"] = False
335
- config["security"]["permissions"]["roles_file"] = None
336
- config["protocols"]["enabled"] = True
337
- config["protocols"]["allowed_protocols"] = ["http"]
338
- config["protocols"]["default_protocol"] = "http"
339
-
340
- return config
341
-
342
- def _get_http_token_config(self, base_config: Dict[str, Any]) -> Dict[str, Any]:
343
- """Get HTTP with token authentication configuration."""
344
- config = base_config.copy()
345
-
346
- # HTTP with token auth
347
- config["server"]["port"] = 8001
348
- config["ssl"]["enabled"] = False
349
- config["security"]["ssl"]["enabled"] = False
350
- config["security"]["auth"]["enabled"] = True
351
- config["security"]["auth"]["methods"] = ["api_key"]
352
- config["security"]["auth"]["api_keys"] = {
353
- "test-token-123": {
354
- "roles": ["admin"],
355
- "permissions": ["*"],
356
- "expires": None
357
- },
358
- "user-token-456": {
359
- "roles": ["user"],
360
- "permissions": ["read", "execute"],
361
- "expires": None
362
- }
363
- }
364
- config["security"]["permissions"]["enabled"] = True
365
- config["security"]["permissions"]["roles_file"] = "mcp_proxy_adapter/examples/server_configs/roles.json"
366
- config["protocols"]["enabled"] = True
367
- config["protocols"]["allowed_protocols"] = ["http"]
368
- config["protocols"]["default_protocol"] = "http"
369
-
370
- return config
371
-
372
- def _get_https_config(self, base_config: Dict[str, Any]) -> Dict[str, Any]:
373
- """Get HTTPS configuration."""
374
- config = base_config.copy()
375
-
376
- # HTTPS settings
377
- config["server"]["port"] = 8443
378
- config["ssl"]["enabled"] = True
379
- config["ssl"]["cert_file"] = "mcp_proxy_adapter/examples/certs/server_cert.pem"
380
- config["ssl"]["key_file"] = "mcp_proxy_adapter/examples/certs/server_key.pem"
381
- config["ssl"]["ca_cert"] = "mcp_proxy_adapter/examples/certs/ca_cert.pem"
382
-
383
- config["security"]["ssl"]["enabled"] = True
384
- config["security"]["ssl"]["cert_file"] = "mcp_proxy_adapter/examples/certs/server_cert.pem"
385
- config["security"]["ssl"]["key_file"] = "mcp_proxy_adapter/examples/certs/server_key.pem"
386
- config["security"]["ssl"]["ca_cert_file"] = "mcp_proxy_adapter/examples/certs/ca_cert.pem"
387
-
388
- config["security"]["auth"]["enabled"] = False
389
- config["security"]["permissions"]["enabled"] = False
390
- config["security"]["permissions"]["roles_file"] = None
391
- config["protocols"]["enabled"] = True
392
- config["protocols"]["allowed_protocols"] = ["http", "https"]
393
- config["protocols"]["default_protocol"] = "https"
394
-
395
- return config
396
-
397
- def _get_https_token_config(self, base_config: Dict[str, Any]) -> Dict[str, Any]:
398
- """Get HTTPS with token authentication configuration."""
399
- config = base_config.copy()
400
-
401
- # HTTPS with token auth
402
- config["server"]["port"] = 8444
403
- config["ssl"]["enabled"] = True
404
- config["ssl"]["cert_file"] = "mcp_proxy_adapter/examples/certs/server_cert.pem"
405
- config["ssl"]["key_file"] = "mcp_proxy_adapter/examples/certs/server_key.pem"
406
- config["ssl"]["ca_cert"] = "mcp_proxy_adapter/examples/certs/ca_cert.pem"
407
-
408
- config["security"]["ssl"]["enabled"] = True
409
- config["security"]["ssl"]["cert_file"] = "mcp_proxy_adapter/examples/certs/server_cert.pem"
410
- config["security"]["ssl"]["key_file"] = "mcp_proxy_adapter/examples/certs/server_key.pem"
411
- config["security"]["ssl"]["ca_cert_file"] = "mcp_proxy_adapter/examples/certs/ca_cert.pem"
412
-
413
- config["security"]["auth"]["enabled"] = True
414
- config["security"]["auth"]["methods"] = ["api_key"]
415
- config["security"]["auth"]["api_keys"] = {
416
- "test-token-123": {
417
- "roles": ["admin"],
418
- "permissions": ["*"],
419
- "expires": None
420
- },
421
- "user-token-456": {
422
- "roles": ["user"],
423
- "permissions": ["read", "execute"],
424
- "expires": None
425
- }
426
- }
427
- config["security"]["permissions"]["enabled"] = True
428
- config["security"]["permissions"]["roles_file"] = "mcp_proxy_adapter/examples/server_configs/roles.json"
429
- config["protocols"]["enabled"] = True
430
- config["protocols"]["allowed_protocols"] = ["http", "https"]
431
- config["protocols"]["default_protocol"] = "https"
432
-
433
- return config
434
-
435
- def _get_mtls_config(self, base_config: Dict[str, Any]) -> Dict[str, Any]:
436
- """Get mTLS configuration."""
437
- config = base_config.copy()
438
-
439
- # mTLS settings
440
- config["server"]["port"] = 8445
441
- config["ssl"]["enabled"] = True
442
- config["ssl"]["cert_file"] = "mcp_proxy_adapter/examples/certs/server_cert.pem"
443
- config["ssl"]["key_file"] = "mcp_proxy_adapter/examples/certs/server_key.pem"
444
- config["ssl"]["ca_cert"] = "mcp_proxy_adapter/examples/certs/ca_cert.pem"
445
- config["ssl"]["verify_client"] = True
446
- config["ssl"]["client_cert_required"] = True
447
-
448
- config["security"]["ssl"]["enabled"] = True
449
- config["security"]["ssl"]["cert_file"] = "mcp_proxy_adapter/examples/certs/server_cert.pem"
450
- config["security"]["ssl"]["key_file"] = "mcp_proxy_adapter/examples/certs/server_key.pem"
451
- config["security"]["ssl"]["ca_cert_file"] = "mcp_proxy_adapter/examples/certs/ca_cert.pem"
452
- config["security"]["ssl"]["client_cert_file"] = "mcp_proxy_adapter/examples/certs/client_cert.pem"
453
- config["security"]["ssl"]["client_key_file"] = "mcp_proxy_adapter/examples/certs/client_key.pem"
454
- config["security"]["ssl"]["verify_mode"] = "CERT_REQUIRED"
455
-
456
- config["security"]["auth"]["enabled"] = True
457
- config["security"]["auth"]["methods"] = ["certificate"]
458
- config["security"]["auth"]["certificate_auth"] = True
459
- config["security"]["permissions"]["enabled"] = True
460
- config["security"]["permissions"]["roles_file"] = "mcp_proxy_adapter/examples/server_configs/roles.json"
461
- config["protocols"]["enabled"] = True
462
- config["protocols"]["allowed_protocols"] = ["https", "mtls"]
463
- config["protocols"]["default_protocol"] = "https"
464
-
465
- return config
466
-
467
- def _get_https_no_protocol_middleware_config(self, base_config: Dict[str, Any]) -> Dict[str, Any]:
468
- """Get HTTPS configuration without ProtocolMiddleware."""
469
- config = base_config.copy()
470
-
471
- # HTTPS settings
472
- config["server"]["port"] = 8445
473
- config["ssl"]["enabled"] = True
474
- config["ssl"]["cert_file"] = "mcp_proxy_adapter/examples/certs/server_cert.pem"
475
- config["ssl"]["key_file"] = "mcp_proxy_adapter/examples/certs/server_key.pem"
476
- config["ssl"]["ca_cert"] = "mcp_proxy_adapter/examples/certs/ca_cert.pem"
477
-
478
- config["security"]["ssl"]["enabled"] = True
479
- config["security"]["ssl"]["cert_file"] = "mcp_proxy_adapter/examples/certs/server_cert.pem"
480
- config["security"]["ssl"]["key_file"] = "mcp_proxy_adapter/examples/certs/server_key.pem"
481
- config["security"]["ssl"]["ca_cert_file"] = "mcp_proxy_adapter/examples/certs/ca_cert.pem"
482
-
483
- config["security"]["auth"]["enabled"] = True
484
- config["security"]["auth"]["methods"] = ["api_key"]
485
- config["security"]["auth"]["api_keys"] = {
486
- "test-token-123": {
487
- "roles": ["admin"],
488
- "permissions": ["*"],
489
- "expires": None
490
- },
491
- "user-token-456": {
492
- "roles": ["user"],
493
- "permissions": ["read", "execute"],
494
- "expires": None
495
- }
496
- }
497
- config["security"]["permissions"]["enabled"] = True
498
- config["security"]["permissions"]["roles_file"] = "mcp_proxy_adapter/examples/server_configs/roles.json"
499
- config["protocols"]["enabled"] = False # Disable ProtocolMiddleware
500
-
501
- return config
502
-
503
- def _get_mtls_no_protocol_middleware_config(self, base_config: Dict[str, Any]) -> Dict[str, Any]:
504
- """Get mTLS configuration without ProtocolMiddleware."""
505
- config = base_config.copy()
506
-
507
- # mTLS settings
508
- config["server"]["port"] = 8447
509
- config["ssl"]["enabled"] = True
510
- config["ssl"]["cert_file"] = "mcp_proxy_adapter/examples/certs/server_cert.pem"
511
- config["ssl"]["key_file"] = "mcp_proxy_adapter/examples/certs/server_key.pem"
512
- config["ssl"]["ca_cert"] = "mcp_proxy_adapter/examples/certs/ca_cert.pem"
513
- config["ssl"]["verify_client"] = True
514
- config["ssl"]["client_cert_required"] = True
515
-
516
- config["security"]["ssl"]["enabled"] = True
517
- config["security"]["ssl"]["cert_file"] = "mcp_proxy_adapter/examples/certs/server_cert.pem"
518
- config["security"]["ssl"]["key_file"] = "mcp_proxy_adapter/examples/certs/server_key.pem"
519
- config["security"]["ssl"]["ca_cert_file"] = "mcp_proxy_adapter/examples/certs/ca_cert.pem"
520
- config["security"]["ssl"]["client_cert_file"] = "mcp_proxy_adapter/examples/certs/client_cert.pem"
521
- config["security"]["ssl"]["client_key_file"] = "mcp_proxy_adapter/examples/certs/client_key.pem"
522
- config["security"]["ssl"]["verify_mode"] = "CERT_REQUIRED"
523
-
524
- config["security"]["auth"]["enabled"] = True
525
- config["security"]["auth"]["methods"] = ["certificate"]
526
- config["security"]["auth"]["certificate_auth"] = True
527
- config["security"]["permissions"]["enabled"] = True
528
- config["security"]["permissions"]["roles_file"] = "mcp_proxy_adapter/examples/server_configs/roles.json"
529
- config["protocols"]["enabled"] = False # Disable ProtocolMiddleware
530
-
531
- return config
532
-
533
- def _get_secure_config(self, base_config: Dict[str, Any]) -> Dict[str, Any]:
534
- """Get secure configuration with all security features enabled."""
535
- config = base_config.copy()
536
-
537
- # Enable all security features
538
- config["security"]["enabled"] = True
539
- config["security"]["ssl"]["enabled"] = True
540
- config["security"]["auth"]["enabled"] = True
541
- config["security"]["permissions"]["enabled"] = True
542
- config["security"]["rate_limit"]["enabled"] = True
543
-
544
- # Enable registration with certificate auth
545
- config["registration"]["enabled"] = True
546
- config["registration"]["auth_method"] = "certificate"
547
- config["registration"]["certificate"]["enabled"] = True
548
-
549
- # Set secure defaults
550
- config["security"]["ssl"]["min_tls_version"] = "TLSv1.2"
551
- config["security"]["auth"]["methods"] = ["api_key", "jwt"]
552
- config["security"]["permissions"]["strict_mode"] = True
553
- config["security"]["rate_limit"]["burst_limit"] = 1
554
-
555
- return config
556
-
557
- def _get_development_config(self, base_config: Dict[str, Any]) -> Dict[str, Any]:
558
- """Get development configuration with debug enabled."""
559
- config = base_config.copy()
560
-
561
- # Enable debug features
562
- config["server"]["debug"] = True
563
- config["security"]["debug"] = True
564
- config["logging"]["level"] = "DEBUG"
565
-
566
- # Enable registration with token auth for development
567
- config["registration"]["enabled"] = True
568
- config["registration"]["auth_method"] = "token"
569
- config["registration"]["token"]["enabled"] = True
570
-
571
- # Relax security for development
572
- config["security"]["rate_limit"]["default_requests_per_minute"] = 1000
573
- config["security"]["permissions"]["strict_mode"] = False
574
-
575
- return config
576
-
577
- def _add_comments(self, json_str: str, config_type: str) -> str:
578
- """Add comments to JSON configuration."""
579
- comments = self._get_comments_for_type(config_type)
580
-
581
- # Add header comment
582
- commented_config = f"""/**
583
- * MCP Proxy Adapter Configuration
584
- *
585
- * This configuration file combines settings for both mcp_proxy_adapter
586
- * and mcp_security_framework in a unified format.
587
- *
588
- * Configuration Type: {config_type.title()}
589
- * Generated by: ConfigGenerator
590
- *
591
- * IMPORTANT: This is a template configuration. Please customize it
592
- * according to your specific requirements and security needs.
593
- */
594
-
595
- """
596
-
597
- # Add section comments
598
- for section, comment in comments.items():
599
- if section in json_str:
600
- # Find the section and add comment before it
601
- section_start = json_str.find(f'"{section}":')
602
- if section_start != -1:
603
- # Find the line start
604
- line_start = json_str.rfind('\n', 0, section_start) + 1
605
- json_str = (
606
- json_str[:line_start] +
607
- f" // {comment}\n" +
608
- json_str[line_start:]
609
- )
610
-
611
- return commented_config + json_str
612
-
613
- def _get_comments_for_type(self, config_type: str) -> Dict[str, str]:
614
- """Get comments for configuration sections."""
615
- base_comments = {
616
- "server": "Server configuration for FastAPI application",
617
- "ssl": "SSL/TLS configuration for secure connections",
618
- "security": "Security framework configuration (mcp_security_framework)",
619
- "registration": "Proxy registration configuration for secure proxy discovery",
620
- "logging": "Logging configuration for the application",
621
- "commands": "Command management and discovery settings",
622
- "hooks": "Application and command hooks configuration",
623
- "protocols": "Protocol endpoints and settings"
624
- }
625
-
626
- if config_type == "minimal":
627
- base_comments["security"] = "Security framework configuration (disabled for minimal setup)"
628
- base_comments["registration"] = "Proxy registration configuration (disabled for minimal setup)"
629
- elif config_type == "secure":
630
- base_comments["security"] = "Security framework configuration (all features enabled)"
631
- base_comments["registration"] = "Proxy registration configuration (certificate authentication enabled)"
632
- elif config_type == "development":
633
- base_comments["security"] = "Security framework configuration (development mode with relaxed settings)"
634
- base_comments["registration"] = "Proxy registration configuration (token authentication for development)"
635
- elif config_type in ["basic_http", "http_token"]:
636
- base_comments["ssl"] = "SSL/TLS configuration (disabled for HTTP)"
637
- base_comments["security"] = f"Security framework configuration ({config_type} mode)"
638
- elif config_type in ["https", "https_token"]:
639
- base_comments["ssl"] = "SSL/TLS configuration (enabled for HTTPS)"
640
- base_comments["security"] = f"Security framework configuration ({config_type} mode)"
641
- elif config_type == "mtls":
642
- base_comments["ssl"] = "SSL/TLS configuration (enabled for mTLS with client certificate verification)"
643
- base_comments["security"] = "Security framework configuration (mTLS mode with certificate authentication)"
644
- elif config_type == "https_no_protocol_middleware":
645
- base_comments["ssl"] = "SSL/TLS configuration (enabled for HTTPS without ProtocolMiddleware)"
646
- base_comments["security"] = "Security framework configuration (HTTPS mode without ProtocolMiddleware)"
647
- elif config_type == "mtls_no_protocol_middleware":
648
- base_comments["ssl"] = "SSL/TLS configuration (enabled for mTLS without ProtocolMiddleware)"
649
- base_comments["security"] = "Security framework configuration (mTLS mode without ProtocolMiddleware)"
650
-
651
- return base_comments
652
-
653
- def generate_config_file(self, output_path: str, config_type: str = "full") -> None:
654
- """
655
- Generate configuration file and save to disk.
656
-
657
- Args:
658
- output_path: Path to save the configuration file
659
- config_type: Type of configuration to generate
660
- """
661
- try:
662
- config_content = self.generate_config_with_comments(config_type)
663
-
664
- # Create directory if it doesn't exist
665
- output_file = Path(output_path)
666
- output_file.parent.mkdir(parents=True, exist_ok=True)
667
-
668
- # Write configuration file
669
- with open(output_file, 'w', encoding='utf-8') as f:
670
- f.write(config_content)
671
-
672
- logger.info(f"Configuration file generated: {output_path}")
673
- logger.info(f"Configuration type: {config_type}")
674
-
675
- except Exception as e:
676
- logger.error(f"Failed to generate configuration file: {e}")
677
- raise
678
-
679
- def generate_all_configs(self, output_dir: str) -> None:
680
- """
681
- Generate all configuration types.
682
-
683
- Args:
684
- output_dir: Directory to save configuration files
685
- """
686
- config_types = [
687
- "minimal", "development", "secure", "full",
688
- "basic_http", "http_token", "https", "https_token", "mtls",
689
- "https_no_protocol_middleware", "mtls_no_protocol_middleware"
690
- ]
691
-
692
- for config_type in config_types:
693
- output_path = Path(output_dir) / f"config_{config_type}.json"
694
- self.generate_config_file(str(output_path), config_type)
695
-
696
- logger.info(f"Generated {len(config_types)} configuration files in {output_dir}")
697
-
698
-
699
- def main():
700
- """Main function for command-line usage."""
701
- import argparse
702
-
703
- parser = argparse.ArgumentParser(description="Generate MCP Proxy Adapter configuration files")
704
- parser.add_argument("--type",
705
- choices=["minimal", "development", "secure", "full",
706
- "basic_http", "http_token", "https", "https_token", "mtls",
707
- "https_no_protocol_middleware", "mtls_no_protocol_middleware"],
708
- default="full", help="Configuration type to generate")
709
- parser.add_argument("--output", default="./config.json",
710
- help="Output file path")
711
- parser.add_argument("--all", action="store_true",
712
- help="Generate all configuration types")
713
- parser.add_argument("--output-dir", default="./configs",
714
- help="Output directory for all configs")
715
-
716
- args = parser.parse_args()
717
-
718
- generator = ConfigGenerator()
719
-
720
- if args.all:
721
- generator.generate_all_configs(args.output_dir)
722
- else:
723
- generator.generate_config_file(args.output, args.type)
724
-
725
-
726
- if __name__ == "__main__":
727
- main()
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- mcp-proxy-adapter = mcp_proxy_adapter.__main__:main
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Vasiliy Zdanovskiy
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.