Model Context Protocol Proxy Adapter with Security Framework
Project description
MCP Proxy Adapter
A powerful framework for creating JSON-RPC-enabled microservices with built-in security, authentication, and proxy registration capabilities.
Features
- JSON-RPC Framework: Complete JSON-RPC 2.0 implementation
- Security Integration: Built-in support for mcp_security_framework
- Authentication: Multiple auth methods (API Key, JWT, Certificate, Basic Auth)
- Proxy Registration: Automatic registration and discovery of services
- Command System: Extensible command framework with role-based access control
- SSL/TLS Support: Full SSL/TLS support including mTLS
- Async Support: Built on FastAPI with full async support
- Extensible: Plugin system for custom commands and middleware
Quick Start
Installation
pip install mcp-proxy-adapter
Basic Usage
from mcp_proxy_adapter import create_app, Command, SuccessResult
# Create a custom command
class HelloCommand(Command):
name = "hello"
descr = "Say hello"
async def execute(self, **kwargs) -> SuccessResult:
name = kwargs.get("name", "World")
return SuccessResult(f"Hello, {name}!")
# Create and run the application
app = create_app()
Configuration
{
"server": {
"host": "0.0.0.0",
"port": 8000
},
"security": {
"enabled": true,
"framework": "mcp_security_framework"
},
"commands": {
"auto_discovery": true,
"builtin_commands": ["echo", "health", "config"]
}
}
Examples
Proxy Registration Example
# Example of proxy registration with authentication
import asyncio
from mcp_proxy_adapter.examples.proxy_registration_example import ProxyRegistrationExample
async def main():
async with ProxyRegistrationExample("http://localhost:8002", "your-token") as client:
result = await client.test_registration({
"server_id": "my-server",
"server_url": "http://localhost:8001",
"server_name": "My Server"
})
print(f"Registration result: {result}")
asyncio.run(main())
Security Testing
The framework includes comprehensive security testing examples:
- HTTP with Token Authentication
- HTTPS with Certificate Authentication
- mTLS (Mutual TLS) Authentication
- Role-based Access Control
- Permission Validation
Documentation
For detailed documentation, examples, and API reference, see the documentation.
Development
Setup Development Environment
git clone https://github.com/maverikod/mcp-proxy-adapter.git
cd mcp-proxy-adapter
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -e ".[dev]"
Running Tests
pytest tests/
Running Examples
# Start server
python -m mcp_proxy_adapter.main --config examples/server_configs/config_simple.json
# Run proxy registration example
python examples/proxy_registration_example.py
License
MIT License - see LICENSE file for details.
Author
Vasiliy Zdanovskiy - vasilyvz@gmail.com
Version
6.1.0 - Major release with security framework integration and proxy registration capabilities.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_proxy_adapter-6.1.0.tar.gz.
File metadata
- Download URL: mcp_proxy_adapter-6.1.0.tar.gz
- Upload date:
- Size: 288.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
822269df96c63b4bc746c6d81cd9ac8998e88722a627dc6b6017d6ebcaf774cd
|
|
| MD5 |
13405e53555ebef3e90c1eba96f2ecd5
|
|
| BLAKE2b-256 |
815cc10e9ae68f809492e0e50d40813c33832bed236773f21eba92d1fa7a0a27
|
File details
Details for the file mcp_proxy_adapter-6.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_proxy_adapter-6.1.0-py3-none-any.whl
- Upload date:
- Size: 357.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
249c284290d7b81da5176ace1a4f7b3f4bebb50a70bd128241572c4e1c1a1a46
|
|
| MD5 |
49fac81d6a596b508f7ec6cb747c319b
|
|
| BLAKE2b-256 |
83adec7a3928a687b6b33382ded62c1a0c90d5937d526390a39b36250d28afbb
|