MCP cover image
See in Github
2025-02-17

3

Github Watches

32

Github Forks

160

Github Stars

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!

相关推荐

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Contraband Interactive
  • Emulating Dr. Jordan B. Peterson's style in providing life advice and insights.

  • rustassistant.com
  • Your go-to expert in the Rust ecosystem, specializing in precise code interpretation, up-to-date crate version checking, and in-depth source code analysis. I offer accurate, context-aware insights for all your Rust programming questions.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • n8n-io
  • 具有本机AI功能的公平代码工作流程自动化平台。将视觉构建与自定义代码,自宿主或云相结合,400+集成。

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • metorial
  • 数百个MCP服务器的容器化版本📡📡

  • langgenius
  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • alibaba
  • Reviews

    1 (1)
    Avatar
    user_TBp9cNxE
    2025-04-17

    I'm thoroughly impressed with the mcp-openai-gemini-llama-example by philschmid. This project is a fantastic resource for anyone looking to integrate OpenAI into their applications. The documentation is clear, and the example provided is practical and easy to follow. Highly recommended for both beginners and advanced users! Check it out on GitHub!