mcp-security-framework 0.1.0__py3-none-any.whl → 1.1.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.
- mcp_security_framework/__init__.py +26 -15
- mcp_security_framework/cli/__init__.py +1 -1
- mcp_security_framework/cli/cert_cli.py +233 -197
- mcp_security_framework/cli/security_cli.py +324 -234
- mcp_security_framework/constants.py +21 -27
- mcp_security_framework/core/auth_manager.py +49 -20
- mcp_security_framework/core/cert_manager.py +398 -104
- mcp_security_framework/core/permission_manager.py +13 -9
- mcp_security_framework/core/rate_limiter.py +10 -0
- mcp_security_framework/core/security_manager.py +286 -229
- mcp_security_framework/examples/__init__.py +6 -0
- mcp_security_framework/examples/comprehensive_example.py +954 -0
- mcp_security_framework/examples/django_example.py +276 -202
- mcp_security_framework/examples/fastapi_example.py +897 -393
- mcp_security_framework/examples/flask_example.py +311 -200
- mcp_security_framework/examples/gateway_example.py +373 -214
- mcp_security_framework/examples/microservice_example.py +337 -172
- mcp_security_framework/examples/standalone_example.py +719 -478
- mcp_security_framework/examples/test_all_examples.py +572 -0
- mcp_security_framework/middleware/__init__.py +46 -55
- mcp_security_framework/middleware/auth_middleware.py +62 -63
- mcp_security_framework/middleware/fastapi_auth_middleware.py +179 -110
- mcp_security_framework/middleware/fastapi_middleware.py +156 -148
- mcp_security_framework/middleware/flask_auth_middleware.py +267 -107
- mcp_security_framework/middleware/flask_middleware.py +183 -157
- mcp_security_framework/middleware/mtls_middleware.py +106 -117
- mcp_security_framework/middleware/rate_limit_middleware.py +105 -101
- mcp_security_framework/middleware/security_middleware.py +109 -124
- mcp_security_framework/schemas/config.py +2 -1
- mcp_security_framework/schemas/models.py +19 -6
- mcp_security_framework/utils/cert_utils.py +14 -8
- mcp_security_framework/utils/datetime_compat.py +116 -0
- {mcp_security_framework-0.1.0.dist-info → mcp_security_framework-1.1.1.dist-info}/METADATA +2 -1
- mcp_security_framework-1.1.1.dist-info/RECORD +84 -0
- tests/conftest.py +303 -0
- tests/test_cli/test_cert_cli.py +194 -174
- tests/test_cli/test_security_cli.py +274 -247
- tests/test_core/test_cert_manager.py +33 -19
- tests/test_core/test_security_manager.py +2 -2
- tests/test_examples/test_comprehensive_example.py +613 -0
- tests/test_examples/test_fastapi_example.py +290 -169
- tests/test_examples/test_flask_example.py +304 -162
- tests/test_examples/test_standalone_example.py +106 -168
- tests/test_integration/test_auth_flow.py +214 -198
- tests/test_integration/test_certificate_flow.py +181 -150
- tests/test_integration/test_fastapi_integration.py +140 -149
- tests/test_integration/test_flask_integration.py +144 -141
- tests/test_integration/test_standalone_integration.py +331 -300
- tests/test_middleware/test_fastapi_auth_middleware.py +745 -0
- tests/test_middleware/test_fastapi_middleware.py +147 -132
- tests/test_middleware/test_flask_auth_middleware.py +696 -0
- tests/test_middleware/test_flask_middleware.py +201 -179
- tests/test_middleware/test_security_middleware.py +151 -130
- tests/test_utils/test_datetime_compat.py +147 -0
- mcp_security_framework-0.1.0.dist-info/RECORD +0 -76
- {mcp_security_framework-0.1.0.dist-info → mcp_security_framework-1.1.1.dist-info}/WHEEL +0 -0
- {mcp_security_framework-0.1.0.dist-info → mcp_security_framework-1.1.1.dist-info}/entry_points.txt +0 -0
- {mcp_security_framework-0.1.0.dist-info → mcp_security_framework-1.1.1.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
"""
|
2
2
|
MCP Security Framework
|
3
3
|
|
4
|
-
Universal security framework for microservices with SSL/TLS, authentication,
|
4
|
+
Universal security framework for microservices with SSL/TLS, authentication,
|
5
5
|
authorization, and rate limiting.
|
6
6
|
|
7
7
|
This framework provides comprehensive security capabilities for Python applications,
|
@@ -21,7 +21,7 @@ Key Features:
|
|
21
21
|
Example Usage:
|
22
22
|
>>> from mcp_security_framework import SecurityManager, SecurityConfig
|
23
23
|
>>> from mcp_security_framework.schemas.config import AuthConfig
|
24
|
-
>>>
|
24
|
+
>>>
|
25
25
|
>>> config = SecurityConfig(
|
26
26
|
... auth=AuthConfig(
|
27
27
|
... enabled=True,
|
@@ -29,13 +29,13 @@ Example Usage:
|
|
29
29
|
... api_keys={"admin": "admin_key_123"}
|
30
30
|
... )
|
31
31
|
... )
|
32
|
-
>>>
|
32
|
+
>>>
|
33
33
|
>>> security_manager = SecurityManager(config)
|
34
34
|
>>> result = security_manager.validate_request({
|
35
35
|
... "api_key": "admin_key_123",
|
36
36
|
... "required_permissions": ["read", "write"]
|
37
37
|
... })
|
38
|
-
>>>
|
38
|
+
>>>
|
39
39
|
>>> if result.is_valid:
|
40
40
|
... print("Access granted!")
|
41
41
|
>>> else:
|
@@ -46,14 +46,29 @@ Version: 0.1.0
|
|
46
46
|
License: MIT
|
47
47
|
"""
|
48
48
|
|
49
|
-
from mcp_security_framework.core.security_manager import SecurityManager
|
50
49
|
from mcp_security_framework.core.auth_manager import AuthManager
|
51
50
|
from mcp_security_framework.core.cert_manager import CertificateManager
|
52
51
|
from mcp_security_framework.core.permission_manager import PermissionManager
|
53
52
|
from mcp_security_framework.core.rate_limiter import RateLimiter
|
54
|
-
from mcp_security_framework.
|
55
|
-
from mcp_security_framework.schemas.
|
56
|
-
|
53
|
+
from mcp_security_framework.core.security_manager import SecurityManager
|
54
|
+
from mcp_security_framework.schemas.config import (
|
55
|
+
AuthConfig,
|
56
|
+
PermissionConfig,
|
57
|
+
RateLimitConfig,
|
58
|
+
SecurityConfig,
|
59
|
+
SSLConfig,
|
60
|
+
)
|
61
|
+
from mcp_security_framework.schemas.models import (
|
62
|
+
AuthResult,
|
63
|
+
CertificateInfo,
|
64
|
+
CertificatePair,
|
65
|
+
ValidationResult,
|
66
|
+
)
|
67
|
+
from mcp_security_framework.schemas.responses import (
|
68
|
+
ErrorResponse,
|
69
|
+
SecurityResponse,
|
70
|
+
SuccessResponse,
|
71
|
+
)
|
57
72
|
|
58
73
|
# Version information
|
59
74
|
__version__ = "0.1.0"
|
@@ -65,29 +80,25 @@ __license__ = "MIT"
|
|
65
80
|
__all__ = [
|
66
81
|
# Core managers
|
67
82
|
"SecurityManager",
|
68
|
-
"AuthManager",
|
83
|
+
"AuthManager",
|
69
84
|
"CertificateManager",
|
70
85
|
"PermissionManager",
|
71
86
|
"RateLimiter",
|
72
|
-
|
73
87
|
# Configuration schemas
|
74
88
|
"SecurityConfig",
|
75
89
|
"AuthConfig",
|
76
|
-
"SSLConfig",
|
90
|
+
"SSLConfig",
|
77
91
|
"PermissionConfig",
|
78
92
|
"RateLimitConfig",
|
79
|
-
|
80
93
|
# Data models
|
81
94
|
"AuthResult",
|
82
95
|
"ValidationResult",
|
83
96
|
"CertificateInfo",
|
84
97
|
"CertificatePair",
|
85
|
-
|
86
98
|
# Response schemas
|
87
99
|
"SecurityResponse",
|
88
|
-
"ErrorResponse",
|
100
|
+
"ErrorResponse",
|
89
101
|
"SuccessResponse",
|
90
|
-
|
91
102
|
# Version info
|
92
103
|
"__version__",
|
93
104
|
"__author__",
|