Skip to content

superuser303/mission-pizza

Repository files navigation

Mission Pizza: AI-Ready MCP Architecture

🚀 The Solution

This project automates the transition from legacy OpenAPI specs to the Model Context Protocol (MCP). Instead of manually writing tools, I built a system that generates them dynamically.

🏗 Architecture

  • Legacy System: A Mock FastAPI backend (simulating the pizza database).
  • The Bridge (generate_mcp.py): A Python script that parses openapi.json and auto-generates a fully compliant MCP server (server.py). This ensures scalability—if the menu changes, the AI tools update automatically.
  • Agent Swarm:
    • Ordering Agent: Uses Gemini 1.5 to interact with the generated MCP server.
    • Scheduling Agent: Receives order context (ETA) and uses a simulated Calendar MCP to block time for a "Pizza Study Break.

🛠 How to Run

  1. Install Dependencies:
    pip install fastapi uvicorn mcp google-genai python-dotenv
  2. Start the Backend:
    uvicorn backend:app --port 8000
  3. Generate the MCP Server:
    python backend.py generate_spec   # Creates json
    python generate_mcp.py            # Creates server.py
  4. Run the Multi-Agent Workflow:
    python main_flow.py

🧠 Design Decisions

  • Why Mock Data? As per the prompt requirements, I focused on the MCP transformation logic rather than building a complex SQL backend.
  • Security: API Keys are managed via .env (not committed).
  • Robustness: The generator sanitizes function names to prevent Python syntax errors during the JSON-to-MCP conversion.

System Data Flow

graph TD
    User[User] -->|Natural Language| Agent1[Ordering Agent]
    Agent1 -->|Tools| MCPServer[Generated MCP Server]
    MCPServer -->|API Calls| Backend[Legacy FastAPI Backend]
    
    Agent1 -->|Order Context| Agent2[Scheduling Agent]
    Agent2 -->|Tools| Calendar[Calendar MCP]
    
    subgraph "The Innovation Layer"
        OpenAPI[OpenAPI Spec] -->|Parsed by| Generator[generate_mcp.py]
        Generator -->|Writes Code| MCPServer
    end
Loading

About

This project automates the transition from legacy OpenAPI specs to the Model Context Protocol (MCP). Instead of manually writing tools, I built a system that generates them dynamically.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages