PM

philschmid/mcp-openai-gemini-llama-example

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

183 stars 34 forks Качество 49 Тренд 17Apache-2.0

philschmid/mcp-openai-gemini-llama-example — это кандидат MCP-сервера, импортированный из https://github.com/philschmid/mcp-openai-gemini-llama-example.

Обзор

philschmid/mcp-openai-gemini-llama-example — это кандидат MCP-сервера, импортированный из https://github.com/philschmid/mcp-openai-gemini-llama-example.

Обзор (машинный перевод)

Этот репозиторий содержит базовый пример создания AI-агента с использованием протокола Model Context Protocol (MCP) с открытым LLM (Meta Llama 3), OpenAI или Google Gemini и базой данных SQLite. Он разработан как простая образовательная демонстрация, а не как готовый к продакшну фреймворк.

Пример OpenAI: https://github.com/jalr4ever/Tiny-OAI-MCP-Agent

Подготовка

Этот код настраивает простой CLI-агент, который может взаимодействовать с базой данных SQLite через MCP-сервер. Он использует официальный SQLite MCP-сервер и демонстрирует:

  • Подключение к MCP-серверу
  • Загрузка и использование инструментов и ресурсов с сервера MCP
  • Преобразование инструментов в LLM-совместимые вызовы функций
  • Взаимодействие с LLM с помощью SDK openai или google-genai SDK.

Как им пользоваться

  • Docker установлен и запущен.
  • Аккаунт Hugging Face и токен доступа (для использования модели Llama 3).
  • Ключ Google API (для использования модели Gemini).

Установка

  1. Клонировать репозиторий:

  2. Установите необходимые пакеты:

  3. Войти в Hugging Face

Примеры

Лама 3

Выполните следующую команду

Агент начнёт работу в интерактивном режиме. Вы можете вводить подсказки для взаимодействия с базой данных.

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

README

How to use Anthropic MCP Server with open LLMs, OpenAI or Google Gemini

This repository contains a basic example of how to build an AI agent using the Model Context Protocol (MCP) with an open LLM (Meta Llama 3), OpenAI or Google Gemini, and a SQLite database. It’s designed to be a simple, educational demonstration, not a production-ready framework.

OpenAI example: https://github.com/jalr4ever/Tiny-OAI-MCP-Agent

Setup

This code sets up a simple CLI agent that can interact with a SQLite database through an MCP server. It uses the official SQLite MCP server and demonstrates:

  • Connecting to an MCP server
  • Loading and using tools and resources from the MCP server
  • Converting tools into LLM-compatible function calls
  • Interacting with an LLM using the openai SDK or google-genai SDK.

How to use it

  • Docker installed and running.
  • Hugging Face account and an access token (for using the Llama 3 model).
  • Google API key (for using the Gemini model).

Installation

  1. Clone the repository:

    git clone https://github.com/philschmid/mcp-openai-gemini-llama-example
    cd mcp-openai-gemini-llama-example
    
  2. Install the required packages:

    pip install -r requirements.txt
    
  3. Log in to Hugging Face

    huggingface-cli login --token YOUR_TOKEN
    

Examples

Llama 3

Run the following command

python sqlite_llama_mcp_agent.py

The agent will start in interactive mode. You can type in prompts to interact with the database. Type “quit”, “exit” or “q” to stop the agent.

Example conversation:

Enter your prompt (or 'quit' to exit): what tables are available?

Response:  The available tables are: albums, artists, customers, employees, genres, invoice_items, invoices, media_types, playlists, playlist_track, tracks

Enter your prompt (or 'quit' to exit): how many artists are there

Response:  There are 275 artists in the database.

Gemini

Run the following command

GOOGLE_API_KEY=YOUR_API_KEY python sqlite_gemini_mcp_agent.py

Future plans

I’m working on a toolkit to make implementing AI agents using MCP easier. Stay tuned for updates!

Открыть полный README на GitHub

Установка

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

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →