Skip to main content

Gateway Pattern: Zero-Inference Routing

SuperModel’s MCP gateway pattern provides intelligent routing and orchestration of multiple UI generation tools while maintaining zero server inference. This is similar to existing MCP gateway tools, with a critical difference: all routing decisions happen via MCP sampling.

Traditional vs SuperModel Gateway

Problems:
  • Server incurs LLM costs for every request
  • Need to maintain LLM infrastructure
  • Scaling costs increase linearly

Gateway Architecture

Core Components

1. Tool Registry

The gateway maintains a registry of available UI generation tools:

2. Sampling Router

The router uses MCP sampling to make intelligent tool selection decisions:

3. Gateway Orchestrator

The main gateway coordinates the entire flow:

Configuration and Setup

Gateway Configuration

supermodel.config.json

Tool Registration

Advanced Features

Performance Optimizations

Routing Cache

Cache common routing decisions to reduce sampling requests for repeated patterns.

Parallel Tool Loading

Load and prepare multiple tools in parallel for faster response times.

Context Compression

Compress context data to reduce payload size in sampling requests.

Tool Preloading

Preload likely next tools based on user journey patterns.

Monitoring and Analytics

Next Steps

Zero-Inference Architecture

Understand how SuperModel eliminates all server inference costs.

Context Handoff

Learn how context flows seamlessly between different tools and apps.