
philschmid/mcp-openai-gemini-llama-example
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
philschmid/mcp-openai-gemini-llama-exampleは、[[T0]からインポートされたMCPサーバー候補です。
概要
philschmid/mcp-openai-gemini-llama-exampleは、[[T0]からインポートされたMCPサーバー候補です。
概要(AI 翻訳)
このリポジトリには、Open LLM(Meta Llama 3)、OpenAIまたはGoogle Gemini、SQLiteデータベースを使ってModel Context Protocol(MCP)を使ってAIエージェントを構築する基本的な例が含まれています。これは本番環境向けのフレームワークではなく、シンプルで教育的なデモンストレーションとして設計されています。
OpenAIの例:https://github.com/jalr4ever/Tiny-OAI-MCP-Agent
セットアップ
このコードは、MCPサーバーを介してSQLiteデータベースとやり取りできるシンプルなCLIエージェントを設定します。公式のSQLite MCPサーバーを使用し、以下のことを示します:
- MCPサーバーへの接続
- MCPサーバーからのツールやリソースの読み込みと利用
- ツールをLLM互換関数呼び出しに変換する
openaiSDK またはgoogle-genaiSDK を用いてLLMとやり取りすること。
使い方
- Docker インストールされ、実行中。
- Hugging Faceアカウントとアクセストークン(Llama 3モデル使用用)。
- Google APIキー(Geminiモデル使用用)。
就任
-
リポジトリのクローン:
-
必要なパッケージをインストールする:
-
ハグングフェイスにログイン
例
ラマ3
次のコマンドを実行します
エージェントはインタラクティブモードで起動します。データベースとやり取りするためのプロンプトを入力できます。
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
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
openaiSDK orgoogle-genaiSDK.
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
-
Clone the repository:
git clone https://github.com/philschmid/mcp-openai-gemini-llama-example cd mcp-openai-gemini-llama-example -
Install the required packages:
pip install -r requirements.txt -
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!
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →