JM

justjoehere/mcp_gradio_client

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

68 stars 16 forks 质量 67 趋势 0MIT

justjoehere/mcp_gradio_client 是一个从 https://github.com/justjoehere/mcp_gradio_client. 导入的 MCP 服务器候选

概览

justjoehere/mcp_gradio_client 是一个从 https://github.com/justjoehere/mcp_gradio_client. 导入的 MCP 服务器候选

概述(AI 翻译)

该仓库是使用 Gradio 实现模型上下文协议(MCP)客户端的概念验证。它演示了如何在 Gradio 接口内使用 STDIO 和 SSE 通信方式与 MCP 服务器交互。

模型上下文协议(MCP)旨在标准化语言模型与工具之间的交互,提供统一的通信界面。本概念验证展示了MCP在构建带有工具集成的AI助手中的实际应用。

目录

  • 引言
  • 特色
  • 安装
  • 配置
  • STDIO 服务器定义
  • SSE 服务器定义
  • 使用情况
  • 注释
  • 许可证
  • 贡献

引言

该项目在 Gradio 应用中实现了 MCP 客户端,允许用户与通过 MCP 暴露的工具进行交互。通过利用 MCP 的标准化通信协议,客户端可以无缝集成各种工具,增强语言模型的能力。

模型上下文协议的关键要素:

  • 标准化:MCP为语言模型与工具的交互提供了标准化方式,促进互操作性。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP Gradio Client Proof of Concept

This repository is a proof of concept for implementing a Model Context Protocol (MCP) client using Gradio. It demonstrates how to interact with MCP servers using both STDIO and SSE communication methods within a Gradio interface.

The Model Context Protocol (MCP) aims to standardize the interaction between language models and tools, providing a uniform interface for communication. This proof of concept showcases the practical application of MCP in building AI assistants with tool integration.

Table of Contents

Introduction

This project implements an MCP client within a Gradio application, allowing users to interact with tools exposed via the MCP. By leveraging the MCP’s standardized communication protocol, the client can seamlessly integrate with various tools, enhancing the capabilities of language models.

Key elements from the Model Context Protocol:

  • Standardization: MCP provides a standardized way for language models to interact with tools, promoting interoperability.
  • Communication Methods: Supports multiple communication methods, including STDIO and SSE, for flexibility in tool integration.
  • Tool Integration: Enables language models to use external tools, enhancing their functionality and applicability.

Features

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

Installation

Prerequisites

  • Python 3.12 or higher
  • Node.js
  • uvicorn (for UVX for STDIO servers)
  • NPX (for NPX for STDIO servers)
  • Python (for Python module STDIO servers)
  • OpenAI API Key (for language model interaction)

Steps

  1. Clone the Repository

    git clone https://github.com/yourusername/mcp-gradio-client.git
    cd mcp-gradio-client
    
  2. Create a Virtual Environment Unix/macOS:

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
    

    Windows:

     python -m venv .venv
     .venv\Scripts\activate
    
  3. Install Dependencies

    pip install -r requirements.txt
    
  4. Set Up Environment Variables

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "stdio_server_name": { "type": "stdio", "command": "uvx", "args": [], "env": {} }, "sse_server_name": { "type": "sse", "url": "http://127.0.0.1:3001/sse", "headers": {} } } }