How to Build an MCP Client GUI with Streamlit and FastAPI

Alejandro AO May 14, 2025
Video Thumbnail

About

No channel description available.

Video Description

In this video, you'll learn how to build a graphical user interface (GUI) for an MCP client using Streamlit in Python, and connect it to a FastAPI backend. The tutorial covers the full process—from setting up the front-end project structure and session state management in Streamlit, to making asynchronous API calls, handling chat input, logging, and rendering complex message types (user, assistant, tool call, and tool result). This video is perfect for developers looking to build interactive AI-driven chat interfaces that connect to tool-enabled backends like MCP servers, using modern Python frameworks. ## Topics - How to create an MCP client GUI with Streamlit - Connecting a Streamlit front-end to a FastAPI backend - Project structure for Streamlit + FastAPI applications - Installing and using Streamlit and httpx - Managing session state and chat message history in Streamlit - Asynchronous API calls with httpx in Python - Creating and rendering custom chatbot classes - Handling different message types: user, assistant, tool call, and tool result - Displaying JSON data and chat messages in Streamlit - Using Streamlit's input and sidebar components - Setting up and running the Streamlit application - Error handling and logging in Streamlit apps - Troubleshooting API timeouts and frontend/backend connectivity - Tips for modularizing Streamlit code and separating logic - Recommendations for further learning (Streamlit crash course, AI Engineering Bootcamp) - Best practices for building AI chat interfaces in Python ## Links - 🔗 Code from the video: https://github.com/alejandro-ao/mcp-client-python-example - 🔗 Create a FastAPI MCP Client: https://youtu.be/mhdGVbJBswA - 🚀 Complete AI Engineer Bootcamp: https://aibootcamp.dev/ - ❤️ Buy me a coffee... or a beer (thanks): https://link.alejandro-ao.com/l83gNq - 💬 Join the Discord Help Server: https://link.alejandro-ao.com/HrFKZn - ✉️ Get the news from the channel and AI Engineering: https://link.alejandro-ao.com/AIIguB ## Timestamps 0:00:00 - 01 Intro 0:02:25 - Setup 0:06:31 - Chatbot GUI 0:13:10 - Handle Query 0:20:52 - Message Types

Ultimate GUI Builder Kit

AI-recommended products based on this video

Loading...
Freenove Ultimate Starter Kit for BBC micro bit (V2 Included), 316-Page Detailed Tutorial, 225 Items, 44 Projects, Blocks and Python Code

Freenove Ultimate Starter Kit for BBC micro bit (V2 Included), 316-Page Detailed Tutorial, 225 Items, 44 Projects, Blocks and Python Code

(382)
$94.95
PrimeFREE delivery Sat, Jun 14
Loading...
KOORUI 27 Inch 4K Monitor, UHD(3840 x 2160) IPS Computer Monitors, HDR10, 90% DCI-P3, Frameless, 2X HDMI 2.0 & DisplayPort 1.4, VESA Mountable, Eye Care, N07

KOORUI 27 Inch 4K Monitor, UHD(3840 x 2160) IPS Computer Monitors, HDR10, 90% DCI-P3, Frameless, 2X HDMI 2.0 & DisplayPort 1.4, VESA Mountable, Eye Care, N07

(6,421)
$219.99
FREE delivery Sun, Aug 10
100+ bought in past month
Loading...
KOORUI Monitor 27 Inch, FHD/1080p Computer Monitor for Office and Home, 100Hz, HDMI, VGA, 99% SRGB, Frameless, Eye Care, Tilt Adjustment, Black, E2711F

KOORUI Monitor 27 Inch, FHD/1080p Computer Monitor for Office and Home, 100Hz, HDMI, VGA, 99% SRGB, Frameless, Eye Care, Tilt Adjustment, Black, E2711F

(7,132)
$149.99
FREE delivery Sun, Aug 10
200+ bought in past month
Loading...
Asus ROG Azoth Wireless Mechanical Gaming Keyboard – 75% TKL, Tri-Mode Connectivity, Hot Swappable Pre-lubed ROG NX Snow Linear Switches, PBT Keycaps, RGB, OLED Display, PC/Mac Support - Black

Asus ROG Azoth Wireless Mechanical Gaming Keyboard – 75% TKL, Tri-Mode Connectivity, Hot Swappable Pre-lubed ROG NX Snow Linear Switches, PBT Keycaps, RGB, OLED Display, PC/Mac Support - Black

