# mcp_gradio_client

> MCP Client

This repository showcases a Model Context Protocol (MCP) client built with Gradio, demonstrating interaction with MCP servers via STDIO and SSE for seamless tool integration within a user-friendly interface.

## Overview

- **Category:** AI
- **Language:** Python
- **Stars:** 68
- **Forks:** 5
- **Owner:** justjoehere
- **GitHub:** https://github.com/justjoehere/mcp_gradio_client
- **Created:** 2024-12-05T18:36:43+00:00
- **Updated:** 2025-03-28T05:14:07+00:00
- **Source:** https://model-context-protocol.com/clients/gradio-mcp-client-model-context-protocol

## Setup

## Setup

### Prerequisites

- Python 3.12 or higher
- [Node.js](https://nodejs.org/en/)
- [uvicorn](https://www.uvicorn.org/) (for UVX for STDIO servers)
- [NPX](https://www.npmjs.com/package/npx) (for NPX for STDIO servers)
- [Python](https://www.python.org/downloads/) (for Python module STDIO servers)
- OpenAI API Key (for language model interaction)

### Steps

1. **Clone the Repository**

   ```bash
   git clone https://github.com/yourusername/mcp-gradio-client.git
   cd mcp-gradio-client
   ```

2. **Create a Virtual Environment**
    Unix/macOS:
   ```bash
   python -m venv venv
   source venv/bin/activate  # On Windows use `venv\Scripts\activate`
   ```
   Windows:
   ```bash
    python -m venv .venv
    .venv\Scripts\activate
    ```

3. **Install Dependencies**

   ```bash
   pip install -r requirements.txt
   ```

4. **Set Up Environment Variables**

   Create a `.env` file in the root directory using `.env.example` as a reference and add your OpenAI API key:

   ```env
   OPENAI_API_KEY=your_openai_api_key
   ```
5. **Running the App**

   Start the Gradio application:

   ```bash
   python gradio_ui.py
   ```

## Tools

## Available Tools

		1. Gradio Interface (User-friendly interface for interacting with the MCP client and tools).
		2. STDIO and SSE Support (Demonstrates how to connect to MCP servers using both STDIO and SSE methods).
		3. Dynamic Tool Loading (Automatically discovers and integrates tools exposed by MCP servers).
		4. Debugging Support (Optional debug mode to aid in development and troubleshooting).

