Skip to main content

MCP Proxy with OAuth Dynamic Client Registration support

Project description

MCP Proxy with OAuth DCR Support

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

Setup

git clone https://github.com/mcpproxy/mcp-proxy-oauth-dcr.git
cd mcp-proxy-oauth-dcr
pip install -e ".[dev]"

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_proxy_oauth_dcr-0.1.0.tar.gz (60.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_proxy_oauth_dcr-0.1.0-py3-none-any.whl (54.9 kB view details)

Uploaded Python 3

File details

Details for the file mcp_proxy_oauth_dcr-0.1.0.tar.gz.

File metadata

  • Download URL: mcp_proxy_oauth_dcr-0.1.0.tar.gz
  • Upload date:
  • Size: 60.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for mcp_proxy_oauth_dcr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 36bf8caf15fcd373a6277daac0d5fd11a4155cc62d416c939e22ee1d766053b6
MD5 a10434b3c29af77fcb7fcdfe3312e853
BLAKE2b-256 7f85b32a02a905d024f3a6f77531defbd7c7e2cf768c91083ad4f53af4254a7a

See more details on using hashes here.

File details

Details for the file mcp_proxy_oauth_dcr-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_proxy_oauth_dcr-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 522da18a666160f5969883b1f4f2732201ae8282e231eae856a6f64d8e435802
MD5 828e7f0f828770b9535a077e5aea5834
BLAKE2b-256 07f8fdb1499c0d78fbcd9c265ea7a4250f9c4809199bc33dfbf1477ec45043f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page