(1,146)
$229.99
FREE delivery Sat, Jan 3
50+ bought in past month
Loading...
TMKB 60% Mechanical Gaming Keyboard, Brown Tactile Switch, LED Backlight, Anti-Ghosting, Detachable USB-C, Double-Shot Keycaps, 61 Keys, Wired, White

TMKB 60% Mechanical Gaming Keyboard, Brown Tactile Switch, LED Backlight, Anti-Ghosting, Detachable USB-C, Double-Shot Keycaps, 61 Keys, Wired, White

(35)
$39.99
PrimeFREE delivery Sat, Jun 14
Loading...
MSI Gaming Backlit RGB, Dedicated Hotkeys, Anti-Ghosting, Water Resistant Mechanical Feel Gaming Keyboard, Crisp Typing +12 Million Click Life Span, Steady Gaming Base Support (Vigor GK30 US)

MSI Gaming Backlit RGB, Dedicated Hotkeys, Anti-Ghosting, Water Resistant Mechanical Feel Gaming Keyboard, Crisp Typing +12 Million Click Life Span, Steady Gaming Base Support (Vigor GK30 US)

(919)
$35.99$28.79
FREE delivery Sat, Jan 3
100+ bought in past month
Loading...
Cmokifuly GMK67 65% Mechanical Keyboard Kit Tri-Mode South-Facing RGB LED for 3/5pin Switches,66 Keys+1 Knob Hotswap Socket PCB Gasket Mounted Plate Gaming DIY Keyboard Kit (White)

Cmokifuly GMK67 65% Mechanical Keyboard Kit Tri-Mode South-Facing RGB LED for 3/5pin Switches,66 Keys+1 Knob Hotswap Socket PCB Gasket Mounted Plate Gaming DIY Keyboard Kit (White)

(72)
$160.90
FREE delivery Aug 12 - 14Only 9 left in stock.
Loading...
LODVIE Wireless Mouse for Laptop,2400 DPI Wireless Computer Mouse with 6 Buttons,2.4G Ergonomic USB Cordless Mouse,15 Months Battery Life Mouse for Laptop PC Mac Computer Chromebook MacBook-Black

LODVIE Wireless Mouse for Laptop,2400 DPI Wireless Computer Mouse with 6 Buttons,2.4G Ergonomic USB Cordless Mouse,15 Months Battery Life Mouse for Laptop PC Mac Computer Chromebook MacBook-Black

(7,870)
$14.99
Prime
2K+ bought in past month
Loading...
TRAUSI 1080P HD Webcam with Microphone, Noise Cancellation, Privacy Cover, Wide-Angle Lens, Auto Light Correction, Plug & Play USB Webcam for Laptop, Desktop, PC, Mac, Zoom, Skype, Streaming Black

TRAUSI 1080P HD Webcam with Microphone, Noise Cancellation, Privacy Cover, Wide-Angle Lens, Auto Light Correction, Plug & Play USB Webcam for Laptop, Desktop, PC, Mac, Zoom, Skype, Streaming Black

(205)
$28.99
FREE delivery Wed, Jul 2 on your first order
1K+ bought in past month
Loading...
Shcngqio 1080P Full HD Webcam with Privacy Cover, Wide Angle Lens, Active Light Correction, Plug and Play USB Webcam for PC, Desktop,Laptop (Black)

Shcngqio 1080P Full HD Webcam with Privacy Cover, Wide Angle Lens, Active Light Correction, Plug and Play USB Webcam for PC, Desktop,Laptop (Black)

(205)
$28.99
Prime
500+ bought in past month
Loading...
TRAUSI HD Webcam with Microphone, Noise Cancellation, Privacy Cover, Wide-Angle Lens, Auto Light Correction, Plug & Play USB Webcam for Laptop, Desktop, PC, Mac, Zoom, Skype, Streaming (1080P, Black)

TRAUSI HD Webcam with Microphone, Noise Cancellation, Privacy Cover, Wide-Angle Lens, Auto Light Correction, Plug & Play USB Webcam for Laptop, Desktop, PC, Mac, Zoom, Skype, Streaming (1080P, Black)

(284)
$27.99
Prime
1K+ bought in past month