AA

alejandro-ao/mcp-client-python

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

68 stars 37 forks 품질 55 트렌드 14MIT

alejandro-ao/mcp-client-python은 MCP 서버 후보자가 https://github.com/alejandro-ao/mcp-client-python.에서 수입되었습니다

개요

alejandro-ao/mcp-client-python은 MCP 서버 후보자가 https://github.com/alejandro-ao/mcp-client-python.에서 수입되었습니다

개요(AI 번역)

이 저장소는 FastAPI를 사용하여 파이썬에서 MCP (Modular Computational Platform) 클라이언트를 만드는 방법에 대한 완전한 튜토리얼을 포함합니다. 튜토리얼은 Claude 데스크톱 응용 프로그램에 의해 영감을 받았으며 MCP 서버에서 MCP 도구를 호출하고 결과를 표시하는 방법을 보여줍니다.

특징

  • Python 및 FastAPI를 사용하여 MCP 클라이언트 구축.
  • MCP 도구와 상호 작용하는 LLM을 통합합니다.
  • MCP 서버에서 Fetch 및 표시 결과.
  • 클라이언트를 설정하고 실행하기위한 단계별지도.

필수품

  • Python 3.8 이상
  • FastAPI 및 REST API의 기본 지식
  • MCP 서버 설정

시작하기

  1. ** 저장소를 복제 **:

  2. **모든 종점 **:

  3. ** 환경 변수 설정 **: root 디렉토리에 .env 파일을 만들고 API 키를 추가합니다. 이 예에서, 나는 MCP 서버 파일에 사용되기 때문에 SERPER_API_KEY를 추가, 우리는 이전 튜토리얼에 내장. 그리고 우리는 모든 것을 로컬로 실행하고 있기 때문에, 우리는 같은 파일에서 모든 환경 변수 (서버 클라이언트 모두)를 설정할 수 있습니다.

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.

README

MCP Client in Python with FastAPI

This repository contains a complete tutorial on how to create an MCP (Modular Computational Platform) client in Python using FastAPI. The tutorial is inspired by the Claude Desktop application and demonstrates how to make an LLM (Large Language Model) call MCP tools from an MCP server and display the results.

Features

  • Build an MCP client using Python and FastAPI.
  • Integrate LLMs to interact with MCP tools.
  • Fetch and display results from an MCP server.
  • Step-by-step guidance for setting up and running the client.

Prerequisites

  • Python 3.8 or higher
  • Basic knowledge of FastAPI and REST APIs
  • An MCP server setup

Getting Started

  1. Clone the Repository:
git clone [email protected]:alejandro-ao/mcp-client-python.git
cd mcp-client-python
  1. Install Dependencies:
pip install -r requirements.txt
  1. Set Up Environment Variables: Create a .env file in the root directory and add your API keys. In this example, I added the SERPER_API_KEY because it is used in the MCP server file, which we built in the previous tutorial. And since we are running everything locally, we can set all the environment variables (for both serverand client) in the same file. In a more complex setup, you would deploy your MCP server separately and set the environment variables accordingly.
ANTHROPIC_API_KEY=
SERPER_API_KEY=
  1. Run the Application:
uvicorn main:app --reload
  1. Access the API: Open your browser and navigate to http://127.0.0.1:8000/docs to explore the API documentation.

Tutorial Overview

  1. Setting Up FastAPI: Learn how to create a FastAPI application and define endpoints.

  2. Connecting to the MCP Server: Understand how to make requests to the MCP server and handle responses.

  3. Integrating LLMs: Explore how to use an LLM to call MCP tools dynamically.

  4. Displaying Results: Implement logic to process and display results from the MCP tools.

Resources

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

Special thanks to the creators of FastAPI and the Claude Desktop application for their inspiration.

GitHub에서 전체 README 보기

설치

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

Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →