Transform any Python SDK into a comprehensive MCP server with automatic discovery, LLM enhancement, and production-ready safety controls.
# 1. Setup environment
uv sync
cp .env.example .env # Add your API keys
# 2. Launch MCP Inspector with secure config
npx @modelcontextprotocol/inspector --config inspector_config.json
# 3. Select "GitHub Auto-Discovery" and connect
# 4. Test: github.search_repositories with {"query": "python"}# 1. Start MCP Inspector
npx @modelcontextprotocol/inspector
# 2. Configure server:
# Command: uv
# Arguments: run python /path/to/mcp_server.py --sdk github-auto --debug
# Working Directory: /path/to/anysdk-mcp
# Environment: PYTHONPATH=/path/to/anysdk-mcp- Automatically discovers ALL SDK methods using reflection
- No manual configuration - Just point it at any Python SDK
- Rich type extraction - Handles Union, Optional, Enum, datetime, etc.
- Docstring parsing - Extracts parameter descriptions automatically
- OpenAI integration - Improves tool descriptions for better agent UX
- Risk classification - AI-powered safety assessment
- Cost controls - $2 budget limit with intelligent caching
- Smart enhancement - Only uses LLM when confidence β₯ 0.7
- Plan/Apply pattern - Preview dangerous operations before execution
- Rate limiting - Configurable per-SDK limits
- Input validation - Sanitization and security controls
- Comprehensive testing - 52/53 tests passing (98% success rate)
| SDK | Typical MCP Server | Our Converter | Improvement |
|---|---|---|---|
| GitHub | 5-10 methods | 37+ methods | 4-7x more |
| Kubernetes | Core pods/deployments | 100+ methods | 10x more |
| Azure | Limited compute | 200+ methods | 20x more |
- 37+ methods - Complete GitHub API coverage
- Authentication - Works with/without GitHub token
- Examples:
github.search_repositories,github.get_user,github.search_code - Write operations:
github.create_repo.planβgithub.create_repo.apply
- 100+ methods - All K8s API groups (Core, Apps, Networking, etc.)
- Namespace support - Automatic namespace handling
- Examples:
k8s.CoreV1Api_list_namespaced_pod,k8s.AppsV1Api_scale_namespaced_deployment - Safe operations - Dry-run support where available
- 200+ methods - Complete Azure Management SDK coverage
- LRO handling - Proper async operation support for
begin_*methods - Examples:
azure.VirtualMachinesOperations_begin_create,azure.ResourceGroupsOperations_list - Multi-client - Covers Compute, Network, Storage, Resource management
Write operations (create, delete, update) use a safe two-step process:
- Plan:
github.create_repo.plan {"name": "my-repo"}β Returns plan ID - Apply:
github.create_repo.apply {"plan_id": "uuid-here"}β Executes operation
This prevents accidental destructive operations and allows review before execution.
- Read operations: Execute immediately (low risk)
- Write operations: Require plan/apply (medium/high risk)
- Risk levels: Low, Medium, High based on potential impact
- Configurable rate limiting per SDK
- Input validation and sanitization
- Response size limits
- Execution timeouts
- Operation logging
Each SDK can be customized via YAML configuration:
configs/github.yaml- GitHub settings, rate limits, safety rulesconfigs/k8s.yaml- Kubernetes settings, namespace restrictions
GITHUB_TOKEN: GitHub personal access token for authenticated requestsKUBECONFIG: Path to Kubernetes configuration fileMCP_SDK: Default SDK to use (github-auto, k8s-auto, github, k8s)
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β MCP Client β β SDK Bridge β β Target SDK β
β (Investigator, βββββΊβ (FastMCP) βββββΊβ (GitHub, β
β Claude, etc.) β β β β K8s, etc.) β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β
βΌ
ββββββββββββββββ
β Auto-Discoveryβ
β + Plan/Apply β
β + Safety β
ββββββββββββββββ
- Auto-Discovery: Automatically finds SDK methods using reflection
- Schema Generation: Creates MCP tool schemas from method signatures
- Plan/Apply: Safe execution pattern for write operations
- Safety Controls: Rate limiting, input validation, risk assessment
- Multi-SDK Support: GitHub, Kubernetes, extensible to any Python SDK
# Test GitHub access
python -c "from github import Github; print(Github().get_rate_limit())"
# Test with token
GITHUB_TOKEN=your_token python -c "from github import Github; print(Github('your_token').get_rate_limit())"# Check cluster access
kubectl cluster-info
# Check current context
kubectl config current-context# Test server startup
python mcp_server.py --sdk github-auto --debug
# Check dependencies
uv run python -c "import mcp_sdk_bridge; print('β
Package imported')"The bridge supports any Python SDK through auto-discovery:
- Install the SDK package
- Create a minimal auto-adapter (see
adapters/auto_github.py) - Add to CLI choices and validation
- The bridge will automatically discover methods and create tools
# Run all tests
PYTHONPATH=/path/to/anysdk-mcp uv run pytest
# Run specific tests
PYTHONPATH=/path/to/anysdk-mcp uv run pytest tests/test_e2e.py -v
# Test individual components
python tests/test_e2e.py # Runs sync testsOnce connected, you can use natural language with the auto-discovered tools:
"List my GitHub repositories"
β Uses github.get_user + github.search_repositories
"Show pods in the default namespace"
β Uses k8s.CoreV1Api_list_namespaced_pod
"Create a new repository called 'test-project'"
β Uses github.create_repo.plan β Review β github.create_repo.apply
The auto-discovery adapters provide comprehensive access to SDK APIs while maintaining safety through the plan/apply pattern for potentially destructive operations.
tools.search- Find tools by name/description:{"query": "repo"}meta.stats- Get comprehensive server statisticsmeta.export_tools- Export tool catalog in JSON/Markdowntools.validate- Validate all tools and check for issuestools.health_check- Run automated tests on all safe tools
lro.get_status- Check operation statuslro.wait- Wait for operation completionlro.list_operations- List all tracked operations
# GitHub
GITHUB_TOKEN=ghp_your_token_here
# Kubernetes
KUBECONFIG=~/.kube/config
# Azure
AZURE_TENANT_ID=your_tenant_id
AZURE_SUBSCRIPTION_ID=your_subscription_id
# LLM Enhancement
OPENAI_API_KEY=sk-proj-your_key_here- β No API keys in config files - Environment-based secrets
- β Automatic .env loading - Server loads environment on startup
- β Shareable configurations - Safe to commit to version control
# Run all tests (52/53 passing - 98% success rate)
PYTHONPATH=. uv run pytest
# Test specific SDK
PYTHONPATH=. uv run pytest tests/test_azure_auto.py -vtools.validate- Check schemas and generate examplestools.health_check- Automated testing of read-only toolstools.test- Test specific tools with auto-generated parameters
class StripeAutoAdapter:
def __init__(self, config):
self.stripe = stripe.Client(api_key=config.api_key)
self.discoverer = SDKDiscoverer("stripe")
# Auto-discovery creates 50+ Stripe tools automatically!Requirements for new SDKs:
- β Well-documented - Methods have docstrings
- β Standard Python patterns - Classes, methods, type hints
- β
Introspectable - Works with
inspect.signature()
Your MCP Inspector is running at: http://localhost:6274
Test the power of universal SDK-to-MCP conversion:
- Connect to "GitHub Auto-Discovery"
- Try
github.search_repositorieswith{"query": "python"} - Explore
meta.statsto see 37+ available tools - Validate with
tools.health_checkfor comprehensive testing
This solution transforms the MCP ecosystem by making ANY Python SDK instantly available to agents with production-grade safety and LLM-enhanced usability! π