Spaces:
Sleeping
Sleeping
File size: 2,491 Bytes
0342c18 ad6dc26 0342c18 577bd7d 0342c18 ad6dc26 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | ---
title: Meridian Support Chat
emoji: 💬
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: 6.13.0
app_file: meridian.py
pinned: false
---
# Meridian Support Chatbot
Customer support chatbot prototype for **Meridian Electronics**, built on the company's existing MCP server.
## Problem
Meridian's support team handles every customer inquiry by phone and email — including the repetitive ones: stock checks, order status, placing orders, and identifying returning customers. That doesn't scale. Leadership needs evidence that a low-cost LLM can absorb these workflows reliably and cheaply enough to fund a rollout next quarter.
## Solution
A Python chatbot using OpenAI's Agents SDK with `gpt-4o-mini`, connected over Streamable HTTP to the Meridian MCP, surfaced in a Gradio UI with live per-conversation cost tracking — the unit-economics signal the VP needs to make the funding decision.
## Architecture
```
Gradio UI
↓
OpenAI Agents SDK (gpt-4o-mini · streaming · SQLiteSession)
↓
MCPServerStreamableHttp (cached tool list · retries · 15s timeout)
↓
Meridian MCP (Cloud Run · 8 tools across products / customers / orders)
```
**Auth model:** `verify_customer_pin` must succeed before any customer-scoped read or write. Public reads (catalog browsing) need no auth. The agent never trusts a user-asserted `customer_id`.
## Setup
Requires Python ≥3.12 and [`uv`](https://docs.astral.sh/uv/).
```bash
uv sync
cp .env.example .env # add your OPENAI_API_KEY
uv run python -m app.ui # launches Gradio chat
```
Phase-0 connectivity proof (one OpenAI call, prints discovered tools):
```bash
make smoke
```
## Inspect the upstream MCP
```bash
./scripts/inspect_mcp_cli.sh # pure CLI: tools/list, prompts/list, resources/list
./scripts/inspect_mcp_browser.sh # launches the MCP Inspector web UI
```
## Testing
```bash
make test # tier 1 — MCP connectivity, no LLM cost
make test-auth # tier 3 — auth-gate negative test (live)
make test-workflows # tier 2 — all 4 workflow tests (live)
make help # full target list
```
Live tests hit real OpenAI + the real MCP and auto-skip without `OPENAI_API_KEY`. `make test-purchase` mutates dev-MCP state (creates a real order each run).
## Project layout
```
app/ agent runtime, MCP client, cost tracking, Gradio UI
tests/ tiered test suite (connectivity → auth gate → workflows)
scripts/ MCP inspection helpers
```
|