Skip to main content

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.

Metadata

Release files for mcp-proxy-oauth-dcr 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-proxy-oauth-dcr 0.1.1
File Size Uploaded Provenance
mcp_proxy_oauth_dcr-0.1.1.tar.gz 61.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-proxy-oauth-dcr 0.1.1
File Interpreter ABI Platform
mcp_proxy_oauth_dcr-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 116.1 kB

Release files / mcp_proxy_oauth_dcr-0.1.1.tar.gz

Download URL mcp_proxy_oauth_dcr-0.1.1.tar.gz
Size 61.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f27ac5977af5e7f774378b9d6ae49d6c5c3739764c735d94964d77e8c791bf93
BLAKE2b-256 checksum
How to use checksums
f6981cb611c3f2c8b1aea863601dfc5df1f348988f19ae24b8af329c64b7e48d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / mcp_proxy_oauth_dcr-0.1.1-py3-none-any.whl

Download URL mcp_proxy_oauth_dcr-0.1.1-py3-none-any.whl
Size 55.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87c16d817f96ff112fd57609531304d4ab483be4ec2a4bf6850502462ef98c9c
BLAKE2b-256 checksum
How to use checksums
5478951895b2c1740645bc9e23362c30c38a141db2b8d9424ef9ea996e7e1ed4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for mcp-proxy-oauth-dcr 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page