Metadata-Version: 2.4
Name: mcp-proxy-oauth-dcr
Version: 0.1.1
Summary: MCP Proxy with OAuth Dynamic Client Registration support
Author-email: MCP Proxy Team <team@mcpproxy.dev>
License-Expression: MIT
Project-URL: Homepage, https://github.com/mcpproxy/mcp-proxy-oauth-dcr
Project-URL: Repository, https://github.com/mcpproxy/mcp-proxy-oauth-dcr
Project-URL: Issues, https://github.com/mcpproxy/mcp-proxy-oauth-dcr/issues
Keywords: mcp,oauth,dcr,proxy,protocol-translation
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: System :: Networking
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp>=3.8.0
Requires-Dist: asyncio-mqtt>=0.11.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: structlog>=23.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: hypothesis>=6.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: isort>=5.0.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Requires-Dist: flake8>=6.0.0; extra == "dev"
Provides-Extra: test
Requires-Dist: pytest>=7.0.0; extra == "test"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
Requires-Dist: pytest-cov>=4.0.0; extra == "test"
Requires-Dist: hypothesis>=6.0.0; extra == "test"
Requires-Dist: aioresponses>=0.7.0; extra == "test"
Dynamic: license-file

# 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

```bash
pip install mcp-proxy-oauth-dcr
```

For development:

```bash
pip install -e ".[dev]"
```

## Usage

### Command Line

```bash
mcp-proxy --mcp-server-url https://example.com/mcp --oauth-provider-url https://oauth.example.com
```

### Environment Variables

```bash
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:

```json
{
  "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:

```bash
mcp-proxy --config config.json
```

## Development

### Testing

```bash
# 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

```bash
# 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.
