Turbo MCP客户端 🚀
一个基于FastAPI的应用程序,提供一个web界面,用于与模型上下文协议(MCP)服务器交互,同时利用OpenAI的API处理消息。
概述
此应用程序允许用户:
- 同时连接到多个MCP服务器
- 通过OpenAI的API处理消息
- 通过基于网络的聊天界面与系统交互
- 配置和存储API许可证密钥
技术栈
客户: html、css、js、bootstrap、animatedjs
服务器: FastAPI、Openai、MCP
特性
- 一次连接多台服务器
- 随时随地使用websocket
截图
安装
- 克隆存储库:
git clone https://github.com/techspawn/Turbo-MCP-Client.git
cd openai-mcp- 安装依赖项:
uv pip install -r requirements.txt- 设置环境变量:
export MODEL_NAME="gpt-4o" # or your preferred OpenAI model环境变量
要运行此项目,您需要将以下环境变量添加到.env文件中
MODEL_NAME=gpt-4o
配置
- 创建一个
config.json根目录中的文件:
{
"mcpServers": {
"server1": {
"command": "your_command",
"args": ["arg1", "arg2"]
},
"server2": {
"command": "another_command",
"args": ["arg1", "arg2"]
}
}
}- 初始化SQLite数据库:
import sqlite3
conn = sqlite3.connect("mcp_config.db")
cursor = conn.cursor()
cursor.execute("CREATE TABLE IF NOT EXISTS config (license_key TEXT)")
conn.commit()
conn.close()- 通过web界面配置您的OpenAI API密钥。
用法
- 启动应用程序:
uvicorn main:app --reload- 打开浏览器并导航到
http://localhost:8000
- 在web界面中输入OpenAI API密钥以将其保存到数据库
- 使用聊天界面发送消息,这些消息将通过MCP服务器和OpenAI进行处理
用法
- 启动应用程序:
uvicorn main:app --reload- 打开浏览器并导航到
http://localhost:8000
- 在web界面中输入OpenAI API密钥以将其保存到数据库
- 使用聊天界面发送消息,这些消息将通过MCP服务器和OpenAI进行处理
项目结构
├── images/ # Directory for storing image assets
│ ├── chat_window.png # Screenshot of the chat window
│ └── setting_page.png # Screenshot of the settings page
├── models/ # Contains Python modules related to data models
│ ├── __init__.py # Makes the 'models' directory a Python package
│ ├── client.py # Defines client-related logic (e.g., API client, user handling)
│ ├── config.py # Handles application configuration settings
│ └── py.typed # Indicates that this package supports type hints
├── static/ # Placeholder for static assets (CSS, JavaScript, images)
├── templates/ # Directory for HTML templates
│ ├── base.html # Base template for consistent layout across pages
│ ├── chat.html # Template for the chat interface
│ └── settings.html # Template for the settings page
├── .env # Environment variables (e.g., API keys, credentials)
├── .gitignore # Specifies files to be ignored by Git
├── .python-version # Defines the Python version for this project
├── config.json # JSON configuration file for application settings
├── database.py # Handles database connection and operations
├── folder_structure.txt # Text file describing the project structure
├── LICENSE # License file specifying usage terms
├── main.py # Entry point of the application
├── mcp_config.db # SQLite database file or config storage
├── pyproject.toml # Python project metadata and dependency management
├── README.md # Project documentation and setup instructions
├── requirements.txt # List of required dependencies
└── uv.lock # Lock file for package versions (possibly from `uv` or another package manager)
API终点
GET /:主聊天界面POST /get_settings:保存OpenAI API许可证密钥WebSocket /chat:实时聊天通信
贡献
捐款总是受欢迎的!
看 contributing.md 了解如何开始。
支持
如需支持,请发送电子邮件至 support@techspawn.com
