JSON-RPC Proxy MCP Server
A Model Context Protocol (MCP) server that handles embedded wallet and auth token orchestration, built with modern Python packaging best practices.
Features
- 🔌 Exposes JSON-RPC methods as MCP tools
- 🔐 Token-based authentication support
- 🏗️ Modern Python package structure
- 📦 Easy installation via pip
- 🧪 Includes test client for development
- 💎 Sui wallet integration
Project Structure
mcp-auth-server/
├── jsonrpc_proxy_mcp/ # Main package
│ ├── __init__.py
│ ├── server.py # MCP server implementation
│ ├── wallet.py # Sui wallet utilities
│ └── __main__.py # Entry point
├── examples/
│ └── client.py # Test client example
├── tests/
│ └── test_wallet.py # Unit tests
├── scripts/
│ └── setup.sh # Setup script
├── pyproject.toml # Modern Python packaging
└── README.mdRequirements
- Python 3.9+
- Virtual environment (recommended)
Quick Start
1. Installation
Clone and setup:
git clone https://github.com/YOUR_USERNAME/mcp-auth-server.git
cd mcp-auth-server
./setup.shThe setup script will:
- Create a virtual environment
- Install the package and dependencies
- Make the MCP server available as a command
2. Activate the virtual environment
source venv/bin/activateUsage
Running the JSON-RPC Server
First, start your local JSON-RPC server. The MCP server is configured to connect to http://localhost:8080 by default.
python3 /path/to/your/json_rpc_server.pyRunning the MCP Server
You can run the server in multiple ways:
As a module:
python -m jsonrpc_proxy_mcpAs a command (after installation):
jsonrpc-proxy-mcpFor Claude Desktop integration: Add to your Claude Desktop config file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"jsonrpc-proxy": {
"command": "/path/to/mcp-auth-server/venv/bin/python",
"args": ["-m", "jsonrpc_proxy_mcp"]
}
}
}Using the Test Client
For development and testing, use the included example client:
python examples/client.pyThe client provides an interactive command-line interface with the following commands:
help- Show available commandslist- List available toolsecho- Test the jsonrpc_echo tooltime- Get current time via jsonrpc_get_timepurchase_token- Purchase a JWT token via jsonrpc_purchase_tokenexit- Exit the client
Available MCP Tools
The server exposes the following tools (all with jsonrpc_ prefix to avoid naming conflicts):
jsonrpc_purchase_token- Purchase a JWT token for authenticationjsonrpc_echo- Echo back a message (requires authentication)jsonrpc_get_time- Get the current server time (requires authentication)
All tools follow MCP best practices including:
- Tool annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint)
- Pydantic input validation for type safety
- Comprehensive error messages with troubleshooting guidance
- Proper logging to stderr (not stdout) for stdio transport compatibility
Development
Installing in Editable Mode
For development, install the package in editable mode:
pip install -e .This allows you to make changes to the code and see them immediately without reinstalling.
Running Tests
pytest tests/Code Quality
Format code with Black:
black jsonrpc_proxy_mcp/Lint with Ruff:
ruff check jsonrpc_proxy_mcp/Type check with mypy:
mypy jsonrpc_proxy_mcp/Package Structure
- jsonrpc_proxy_mcp/: Main package directory
- server.py: MCP server implementation with tools - wallet.py: Sui wallet integration utilities - __main__.py: Entry point for running as a module - __init__.py: Package initialization
- examples/: Example usage and test clients
- tests/: Unit tests
- scripts/: Utility scripts (setup, etc.)
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
License
MIT
