olasogba/meridian-support
0
Meridian Electronics — Customer Support Chatbot
A production-style customer support assistant for Meridian Electronics, built on top of an existing internal MCP server. The bot can:
- Browse and search the product catalog
- Authenticate returning customers via email + 4-digit PIN
- Show a logged-in customer their order history
- Place a new order with an explicit two-step confirmation
Architecture
┌─────────┐ HTTPS ┌────────────────┐ Streamable HTTP ┌─────────────┐
│ Browser │ ───────────▶ │ Gradio + Agent │ ────────────────────▶ │ Order MCP │
│ (chat) │ │ (this app) │ │ server │
└─────────┘ └────────────────┘ └─────────────┘
│
│ uses
▼
OpenAI Responses API
(gpt-4o-mini)- Agent — OpenAI Agents SDK, model
gpt-4o-mini(cheap mini-tier). - Tools — every MCP tool is wrapped in a Python
@function_tool. The wrappers carry session state (Sessiondataclass) and inject the authenticated customer ID for privileged calls. The LLM never sees acustomer_idparameter for orders or history; it cannot impersonate. - Order placement is a two-phase flow:
prepare_orderre-fetches live prices and stages a pending order on the session;place_ordertakes no arguments and submits whatever was staged. The agent must obtain explicit customer confirmation between the two calls. - MCP transport — Streamable HTTP. A fresh client session is opened per tool call (stateless, easy to reason about, latency is fine for chat).
- UI — Gradio chat. Session state lives in
gr.State, isolated per browser session.
Files
Run locally
uv sync
cp .env.example .env # then edit and set OPENAI_API_KEY
uv run python app.pyOpen http://127.0.0.1:7860.
Environment
OPENAI_API_KEY— required.MODEL— defaults togpt-4o-mini.MCP_SERVER_URL— defaults to the Meridian MCP server.
On Hugging Face Spaces, set OPENAI_API_KEY as a Space Secret (Settings → Variables and secrets → New secret).
Security notes
- Authentication is by email + 4-digit PIN against the MCP server.
- The bot only ever calls privileged tools with the customer ID it captured from a successful PIN verification. UUIDs typed into the chat are ignored.
- Order details are gated:
my_order_detailschecks the order belongs to the authenticated customer before fetching it. - PINs and full API keys are never logged.
Limitations / future work
- No persistent conversation history across sessions.
- Price extraction from MCP
get_producttext uses a regex; a structured response from the MCP server would be safer. - No rate limiting on the chat endpoint.
- Single-region MCP server; a regional outage would take the bot down.
gpt-4o-miniwill occasionally over-confirm or hallucinate a SKU; tightening the system prompt or moving togpt-4.1-miniwould help.
