mcp-proxy-oauth-dcr 0.1.0__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/__init__.py +89 -0
- mcp_proxy/__main__.py +340 -0
- mcp_proxy/auth/__init__.py +8 -0
- mcp_proxy/auth/manager.py +908 -0
- mcp_proxy/config/__init__.py +8 -0
- mcp_proxy/config/manager.py +200 -0
- mcp_proxy/exceptions.py +186 -0
- mcp_proxy/http/__init__.py +9 -0
- mcp_proxy/http/authenticated_client.py +388 -0
- mcp_proxy/http/client.py +997 -0
- mcp_proxy/logging_config.py +71 -0
- mcp_proxy/models.py +259 -0
- mcp_proxy/protocols.py +122 -0
- mcp_proxy/proxy.py +586 -0
- mcp_proxy/stdio/__init__.py +31 -0
- mcp_proxy/stdio/interface.py +580 -0
- mcp_proxy/stdio/jsonrpc.py +371 -0
- mcp_proxy/translator/__init__.py +11 -0
- mcp_proxy/translator/translator.py +691 -0
- mcp_proxy_oauth_dcr-0.1.0.dist-info/METADATA +167 -0
- mcp_proxy_oauth_dcr-0.1.0.dist-info/RECORD +25 -0
- mcp_proxy_oauth_dcr-0.1.0.dist-info/WHEEL +5 -0
- mcp_proxy_oauth_dcr-0.1.0.dist-info/entry_points.txt +2 -0
- mcp_proxy_oauth_dcr-0.1.0.dist-info/licenses/LICENSE +21 -0
- mcp_proxy_oauth_dcr-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-proxy-oauth-dcr
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP Proxy with OAuth Dynamic Client Registration support
|
|
5
|
+
Author-email: MCP Proxy Team <team@mcpproxy.dev>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/mcpproxy/mcp-proxy-oauth-dcr
|
|
8
|
+
Project-URL: Repository, https://github.com/mcpproxy/mcp-proxy-oauth-dcr
|
|
9
|
+
Project-URL: Issues, https://github.com/mcpproxy/mcp-proxy-oauth-dcr/issues
|
|
10
|
+
Keywords: mcp,oauth,dcr,proxy,protocol-translation
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
21
|
+
Classifier: Topic :: System :: Networking
|
|
22
|
+
Requires-Python: >=3.8
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: aiohttp>=3.8.0
|
|
26
|
+
Requires-Dist: asyncio-mqtt>=0.11.0
|
|
27
|
+
Requires-Dist: pydantic>=2.0.0
|
|
28
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
29
|
+
Requires-Dist: structlog>=23.0.0
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: hypothesis>=6.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: isort>=5.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
39
|
+
Provides-Extra: test
|
|
40
|
+
Requires-Dist: pytest>=7.0.0; extra == "test"
|
|
41
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
|
|
42
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "test"
|
|
43
|
+
Requires-Dist: hypothesis>=6.0.0; extra == "test"
|
|
44
|
+
Requires-Dist: aioresponses>=0.7.0; extra == "test"
|
|
45
|
+
Dynamic: license-file
|
|
46
|
+
|
|
47
|
+
# MCP Proxy with OAuth DCR Support
|
|
48
|
+
|
|
49
|
+
A protocol translation service that enables Kiro to connect to HTTP streamable MCP servers through a stdio interface while providing OAuth Dynamic Client Registration authentication.
|
|
50
|
+
|
|
51
|
+
## Overview
|
|
52
|
+
|
|
53
|
+
The MCP Proxy acts as an intermediary that handles protocol conversion between stdio MCP (expected by Kiro) and HTTP streamable MCP (provided by backend servers), while managing OAuth DCR authentication flows with the backend's OAuth provider.
|
|
54
|
+
|
|
55
|
+
## Features
|
|
56
|
+
|
|
57
|
+
- **Protocol Translation**: Converts between stdio JSON-RPC and HTTP streamable MCP protocols
|
|
58
|
+
- **OAuth DCR Support**: Automatic client registration and token management using RFC 7591
|
|
59
|
+
- **Connection Resilience**: Automatic reconnection with exponential backoff
|
|
60
|
+
- **Secure Token Management**: In-memory credential storage with automatic refresh
|
|
61
|
+
- **Comprehensive Error Handling**: Graceful handling of network and authentication failures
|
|
62
|
+
- **Configurable**: Environment variable and configuration file support
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install mcp-proxy-oauth-dcr
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
For development:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install -e ".[dev]"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Usage
|
|
77
|
+
|
|
78
|
+
### Command Line
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
mcp-proxy --mcp-server-url https://example.com/mcp --oauth-provider-url https://oauth.example.com
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Environment Variables
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
export MCP_SERVER_URL=https://example.com/mcp
|
|
88
|
+
export OAUTH_PROVIDER_URL=https://oauth.example.com
|
|
89
|
+
export CLIENT_NAME=my-mcp-client
|
|
90
|
+
mcp-proxy
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Configuration File
|
|
94
|
+
|
|
95
|
+
Create a `config.json` file:
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"mcpServerUrl": "https://example.com/mcp",
|
|
100
|
+
"oauthProviderUrl": "https://oauth.example.com",
|
|
101
|
+
"clientName": "my-mcp-client",
|
|
102
|
+
"scopes": ["mcp:read", "mcp:write"],
|
|
103
|
+
"connectionTimeout": 30,
|
|
104
|
+
"retryAttempts": 3,
|
|
105
|
+
"logLevel": "info"
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Then run:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
mcp-proxy --config config.json
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Development
|
|
116
|
+
|
|
117
|
+
### Setup
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
git clone https://github.com/mcpproxy/mcp-proxy-oauth-dcr.git
|
|
121
|
+
cd mcp-proxy-oauth-dcr
|
|
122
|
+
pip install -e ".[dev]"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Testing
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Run all tests
|
|
129
|
+
pytest
|
|
130
|
+
|
|
131
|
+
# Run unit tests only
|
|
132
|
+
pytest -m unit
|
|
133
|
+
|
|
134
|
+
# Run property-based tests
|
|
135
|
+
pytest -m property
|
|
136
|
+
|
|
137
|
+
# Run with coverage
|
|
138
|
+
pytest --cov=mcp_proxy --cov-report=html
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Code Quality
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Format code
|
|
145
|
+
black src tests
|
|
146
|
+
isort src tests
|
|
147
|
+
|
|
148
|
+
# Type checking
|
|
149
|
+
mypy src
|
|
150
|
+
|
|
151
|
+
# Linting
|
|
152
|
+
flake8 src tests
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Architecture
|
|
156
|
+
|
|
157
|
+
The proxy consists of several key components:
|
|
158
|
+
|
|
159
|
+
- **Stdio Interface**: Handles JSON-RPC communication with Kiro via stdin/stdout
|
|
160
|
+
- **Protocol Translator**: Converts between stdio and HTTP streamable MCP protocols
|
|
161
|
+
- **Authentication Manager**: Manages OAuth DCR flows and token lifecycle
|
|
162
|
+
- **HTTP Client**: Handles communication with backend HTTP MCP servers
|
|
163
|
+
- **Configuration Manager**: Manages configuration loading and validation
|
|
164
|
+
|
|
165
|
+
## License
|
|
166
|
+
|
|
167
|
+
MIT License - see LICENSE file for details.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
mcp_proxy/__init__.py,sha256=7FARtSpYtOrlvz_x0HiB0AkuV_pNymgoysOom_rAiJ0,2092
|
|
2
|
+
mcp_proxy/__main__.py,sha256=x2j4eH5cWul2XX1KHgaFHZv6WmR7G9wHTtA7SBfBdvI,11102
|
|
3
|
+
mcp_proxy/exceptions.py,sha256=14AOxQcy7TteJktvlYmAIoIm1orGRMnoplALR2uJtWU,5299
|
|
4
|
+
mcp_proxy/logging_config.py,sha256=QQbMC407ADga7wvY_A8CNG93Uo8dXtRKC9-BQqaKn8c,2157
|
|
5
|
+
mcp_proxy/models.py,sha256=lpkhN4h5g12re7gtoWk_g2KtZZY0CNUOE1Jy2dxtXLQ,10121
|
|
6
|
+
mcp_proxy/protocols.py,sha256=SABvsQFofjVLB_kZNZ0FtWCTl7q_PrlgK54851EAovw,3493
|
|
7
|
+
mcp_proxy/proxy.py,sha256=rKxLVFiK85YTeMSUzfoHpZRilHZxV1JbqBvo_tpofJA,21965
|
|
8
|
+
mcp_proxy/auth/__init__.py,sha256=-q30rFGLqsth8a48tpR686dbDfs6wMk3uY8zTEQNvbk,194
|
|
9
|
+
mcp_proxy/auth/manager.py,sha256=KIIqWnfOjd2sze3E6ePJfUHlPvSHOSwURs3kvpnv0Io,38611
|
|
10
|
+
mcp_proxy/config/__init__.py,sha256=t4sG-it5Ex21kEk9SQO2FULOQZfW62gZWncP-snoKH0,197
|
|
11
|
+
mcp_proxy/config/manager.py,sha256=2CAJZkUzyAdyJWbsVX9Uk6vrgNMsjPJgs6PDKz71DaY,7830
|
|
12
|
+
mcp_proxy/http/__init__.py,sha256=NLGVjErqtDkzjgAUtp6SAKOL5nzm8d3K4QF6WL6Na8U,267
|
|
13
|
+
mcp_proxy/http/authenticated_client.py,sha256=cwQFP271ujXn0lbPAd6XydhNORAPGdGHcjb8GKOUEkE,14952
|
|
14
|
+
mcp_proxy/http/client.py,sha256=TVo0F5yq9j-8oKmofyPZxV2VI1_azBrJr1PNfXUslRI,36085
|
|
15
|
+
mcp_proxy/stdio/__init__.py,sha256=Ef81aVmQHI4PJ_Am6YfhODaZ4SPvUEm09GFn2wg41Bw,773
|
|
16
|
+
mcp_proxy/stdio/interface.py,sha256=zPk7SqsI3NQor9tJCbpvrz3KYgz_hXV2xE3B_6L4Xlk,23582
|
|
17
|
+
mcp_proxy/stdio/jsonrpc.py,sha256=ZdQFuDT_lNQaeCLfA24WowUg8aEHzKoPXjJ3kRHh9SY,11477
|
|
18
|
+
mcp_proxy/translator/__init__.py,sha256=9ctnUxcWzHWZF9MWgZ-SGk-hJJ8aXQrYh54Q3Q1M9ys,299
|
|
19
|
+
mcp_proxy/translator/translator.py,sha256=N18s2zcn6RFLgVOVJBvE6CiKG1cTyEhI_yXSqDTjICw,25434
|
|
20
|
+
mcp_proxy_oauth_dcr-0.1.0.dist-info/licenses/LICENSE,sha256=mjT1yL_kUDL8NMqlivEzLxNe5IxEKAL-sl4H18aA9sw,1092
|
|
21
|
+
mcp_proxy_oauth_dcr-0.1.0.dist-info/METADATA,sha256=DUOFDrvBRxPTbr1flD2buMyZiVTeahNi7P0jAubOFfo,4761
|
|
22
|
+
mcp_proxy_oauth_dcr-0.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
23
|
+
mcp_proxy_oauth_dcr-0.1.0.dist-info/entry_points.txt,sha256=KlbS6EzD3EXHcoVgtTM_7iZgEWe9RxSkyXZr9YWOML4,58
|
|
24
|
+
mcp_proxy_oauth_dcr-0.1.0.dist-info/top_level.txt,sha256=Sc_nmlR8kpkoOyksgzzlMw7rdAn5ZsPfRsd_tVWgiBI,10
|
|
25
|
+
mcp_proxy_oauth_dcr-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 MCP Proxy Team
|
|
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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mcp_proxy
|