How codeultr0n/swiggy-builders-club---ai-agent- works
Purpose and entry points
MCP Orchestrator is a Python 3.11+ coordination layer for Swiggy Food, Instamart, and Dineout MCP services. It turns natural-language requests plus user context into a prioritized, routed server action. Primary CLI entry point: orchestrator/__main__.py; HTTP/OAuth-facing entry point: server.py. Startup wiring is centralized in orchestrator/init_orchestrator.py.
Orchestrator composition
The core application object is assembled from client connectivity, memory, LLM reasoning, prioritization, routing, and registered plugins. orchestrator/__init__.py exposes the package surface, while orchestrator/init_orchestrator.py establishes the runtime dependency graph. Configuration separates service endpoints, app behavior, and scoring weights in config/servers.yaml, config/settings.yaml, and config/weights.yaml.
MCP client boundary
orchestrator/client.py is the protocol/service boundary for connections to external MCP servers. It should isolate MCP transport, credentials, tool discovery/invocation, and server failures from orchestration policy. The external service domain is Swiggy’s Food, Instamart, and Dineout MCP platform rather than direct commerce APIs.
Context, memory, and LLM reasoning
orchestrator/memory.py owns persistent cross-session user state such as preferences, history, and learned behavior; the stated storage runtime is SQLite or JSON. orchestrator/llm.py handles natural-language interpretation and reasoning through a pluggable OpenAI, Anthropic, or local-model provider. This creates a key boundary: durable state remains in memory rather than being repeatedly embedded in LLM prompts.
Prioritization and routing pipeline
Requests flow from LLM interpretation and stored/current context into orchestrator/prioritizer.py, which scores candidate tasks using signals including time, location, behavior, active goals, and urgency. orchestrator/router.py maps the selected task or intent to the appropriate plugin/MCP server. The resulting action is invoked through the MCP client, with outcomes available to update memory for later turns.
Plugin and domain adapters
The plugin layer makes server-specific capabilities extensible without changing central routing or prioritization. Domain registrations live in orchestrator/plugins/food.py, orchestrator/plugins/instamart.py, and orchestrator/plugins/dineout.py. Execution/translation handlers provide domain boundaries for the underlying service actions: orchestrator/plugins/handlers/food_handler.py, orchestrator/plugins/handlers/instamart_handler.py, and orchestrator/plugins/handlers/dineout_handler.py.
Authentication and server runtime
orchestrator/oauth.py contains OAuth callback/authentication integration, with server.py providing the surrounding server/API runtime. Credentials and MCP server definitions belong in config/servers.yaml, keeping authentication and remote endpoint details outside core task-selection logic.
Main entry points: init_orchestrator.py Runtime assembly · client.py MCP client · router.py Action router · prioritizer.py Task prioritizer
Components 20
Entry & Runtime
- CLI entry point
orchestrator/__main__.py - HTTP/OAuth server
server.py - OAuth integration
orchestrator/oauth.py
Orchestration Core
- Runtime assembly · Builds the orchestrator dependency graph.
orchestrator/init_orchestrator.py - Package surface
orchestrator/__init__.py - LLM reasoning · Interprets requests through OpenAI, Anthropic, or local models.
orchestrator/llm.py - User memory · Cross-session preferences, history, and learned behavior.
orchestrator/memory.py - Task prioritizer · Ranks tasks using context, behavior, goals, and urgency.
orchestrator/prioritizer.py - Action router
orchestrator/router.py - MCP client · Isolates transport, discovery, invocation, credentials, and failures.
orchestrator/client.py
Domain Plugins
- Food plugin
orchestrator/plugins/food.py - Instamart plugin
orchestrator/plugins/instamart.py - Dineout plugin
orchestrator/plugins/dineout.py - Food handler
orchestrator/plugins/handlers/food_handler.py - Instamart handler
orchestrator/plugins/handlers/instamart_handler.py - Dineout handler
orchestrator/plugins/handlers/dineout_handler.py
External Services
- Server credentials & endpoints
config/servers.yaml - Behavior & scoring config
config/settings.yaml - Prioritization weights
config/weights.yaml - Swiggy MCP platform · Food, Instamart, and Dineout server capabilities.
Connections 27
- CLI entry point → Runtime assembly: starts
- HTTP/OAuth server → OAuth integration: hosts
- HTTP/OAuth server → Runtime assembly: initializes
- Package surface → Runtime assembly: exposes
- Runtime assembly → LLM reasoning: wires
- Runtime assembly → User memory: wires
- Runtime assembly → Task prioritizer: wires
- Runtime assembly → Action router: wires
- Runtime assembly → MCP client: wires
- LLM reasoning → Task prioritizer: interpreted intent
- User memory → Task prioritizer: user context
- Task prioritizer → Action router: selected task
- Action router → Food plugin: routes food
- Action router → Instamart plugin: routes groceries
- Action router → Dineout plugin: routes dining
- Food plugin → Food handler: uses
- Instamart plugin → Instamart handler: uses
- Dineout plugin → Dineout handler: uses
- Food handler → MCP client: invokes via
- Instamart handler → MCP client: invokes via
- Dineout handler → MCP client: invokes via
- MCP client → Swiggy MCP platform: MCP transport
- MCP client → User memory: outcomes update
- Server credentials & endpoints → MCP client: configures
- Behavior & scoring config → Runtime assembly: configures
- Prioritization weights → Task prioritizer: configures
- Server credentials & endpoints → OAuth integration: credentials