mcp-proxy-adapter 6.4.12__py3-none-any.whl → 6.4.15__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.
- mcp_proxy_adapter/core/app_factory.py +105 -32
- mcp_proxy_adapter/core/mtls_server.py +314 -0
- mcp_proxy_adapter/core/server_engine.py +1 -0
- mcp_proxy_adapter/examples/run_full_test_suite.py +1 -5
- mcp_proxy_adapter/examples/setup_test_environment.py +150 -19
- mcp_proxy_adapter/version.py +1 -1
- {mcp_proxy_adapter-6.4.12.dist-info → mcp_proxy_adapter-6.4.15.dist-info}/METADATA +2 -1
- {mcp_proxy_adapter-6.4.12.dist-info → mcp_proxy_adapter-6.4.15.dist-info}/RECORD +11 -23
- mcp_proxy_adapter/examples/examples/basic_framework/__init__.py +0 -9
- mcp_proxy_adapter/examples/examples/basic_framework/commands/__init__.py +0 -4
- mcp_proxy_adapter/examples/examples/basic_framework/hooks/__init__.py +0 -4
- mcp_proxy_adapter/examples/examples/basic_framework/main.py +0 -52
- mcp_proxy_adapter/examples/examples/full_application/__init__.py +0 -13
- mcp_proxy_adapter/examples/examples/full_application/commands/__init__.py +0 -7
- mcp_proxy_adapter/examples/examples/full_application/commands/custom_echo_command.py +0 -92
- mcp_proxy_adapter/examples/examples/full_application/commands/dynamic_calculator_command.py +0 -97
- mcp_proxy_adapter/examples/examples/full_application/hooks/__init__.py +0 -7
- mcp_proxy_adapter/examples/examples/full_application/hooks/application_hooks.py +0 -88
- mcp_proxy_adapter/examples/examples/full_application/hooks/builtin_command_hooks.py +0 -81
- mcp_proxy_adapter/examples/examples/full_application/main.py +0 -61
- mcp_proxy_adapter/examples/examples/full_application/proxy_endpoints.py +0 -188
- {mcp_proxy_adapter-6.4.12.dist-info → mcp_proxy_adapter-6.4.15.dist-info}/WHEEL +0 -0
- {mcp_proxy_adapter-6.4.12.dist-info → mcp_proxy_adapter-6.4.15.dist-info}/entry_points.txt +0 -0
- {mcp_proxy_adapter-6.4.12.dist-info → mcp_proxy_adapter-6.4.15.dist-info}/top_level.txt +0 -0
@@ -18,7 +18,9 @@ Features:
|
|
18
18
|
- Protocol-aware configuration generation
|
19
19
|
- Enhanced error handling and troubleshooting
|
20
20
|
"""
|
21
|
+
import os
|
21
22
|
import shutil
|
23
|
+
import subprocess
|
22
24
|
import sys
|
23
25
|
import argparse
|
24
26
|
import json
|
@@ -1023,27 +1025,139 @@ def generate_certificates_with_framework(output_dir: Path) -> bool:
|
|
1023
1025
|
return False
|
1024
1026
|
|
1025
1027
|
|
1028
|
+
def run_full_test_suite(target_root: Path) -> bool:
|
1029
|
+
"""Run the full test suite after environment setup."""
|
1030
|
+
print("\n" + "=" * 60)
|
1031
|
+
print("🚀 AUTOMATICALLY RUNNING FULL TEST SUITE")
|
1032
|
+
print("=" * 60)
|
1033
|
+
|
1034
|
+
try:
|
1035
|
+
# Change to target directory
|
1036
|
+
original_cwd = Path.cwd()
|
1037
|
+
os.chdir(target_root)
|
1038
|
+
|
1039
|
+
# Run the full test suite
|
1040
|
+
result = subprocess.run([
|
1041
|
+
sys.executable, "run_full_test_suite.py"
|
1042
|
+
], capture_output=True, text=True, timeout=300) # 5 minute timeout
|
1043
|
+
|
1044
|
+
# Print output
|
1045
|
+
if result.stdout:
|
1046
|
+
print("📋 Test Suite Output:")
|
1047
|
+
print(result.stdout)
|
1048
|
+
|
1049
|
+
if result.stderr:
|
1050
|
+
print("⚠️ Test Suite Warnings/Errors:")
|
1051
|
+
print(result.stderr)
|
1052
|
+
|
1053
|
+
if result.returncode == 0:
|
1054
|
+
print("🎉 FULL TEST SUITE COMPLETED SUCCESSFULLY!")
|
1055
|
+
return True
|
1056
|
+
else:
|
1057
|
+
print(f"❌ FULL TEST SUITE FAILED (exit code: {result.returncode})")
|
1058
|
+
return False
|
1059
|
+
|
1060
|
+
except subprocess.TimeoutExpired:
|
1061
|
+
print("⏰ Test suite timed out after 5 minutes")
|
1062
|
+
return False
|
1063
|
+
except Exception as e:
|
1064
|
+
print(f"❌ Error running test suite: {e}")
|
1065
|
+
return False
|
1066
|
+
finally:
|
1067
|
+
# Restore original working directory
|
1068
|
+
os.chdir(original_cwd)
|
1069
|
+
|
1070
|
+
|
1071
|
+
def validate_output_directory(output_dir: Path) -> bool:
|
1072
|
+
"""
|
1073
|
+
Validate output directory for test environment setup.
|
1074
|
+
|
1075
|
+
Args:
|
1076
|
+
output_dir: Path to the target directory
|
1077
|
+
|
1078
|
+
Returns:
|
1079
|
+
True if directory is valid for setup, False otherwise
|
1080
|
+
"""
|
1081
|
+
output_dir = output_dir.resolve()
|
1082
|
+
|
1083
|
+
# Check if directory exists
|
1084
|
+
if output_dir.exists():
|
1085
|
+
if not output_dir.is_dir():
|
1086
|
+
print(f"❌ Path exists but is not a directory: {output_dir}")
|
1087
|
+
return False
|
1088
|
+
|
1089
|
+
# Check if directory is empty
|
1090
|
+
try:
|
1091
|
+
contents = list(output_dir.iterdir())
|
1092
|
+
if contents:
|
1093
|
+
print(f"❌ Directory is not empty: {output_dir}")
|
1094
|
+
print(f" Found {len(contents)} items:")
|
1095
|
+
for item in contents[:5]: # Show first 5 items
|
1096
|
+
print(f" - {item.name}")
|
1097
|
+
if len(contents) > 5:
|
1098
|
+
print(f" ... and {len(contents) - 5} more items")
|
1099
|
+
print("\n💡 Please use an empty directory or specify a different path.")
|
1100
|
+
return False
|
1101
|
+
except PermissionError:
|
1102
|
+
print(f"❌ Permission denied accessing directory: {output_dir}")
|
1103
|
+
return False
|
1104
|
+
else:
|
1105
|
+
# Directory doesn't exist, try to create it
|
1106
|
+
try:
|
1107
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
1108
|
+
print(f"✅ Created directory: {output_dir}")
|
1109
|
+
except PermissionError:
|
1110
|
+
print(f"❌ Permission denied creating directory: {output_dir}")
|
1111
|
+
return False
|
1112
|
+
except Exception as e:
|
1113
|
+
print(f"❌ Failed to create directory {output_dir}: {e}")
|
1114
|
+
return False
|
1115
|
+
|
1116
|
+
return True
|
1117
|
+
|
1118
|
+
|
1026
1119
|
def main() -> int:
|
1027
1120
|
"""Main function for command line execution."""
|
1028
1121
|
parser = argparse.ArgumentParser(
|
1029
|
-
description="Setup enhanced test environment for MCP Proxy Adapter"
|
1122
|
+
description="Setup enhanced test environment for MCP Proxy Adapter and run full test suite"
|
1030
1123
|
)
|
1031
1124
|
parser.add_argument(
|
1032
|
-
"
|
1033
|
-
"
|
1125
|
+
"output_dir",
|
1126
|
+
nargs="?",
|
1034
1127
|
type=str,
|
1035
|
-
default=
|
1128
|
+
default=None,
|
1036
1129
|
help=(
|
1037
1130
|
"Target directory to create the test environment "
|
1038
|
-
"(default:
|
1131
|
+
"(default: auto-generated directory in /tmp)"
|
1039
1132
|
),
|
1040
1133
|
)
|
1041
1134
|
parser.add_argument(
|
1042
1135
|
"--skip-certs", action="store_true", help="Skip certificate generation"
|
1043
1136
|
)
|
1137
|
+
parser.add_argument(
|
1138
|
+
"--skip-tests", action="store_true", help="Skip running the full test suite"
|
1139
|
+
)
|
1044
1140
|
args = parser.parse_args()
|
1141
|
+
|
1045
1142
|
try:
|
1046
|
-
|
1143
|
+
# Determine target directory
|
1144
|
+
if args.output_dir is None:
|
1145
|
+
# Create auto-generated directory in /tmp
|
1146
|
+
import tempfile
|
1147
|
+
import time
|
1148
|
+
timestamp = int(time.time())
|
1149
|
+
target_root = Path(tempfile.gettempdir()) / f"mcp_test_env_{timestamp}"
|
1150
|
+
print(f"🔧 Auto-generating test environment directory: {target_root}")
|
1151
|
+
else:
|
1152
|
+
target_root = Path(args.output_dir)
|
1153
|
+
|
1154
|
+
# Validate output directory
|
1155
|
+
print(f"🔍 Validating output directory: {target_root}")
|
1156
|
+
if not validate_output_directory(target_root):
|
1157
|
+
print("\n❌ Directory validation failed. Exiting.")
|
1158
|
+
return 1
|
1159
|
+
|
1160
|
+
print(f"✅ Directory validation passed: {target_root}")
|
1047
1161
|
setup_test_environment(target_root)
|
1048
1162
|
|
1049
1163
|
# Generate certificates if framework is available and not skipped
|
@@ -1056,6 +1170,16 @@ def main() -> int:
|
|
1056
1170
|
"⚠️ Skipping certificate generation (mcp_security_framework "
|
1057
1171
|
"not available)"
|
1058
1172
|
)
|
1173
|
+
|
1174
|
+
# Run full test suite if not skipped
|
1175
|
+
if not args.skip_tests:
|
1176
|
+
test_success = run_full_test_suite(target_root)
|
1177
|
+
if not test_success:
|
1178
|
+
print("\n❌ TEST SUITE FAILED - Check the output above for details")
|
1179
|
+
return 1
|
1180
|
+
else:
|
1181
|
+
print("⚠️ Skipping test suite execution (--skip-tests specified)")
|
1182
|
+
|
1059
1183
|
except Exception as e:
|
1060
1184
|
print(
|
1061
1185
|
"❌ Error setting up test environment: {}".format(e),
|
@@ -1070,19 +1194,26 @@ def main() -> int:
|
|
1070
1194
|
print("\n" + "=" * 60)
|
1071
1195
|
print("✅ ENHANCED TEST ENVIRONMENT SETUP COMPLETED SUCCESSFULLY")
|
1072
1196
|
print("=" * 60)
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1197
|
+
|
1198
|
+
if not args.skip_tests:
|
1199
|
+
print("\n🎉 ALL TESTS PASSED - Environment is ready for use!")
|
1200
|
+
else:
|
1201
|
+
print("\n📋 NEXT STEPS:")
|
1202
|
+
print("1. Review configuration documentation:")
|
1203
|
+
print(" cat docs/CONFIGURATION_GUIDE.md")
|
1204
|
+
print("\n2. Check available configurations:")
|
1205
|
+
print(" ls -la configs/")
|
1206
|
+
print("\n3. Run the full test suite:")
|
1207
|
+
print(" python run_full_test_suite.py")
|
1208
|
+
print("\n4. Test proxy registration SSL fix:")
|
1209
|
+
print(" python test_proxy_registration.py")
|
1210
|
+
print("\n5. Start server with a specific configuration:")
|
1211
|
+
print(" python -m mcp_proxy_adapter --config configs/production_https.json")
|
1212
|
+
print("\n6. Run security tests:")
|
1213
|
+
print(" python -m mcp_proxy_adapter.examples.run_security_tests")
|
1214
|
+
print("\n7. Generate additional certificates (if needed):")
|
1215
|
+
print(" python scripts/create_certificates_simple.py")
|
1216
|
+
|
1086
1217
|
print("=" * 60)
|
1087
1218
|
return 0
|
1088
1219
|
|
mcp_proxy_adapter/version.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: mcp-proxy-adapter
|
3
|
-
Version: 6.4.
|
3
|
+
Version: 6.4.15
|
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
|
@@ -31,6 +31,7 @@ Description-Content-Type: text/markdown
|
|
31
31
|
Requires-Dist: fastapi<1.0.0,>=0.95.0
|
32
32
|
Requires-Dist: pydantic>=2.0.0
|
33
33
|
Requires-Dist: hypercorn<1.0.0,>=0.15.0
|
34
|
+
Requires-Dist: uvicorn<1.0.0,>=0.15.0
|
34
35
|
Requires-Dist: docstring-parser<1.0.0,>=0.15
|
35
36
|
Requires-Dist: typing-extensions<5.0.0,>=4.5.0
|
36
37
|
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=
|
7
|
+
mcp_proxy_adapter/version.py,sha256=jFw6lUL1VNuJJK-Vfao7X6pxlEIpynWMf3UdHycqad4,75
|
8
8
|
mcp_proxy_adapter/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
mcp_proxy_adapter/api/app.py,sha256=UQ7_m-LbUzKuuPJPxS_69ahANUQ5rnPwoddQ2MMXNkg,33941
|
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=
|
56
|
+
mcp_proxy_adapter/core/app_factory.py,sha256=T-GS0aCINLTKVGumLGJdWWweik0sTW7hFFGxqcDXwD0,21438
|
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
|
@@ -67,6 +67,7 @@ mcp_proxy_adapter/core/errors.py,sha256=UNEfdmK0zPGJrWH1zUMRjHIJMcoVDcBO4w8xxKHB
|
|
67
67
|
mcp_proxy_adapter/core/logging.py,sha256=gNI6vfPQC7jrUtVu6NeDsmU72JPlrRRBhtJipL1eVrI,9560
|
68
68
|
mcp_proxy_adapter/core/mtls_asgi.py,sha256=tvk0P9024s18dcCHY9AaQIecT4ojOTv21EuQWXwooU0,5200
|
69
69
|
mcp_proxy_adapter/core/mtls_asgi_app.py,sha256=DT_fTUH1RkvBa3ThbyCyNb-XUHyCb4DqaKA1gcZC6z4,6538
|
70
|
+
mcp_proxy_adapter/core/mtls_server.py,sha256=_hj6QWuExKX2LRohYvjPGFC2qTutS7ObegpEc09QijM,10117
|
70
71
|
mcp_proxy_adapter/core/protocol_manager.py,sha256=3sWOAiMniQY5nu9CHkitIOGN4CXH28hOTwY92D0yasM,15268
|
71
72
|
mcp_proxy_adapter/core/proxy_client.py,sha256=CB6KBhV3vH2GU5nZ27VZ_xlNbYTAU_tnYFrkuK5He58,6094
|
72
73
|
mcp_proxy_adapter/core/proxy_registration.py,sha256=qgNtdYPXZ6F1oXRXIXCICCL9NYkOteGrTVPQAI8P5mg,31483
|
@@ -75,7 +76,7 @@ mcp_proxy_adapter/core/security_adapter.py,sha256=MAtNthsp7Qj4-oLFzSi7Pr3vWQbWS_
|
|
75
76
|
mcp_proxy_adapter/core/security_factory.py,sha256=M-1McwUOmuV7Eo-m_P2undtJVNK_KIjDx8o_uRY8rLo,8005
|
76
77
|
mcp_proxy_adapter/core/security_integration.py,sha256=oGYoJKrPoOqw262j3daeG8B6ro4pOGYMWmZR_hsTQOc,16881
|
77
78
|
mcp_proxy_adapter/core/server_adapter.py,sha256=qKTHdVAwoCUHEF4G3EEUG7JTfLS49ucYMQSkQAz_F4E,9601
|
78
|
-
mcp_proxy_adapter/core/server_engine.py,sha256=
|
79
|
+
mcp_proxy_adapter/core/server_engine.py,sha256=qmxdkBv-YsQsvxVVQ-_xiAyDshxtnrKBquPJoUjo2fw,9471
|
79
80
|
mcp_proxy_adapter/core/settings.py,sha256=D6cF4R_5gJ0XFGxzXUIzeqe-_muu6HL561TAei9wwZ0,10521
|
80
81
|
mcp_proxy_adapter/core/ssl_utils.py,sha256=Rjl79d5LdhDzxiMtaIRd9OFh0hTeRANItYFXk-7c5pA,9498
|
81
82
|
mcp_proxy_adapter/core/transport_manager.py,sha256=eJbGa3gDVFUBFUzMK5KEmpbUDXOOShtzszUIEf7Jk0A,9292
|
@@ -93,12 +94,12 @@ mcp_proxy_adapter/examples/generate_certificates_and_tokens.py,sha256=hUCoJH3fy5
|
|
93
94
|
mcp_proxy_adapter/examples/generate_test_configs.py,sha256=FWg_QFJAWinI1lw05RccX4_VbhsCBEKPpZA6I9v6KAs,14379
|
94
95
|
mcp_proxy_adapter/examples/proxy_registration_example.py,sha256=vemRhftnjbiOBCJkmtDGqlWQ8syTG0a8755GCOnaQsg,12503
|
95
96
|
mcp_proxy_adapter/examples/run_example.py,sha256=yp-a6HIrSk3ddQmbn0KkuKwErId0aNfj028TE6U-zmY,2626
|
96
|
-
mcp_proxy_adapter/examples/run_full_test_suite.py,sha256=
|
97
|
+
mcp_proxy_adapter/examples/run_full_test_suite.py,sha256=uOXKzQKVP6d9VxnWaDNo-KY9VBkLWCmA1EZHchWOJ1c,19806
|
97
98
|
mcp_proxy_adapter/examples/run_proxy_server.py,sha256=SBLSSY2F_VEBQD3MsCE_Pa9xFE6Sszr3vHdE9QOEN4Y,5242
|
98
99
|
mcp_proxy_adapter/examples/run_security_tests.py,sha256=0vjaUdWC-rLyviQuNxM3PtfiU9TzSRuxGxWMehrFA_w,23311
|
99
100
|
mcp_proxy_adapter/examples/run_security_tests_fixed.py,sha256=2BKMT0_-FhmcZA73hdQOt2XR7Cgb9Sq8qBI88BkwAAA,10934
|
100
101
|
mcp_proxy_adapter/examples/security_test_client.py,sha256=K5gEVat1SJS2pBVxqLl5c9-uiiG12k8UT3ULQDXZ2Uc,35713
|
101
|
-
mcp_proxy_adapter/examples/setup_test_environment.py,sha256=
|
102
|
+
mcp_proxy_adapter/examples/setup_test_environment.py,sha256=bi8fNsL95H0YdaxZqVGLdl_cYNRNvrZ93a4QruFIqMc,39243
|
102
103
|
mcp_proxy_adapter/examples/test_config.py,sha256=ekEoUZe9q484vU_0IxOVhQdNMVJXG3IpmQpP--VmuDI,6491
|
103
104
|
mcp_proxy_adapter/examples/test_config_generator.py,sha256=PBXk1V_awJ-iBlbE66Pme5sQwu6CJDxkmqgm8uPtM58,4091
|
104
105
|
mcp_proxy_adapter/examples/test_examples.py,sha256=CYlVatdHUVC_rwv4NsvxFG3GXiKIyxPDUH43BOJHjrU,12330
|
@@ -108,19 +109,6 @@ mcp_proxy_adapter/examples/basic_framework/main.py,sha256=XdGrD_52hhCVHwqx4XmfVm
|
|
108
109
|
mcp_proxy_adapter/examples/basic_framework/commands/__init__.py,sha256=_VQNLUEdsxUG-4yt9BZI_vtOxHAdGG0OUSsP6Wj-Vz4,76
|
109
110
|
mcp_proxy_adapter/examples/basic_framework/hooks/__init__.py,sha256=IE_EIXMnkdXuakZn7wLD9kBFyfDF5lYi56ejgiBeb-A,70
|
110
111
|
mcp_proxy_adapter/examples/commands/__init__.py,sha256=zvY_OpH_B1bVc_khrNIl6O8vqCw1FH6gGMAsJAkGWGY,170
|
111
|
-
mcp_proxy_adapter/examples/examples/basic_framework/__init__.py,sha256=4aYD--R6hy9n9CUxj7Osb9HcdVUMJ6_cfpu4ujkbCwI,345
|
112
|
-
mcp_proxy_adapter/examples/examples/basic_framework/main.py,sha256=Vg8LMaXPsHUccfZlNWA2XVaJ1t7FDCK8nPshAVJAhxU,1776
|
113
|
-
mcp_proxy_adapter/examples/examples/basic_framework/commands/__init__.py,sha256=_VQNLUEdsxUG-4yt9BZI_vtOxHAdGG0OUSsP6Wj-Vz4,76
|
114
|
-
mcp_proxy_adapter/examples/examples/basic_framework/hooks/__init__.py,sha256=IE_EIXMnkdXuakZn7wLD9kBFyfDF5lYi56ejgiBeb-A,70
|
115
|
-
mcp_proxy_adapter/examples/examples/full_application/__init__.py,sha256=xGiPYhRAzs1Fh9wA8HoowV-Gg9QMLaMZn-OamExq1TI,320
|
116
|
-
mcp_proxy_adapter/examples/examples/full_application/main.py,sha256=i5o9prWKQv6EXUyNZQERlfah9q-GoloKMQHOVqnQIgo,1991
|
117
|
-
mcp_proxy_adapter/examples/examples/full_application/proxy_endpoints.py,sha256=Kt_WAsG61HLTMkKQ1mQqjvlX9I4TcfwYq0NaRR9HKvM,6179
|
118
|
-
mcp_proxy_adapter/examples/examples/full_application/commands/__init__.py,sha256=yQHxVSFkAyFLUOdk42QOebUODPlQV9IbydPgF3UKsGM,217
|
119
|
-
mcp_proxy_adapter/examples/examples/full_application/commands/custom_echo_command.py,sha256=H7FPJmVJNWT61rPWxep06-7hsYRt8XYBUSBiwqpBurU,3096
|
120
|
-
mcp_proxy_adapter/examples/examples/full_application/commands/dynamic_calculator_command.py,sha256=DFTqVnIDt6nBdZ27-vD_f1X2cFcDInVQiCEq9ltw4lA,3428
|
121
|
-
mcp_proxy_adapter/examples/examples/full_application/hooks/__init__.py,sha256=ORG4cL8cSXEMmZ0CEPz75OVuwg54pdDm2GIBpP4dtcs,200
|
122
|
-
mcp_proxy_adapter/examples/examples/full_application/hooks/application_hooks.py,sha256=vcMHakKOt9pvJDZ6XfgvcYJfrrxg-RnIC8wX6LPqKvA,3500
|
123
|
-
mcp_proxy_adapter/examples/examples/full_application/hooks/builtin_command_hooks.py,sha256=P5KjODcVPier-nxjWWpG7yO7ppSjSx-6BJ9FxArD-ps,2988
|
124
112
|
mcp_proxy_adapter/examples/full_application/__init__.py,sha256=xGiPYhRAzs1Fh9wA8HoowV-Gg9QMLaMZn-OamExq1TI,320
|
125
113
|
mcp_proxy_adapter/examples/full_application/main.py,sha256=ogL3Bil_5puGnwvMh3YNOjrW76FIzzoggKEp-04HSfo,7855
|
126
114
|
mcp_proxy_adapter/examples/full_application/proxy_endpoints.py,sha256=Kt_WAsG61HLTMkKQ1mQqjvlX9I4TcfwYq0NaRR9HKvM,6179
|
@@ -133,8 +121,8 @@ mcp_proxy_adapter/examples/full_application/hooks/builtin_command_hooks.py,sha25
|
|
133
121
|
mcp_proxy_adapter/examples/scripts/config_generator.py,sha256=SKFlRRCE_pEHGbfjDuzfKpvV2DMwG6lRfK90uJwRlJM,33410
|
134
122
|
mcp_proxy_adapter/examples/scripts/create_certificates_simple.py,sha256=yCWdUIhMSDPwoPhuLR9rhPdf7jLN5hCjzNfYYgVyHnw,27769
|
135
123
|
mcp_proxy_adapter/examples/scripts/generate_certificates_and_tokens.py,sha256=hUCoJH3fy5WeR_YMHj-_W0mR0ZKUWqewH4FVN3yWyrM,17972
|
136
|
-
mcp_proxy_adapter-6.4.
|
137
|
-
mcp_proxy_adapter-6.4.
|
138
|
-
mcp_proxy_adapter-6.4.
|
139
|
-
mcp_proxy_adapter-6.4.
|
140
|
-
mcp_proxy_adapter-6.4.
|
124
|
+
mcp_proxy_adapter-6.4.15.dist-info/METADATA,sha256=41hiHJgKlGSGHD75fAeEgBsEPjml3vrbCy1jM3Q2U4A,6125
|
125
|
+
mcp_proxy_adapter-6.4.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
126
|
+
mcp_proxy_adapter-6.4.15.dist-info/entry_points.txt,sha256=J3eV6ID0lt_VSp4lIdIgBFTqLCThgObNNxRCbyfiMHw,70
|
127
|
+
mcp_proxy_adapter-6.4.15.dist-info/top_level.txt,sha256=JZT7vPLBYrtroX-ij68JBhJYbjDdghcV-DFySRy-Nnw,18
|
128
|
+
mcp_proxy_adapter-6.4.15.dist-info/RECORD,,
|
@@ -1,9 +0,0 @@
|
|
1
|
-
"""Basic Framework Example.
|
2
|
-
|
3
|
-
This example demonstrates the fundamental usage of MCP Proxy Adapter
|
4
|
-
with minimal configuration and basic command registration.
|
5
|
-
|
6
|
-
Note: This package provides a basic example of MCP Proxy Adapter usage.
|
7
|
-
The main application is created dynamically in main.py and not exported
|
8
|
-
as a global variable for this example.
|
9
|
-
"""
|
@@ -1,52 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python3
|
2
|
-
"""
|
3
|
-
Basic Framework Example
|
4
|
-
This example demonstrates the basic usage of the MCP Proxy Adapter framework
|
5
|
-
with minimal configuration and built-in commands.
|
6
|
-
Author: Vasiliy Zdanovskiy
|
7
|
-
email: vasilyvz@gmail.com
|
8
|
-
"""
|
9
|
-
import sys
|
10
|
-
import argparse
|
11
|
-
import asyncio
|
12
|
-
from pathlib import Path
|
13
|
-
|
14
|
-
# Add the framework to the path
|
15
|
-
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
|
16
|
-
from mcp_proxy_adapter.core.app_factory import create_and_run_server
|
17
|
-
|
18
|
-
|
19
|
-
def main():
|
20
|
-
"""Main entry point for the basic framework example."""
|
21
|
-
parser = argparse.ArgumentParser(description="Basic Framework Example")
|
22
|
-
parser.add_argument(
|
23
|
-
"--config", "-c", required=True, help="Path to configuration file"
|
24
|
-
)
|
25
|
-
parser.add_argument("--host", help="Server host")
|
26
|
-
parser.add_argument("--port", type=int, help="Server port")
|
27
|
-
parser.add_argument("--debug", action="store_true", help="Enable debug mode")
|
28
|
-
args = parser.parse_args()
|
29
|
-
# Override configuration if specified
|
30
|
-
config_overrides = {}
|
31
|
-
if args.host:
|
32
|
-
config_overrides["host"] = args.host
|
33
|
-
if args.port:
|
34
|
-
config_overrides["port"] = args.port
|
35
|
-
if args.debug:
|
36
|
-
config_overrides["debug"] = True
|
37
|
-
print(f"🚀 Starting Basic Framework Example")
|
38
|
-
print(f"📋 Configuration: {args.config}")
|
39
|
-
print("=" * 50)
|
40
|
-
# Use the factory method to create and run the server
|
41
|
-
asyncio.run(create_and_run_server(
|
42
|
-
config_path=args.config,
|
43
|
-
title="Basic Framework Example",
|
44
|
-
description="Basic MCP Proxy Adapter with minimal configuration",
|
45
|
-
version="1.0.0",
|
46
|
-
host=config_overrides.get("host", "0.0.0.0"),
|
47
|
-
log_level="debug" if config_overrides.get("debug", False) else "info",
|
48
|
-
))
|
49
|
-
|
50
|
-
|
51
|
-
if __name__ == "__main__":
|
52
|
-
main()
|
@@ -1,13 +0,0 @@
|
|
1
|
-
"""Full Application Example.
|
2
|
-
|
3
|
-
This example demonstrates advanced usage of MCP Proxy Adapter including:
|
4
|
-
- Proxy registration endpoints
|
5
|
-
- Custom command hooks
|
6
|
-
- Advanced security configurations
|
7
|
-
- Role-based access control
|
8
|
-
"""
|
9
|
-
|
10
|
-
from .main import get_app
|
11
|
-
|
12
|
-
app = get_app()
|
13
|
-
from .proxy_endpoints import router as proxy_router
|
@@ -1,92 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Custom Echo Command
|
3
|
-
This module demonstrates a custom command implementation for the full application example.
|
4
|
-
Author: Vasiliy Zdanovskiy
|
5
|
-
email: vasilyvz@gmail.com
|
6
|
-
"""
|
7
|
-
|
8
|
-
from typing import Dict, Any, Optional
|
9
|
-
from mcp_proxy_adapter.commands.base import BaseCommand
|
10
|
-
from mcp_proxy_adapter.commands.result import CommandResult
|
11
|
-
|
12
|
-
|
13
|
-
class CustomEchoResult(CommandResult):
|
14
|
-
"""Result class for custom echo command."""
|
15
|
-
|
16
|
-
def __init__(self, message: str, timestamp: str, echo_count: int):
|
17
|
-
self.message = message
|
18
|
-
self.timestamp = timestamp
|
19
|
-
self.echo_count = echo_count
|
20
|
-
|
21
|
-
def to_dict(self) -> Dict[str, Any]:
|
22
|
-
"""Convert result to dictionary."""
|
23
|
-
return {
|
24
|
-
"message": self.message,
|
25
|
-
"timestamp": self.timestamp,
|
26
|
-
"echo_count": self.echo_count,
|
27
|
-
"command_type": "custom_echo",
|
28
|
-
}
|
29
|
-
|
30
|
-
def get_schema(self) -> Dict[str, Any]:
|
31
|
-
"""Get result schema."""
|
32
|
-
return {
|
33
|
-
"type": "object",
|
34
|
-
"properties": {
|
35
|
-
"message": {"type": "string", "description": "Echoed message"},
|
36
|
-
"timestamp": {"type": "string", "description": "Timestamp of echo"},
|
37
|
-
"echo_count": {"type": "integer", "description": "Number of echoes"},
|
38
|
-
"command_type": {"type": "string", "description": "Command type"},
|
39
|
-
},
|
40
|
-
"required": ["message", "timestamp", "echo_count", "command_type"],
|
41
|
-
}
|
42
|
-
|
43
|
-
|
44
|
-
class CustomEchoCommand(BaseCommand):
|
45
|
-
"""Custom echo command implementation."""
|
46
|
-
|
47
|
-
def __init__(self):
|
48
|
-
super().__init__()
|
49
|
-
self.echo_count = 0
|
50
|
-
|
51
|
-
def get_name(self) -> str:
|
52
|
-
"""Get command name."""
|
53
|
-
return "custom_echo"
|
54
|
-
|
55
|
-
def get_description(self) -> str:
|
56
|
-
"""Get command description."""
|
57
|
-
return "Custom echo command with enhanced features"
|
58
|
-
|
59
|
-
def get_schema(self) -> Dict[str, Any]:
|
60
|
-
"""Get command schema."""
|
61
|
-
return {
|
62
|
-
"type": "object",
|
63
|
-
"properties": {
|
64
|
-
"message": {
|
65
|
-
"type": "string",
|
66
|
-
"description": "Message to echo",
|
67
|
-
"default": "Hello from custom echo!",
|
68
|
-
},
|
69
|
-
"repeat": {
|
70
|
-
"type": "integer",
|
71
|
-
"description": "Number of times to repeat",
|
72
|
-
"default": 1,
|
73
|
-
"minimum": 1,
|
74
|
-
"maximum": 10,
|
75
|
-
},
|
76
|
-
},
|
77
|
-
"required": ["message"],
|
78
|
-
}
|
79
|
-
|
80
|
-
async def execute(self, params: Dict[str, Any]) -> CustomEchoResult:
|
81
|
-
"""Execute the custom echo command."""
|
82
|
-
message = params.get("message", "Hello from custom echo!")
|
83
|
-
repeat = min(max(params.get("repeat", 1), 1), 10)
|
84
|
-
self.echo_count += 1
|
85
|
-
from datetime import datetime
|
86
|
-
|
87
|
-
timestamp = datetime.now().isoformat()
|
88
|
-
# Repeat the message
|
89
|
-
echoed_message = " ".join([message] * repeat)
|
90
|
-
return CustomEchoResult(
|
91
|
-
message=echoed_message, timestamp=timestamp, echo_count=self.echo_count
|
92
|
-
)
|
@@ -1,97 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Dynamic Calculator Command
|
3
|
-
This module demonstrates a dynamically loaded command implementation for the full application example.
|
4
|
-
Author: Vasiliy Zdanovskiy
|
5
|
-
email: vasilyvz@gmail.com
|
6
|
-
"""
|
7
|
-
|
8
|
-
from typing import Dict, Any, Optional
|
9
|
-
from mcp_proxy_adapter.commands.base import BaseCommand
|
10
|
-
from mcp_proxy_adapter.commands.result import CommandResult
|
11
|
-
|
12
|
-
|
13
|
-
class CalculatorResult(CommandResult):
|
14
|
-
"""Result class for calculator command."""
|
15
|
-
|
16
|
-
def __init__(self, operation: str, result: float, expression: str):
|
17
|
-
self.operation = operation
|
18
|
-
self.result = result
|
19
|
-
self.expression = expression
|
20
|
-
|
21
|
-
def to_dict(self) -> Dict[str, Any]:
|
22
|
-
"""Convert result to dictionary."""
|
23
|
-
return {
|
24
|
-
"operation": self.operation,
|
25
|
-
"result": self.result,
|
26
|
-
"expression": self.expression,
|
27
|
-
"command_type": "dynamic_calculator",
|
28
|
-
}
|
29
|
-
|
30
|
-
def get_schema(self) -> Dict[str, Any]:
|
31
|
-
"""Get result schema."""
|
32
|
-
return {
|
33
|
-
"type": "object",
|
34
|
-
"properties": {
|
35
|
-
"operation": {
|
36
|
-
"type": "string",
|
37
|
-
"description": "Mathematical operation",
|
38
|
-
},
|
39
|
-
"result": {"type": "number", "description": "Calculation result"},
|
40
|
-
"expression": {"type": "string", "description": "Full expression"},
|
41
|
-
"command_type": {"type": "string", "description": "Command type"},
|
42
|
-
},
|
43
|
-
"required": ["operation", "result", "expression", "command_type"],
|
44
|
-
}
|
45
|
-
|
46
|
-
|
47
|
-
class DynamicCalculatorCommand(BaseCommand):
|
48
|
-
"""Dynamic calculator command implementation."""
|
49
|
-
|
50
|
-
def get_name(self) -> str:
|
51
|
-
"""Get command name."""
|
52
|
-
return "dynamic_calculator"
|
53
|
-
|
54
|
-
def get_description(self) -> str:
|
55
|
-
"""Get command description."""
|
56
|
-
return "Dynamic calculator with basic mathematical operations"
|
57
|
-
|
58
|
-
def get_schema(self) -> Dict[str, Any]:
|
59
|
-
"""Get command schema."""
|
60
|
-
return {
|
61
|
-
"type": "object",
|
62
|
-
"properties": {
|
63
|
-
"operation": {
|
64
|
-
"type": "string",
|
65
|
-
"description": "Mathematical operation (add, subtract, multiply, divide)",
|
66
|
-
"enum": ["add", "subtract", "multiply", "divide"],
|
67
|
-
},
|
68
|
-
"a": {"type": "number", "description": "First number"},
|
69
|
-
"b": {"type": "number", "description": "Second number"},
|
70
|
-
},
|
71
|
-
"required": ["operation", "a", "b"],
|
72
|
-
}
|
73
|
-
|
74
|
-
async def execute(self, params: Dict[str, Any]) -> CalculatorResult:
|
75
|
-
"""Execute the calculator command."""
|
76
|
-
operation = params.get("operation")
|
77
|
-
a = params.get("a")
|
78
|
-
b = params.get("b")
|
79
|
-
if operation == "add":
|
80
|
-
result = a + b
|
81
|
-
expression = f"{a} + {b}"
|
82
|
-
elif operation == "subtract":
|
83
|
-
result = a - b
|
84
|
-
expression = f"{a} - {b}"
|
85
|
-
elif operation == "multiply":
|
86
|
-
result = a * b
|
87
|
-
expression = f"{a} * {b}"
|
88
|
-
elif operation == "divide":
|
89
|
-
if b == 0:
|
90
|
-
raise ValueError("Division by zero is not allowed")
|
91
|
-
result = a / b
|
92
|
-
expression = f"{a} / {b}"
|
93
|
-
else:
|
94
|
-
raise ValueError(f"Unknown operation: {operation}")
|
95
|
-
return CalculatorResult(
|
96
|
-
operation=operation, result=result, expression=expression
|
97
|
-
)
|