MCP Proxy with OAuth Dynamic Client Registration support
Project description
MCP Proxy with OAuth DCR Support
Note that this was entirely AI generated and made to handle a specific use-case where closed-source clients do not support FastMCP DCR O-Auth properly. It has been tested with one specific MCP server and works within Kiro, however your milage may vary. As this is AI generated do not query me on its workings, this is a purely temporary tool that burned an ocean to exist.
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.
Overview
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.
Features
- Protocol Translation: Converts between stdio JSON-RPC and HTTP streamable MCP protocols
- OAuth DCR Support: Automatic client registration and token management using RFC 7591
- Connection Resilience: Automatic reconnection with exponential backoff
- Secure Token Management: In-memory credential storage with automatic refresh
- Comprehensive Error Handling: Graceful handling of network and authentication failures
- Configurable: Environment variable and configuration file support
Installation
pip install mcp-proxy-oauth-dcr
For development:
pip install -e ".[dev]"
Usage
Command Line
mcp-proxy --mcp-server-url https://example.com/mcp --oauth-provider-url https://oauth.example.com
Environment Variables
export MCP_SERVER_URL=https://example.com/mcp
export OAUTH_PROVIDER_URL=https://oauth.example.com
export CLIENT_NAME=my-mcp-client
mcp-proxy
Configuration File
Create a config.json file:
{
"mcpServerUrl": "https://example.com/mcp",
"oauthProviderUrl": "https://oauth.example.com",
"clientName": "my-mcp-client",
"scopes": ["mcp:read", "mcp:write"],
"connectionTimeout": 30,
"retryAttempts": 3,
"logLevel": "info"
}
Then run:
mcp-proxy --config config.json
Development
Testing
# Run all tests
pytest
# Run unit tests only
pytest -m unit
# Run property-based tests
pytest -m property
# Run with coverage
pytest --cov=mcp_proxy --cov-report=html
Code Quality
# Format code
black src tests
isort src tests
# Type checking
mypy src
# Linting
flake8 src tests
Architecture
The proxy consists of several key components:
- Stdio Interface: Handles JSON-RPC communication with Kiro via stdin/stdout
- Protocol Translator: Converts between stdio and HTTP streamable MCP protocols
- Authentication Manager: Manages OAuth DCR flows and token lifecycle
- HTTP Client: Handles communication with backend HTTP MCP servers
- Configuration Manager: Manages configuration loading and validation
License
MIT License - see LICENSE file for details.
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_oauth_dcr-0.1.1.tar.gz.
File metadata
- Download URL: mcp_proxy_oauth_dcr-0.1.1.tar.gz
- Upload date:
- Size: 61.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f27ac5977af5e7f774378b9d6ae49d6c5c3739764c735d94964d77e8c791bf93
|
|
| MD5 |
1144e70291c8c38f79dd6977ad12fce9
|
|
| BLAKE2b-256 |
f6981cb611c3f2c8b1aea863601dfc5df1f348988f19ae24b8af329c64b7e48d
|
File details
Details for the file mcp_proxy_oauth_dcr-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mcp_proxy_oauth_dcr-0.1.1-py3-none-any.whl
- Upload date:
- Size: 55.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87c16d817f96ff112fd57609531304d4ab483be4ec2a4bf6850502462ef98c9c
|
|
| MD5 |
f0403d2823893ee440da7a11440e656c
|
|
| BLAKE2b-256 |
5478951895b2c1740645bc9e23362c30c38a141db2b8d9424ef9ea996e7e1ed4
|