模型上下文协议集成工具

一个集成Google Gemini的模型上下文协议(MCP)演示工具,提供服务器、客户端和图形用户界面支持。

  • by drkhan107
  • Jupyter Notebook
  • 本地部署
  • 更新于
在 GitHub 查看 drkhan107/mcp_gemini

使用说明

模型上下文协议(MCP)

MCP与谷歌Gemini集成的工作演示。


🚀 入门指南

1.克隆存储库

git clone https://github.com/drkhan107/mcp_gemini.git
cd your-repo-name

2.设置环境变量

在根目录中创建一个.env文件,并添加您的Google API密钥:

GOOGLE_API_KEY=“您的_API_KEY_here”

3.📦 再进行

从requirements.txt安装所有必需的软件包:

pip install -r requirements.txt

4.🖥️ 运行MCP服务器

启动MCP服务器:

python sse_server.py

✅ 这将在配置的端口启动MCP服务器(默认为http://localhost:8080/sse).

5.🧠 启动MCP客户端(可选)

服务器运行后,使用服务器URL启动SSE客户端:


python ssc_client.py http://localhost:8080/sse

6.🧠 启动FastAPI服务器(使用GUI)

运行以下命令(要更改端口等,请编辑fastapp.py文件)


python fastapp.py

7.启动Streamlit应用程序

  • 确保MCP服务器正在运行(http://localhost:8080/sse)
  • 确保FastAPI正在运行。

运行以下命令


streamlit run app.py 

这将在端口8501上启动streamlit应用程序

8.浏览器

打开浏览器(localhost:8501)后,单击连接到MCP服务器。

✅ 完成! 现在,您有了一个使用Gemini的模型上下文协议的工作演示。