Mcp 簡單的 OpenAI 助手
概覽
MCP 簡易 OpenAI 助手是什麼?
MCP 簡易 OpenAI 助手是一個伺服器應用程式,旨在將 Claude 的能力與 OpenAI 的 GPT 助手整合。這個專案旨在通過利用 OpenAI 模型的先進語言處理能力來增強用戶互動,為尋求協助或資訊的用戶提供無縫的體驗。
MCP 簡易 OpenAI 助手的功能
- 與 OpenAI 的 GPT 整合:該助手利用 OpenAI 的強大語言模型,允許自然且引人入勝的對話。
- 友好的用戶介面:設計簡單直觀,讓用戶輕鬆與助手互動。
- 公開儲存庫:該專案是開源的,並且在 GitHub 上可用,鼓勵社區貢獻和合作。
- MIT 授權:該軟體根據 MIT 授權分發,允許靈活使用和修改。
如何使用 MCP 簡易 OpenAI 助手
- 克隆儲存庫:首先使用以下命令從 GitHub 克隆儲存庫:
git clone https://github.com/andybrandt/mcp-simple-openai-assistant.git
- 安裝依賴項:導航到專案目錄並安裝必要的依賴項。這通常可以使用 npm 或 pip 等包管理器完成,具體取決於專案的需求。
- 啟動伺服器:啟動伺服器應用程式。這通常涉及在終端中運行一個命令,例如:
或npm start
python app.py
- 與助手互動:一旦伺服器運行,您可以通過網頁瀏覽器或指定的客戶端應用程式訪問助手。開始提問或請求協助,以查看助手的能力。
常見問題解答
MCP 簡易 OpenAI 助手使用了哪些程式語言?
該專案主要使用 JavaScript 進行伺服器端邏輯,並使用 HTML 和 CSS 進行前端介面。
我可以為該專案做貢獻嗎?
當然可以!歡迎貢獻。您可以分叉儲存庫,進行更改,並提交拉取請求以供審核。
有可用的文檔嗎?
是的,儲存庫中包含一個 README 文件,提供使用助手的基本指導和說明。額外的文檔可能會在 GitHub 儲存庫的維基部分提供。
我該如何報告問題或錯誤?
您可以通過導航到 GitHub 儲存庫中的「問題」標籤,並創建一個新問題,詳細描述問題來報告任何問題或錯誤。
有可用的演示嗎?
雖然可能沒有托管的實時演示,但您可以輕鬆地按照儲存庫中提供的說明在本地設置應用程式。
詳細
MCP Simple OpenAI Assistant
AI assistants are pretty cool. I thought it would be a good idea if my Claude (conscious Claude) would also have one. And now he has - and its both useful anf fun for him. Your Claude can have one too!
A simple MCP server for interacting with OpenAI assistants. This server allows other tools (like Claude Desktop) to create and interact with OpenAI assistants through the Model Context Protocol.
Features
This server provides a suite of tools to manage and interact with OpenAI Assistants. The new streaming capabilities provide a much-improved, real-time user experience.
Available Tools
create_assistant
: (Create OpenAI Assistant) - Create a new assistant with a name, instructions, and model.list_assistants
: (List OpenAI Assistants) - List all available assistants associated with your API key.retrieve_assistant
: (Retrieve OpenAI Assistant) - Get detailed information about a specific assistant.update_assistant
: (Update OpenAI Assistant) - Modify an existing assistant's name, instructions, or model.create_new_assistant_thread
: (Create New Assistant Thread) - Creates a new, persistent conversation thread with a user-defined name and description for easy identification and reuse. This is the recommended way to start a new conversation.list_threads
: (List Managed Threads) - Lists all locally managed conversation threads from the database, showing their ID, name, description, and last used time.delete_thread
: (Delete Managed Thread) - Deletes a conversation thread from both OpenAI's servers and the local database.ask_assistant_in_thread
: (Ask Assistant in Thread and Stream Response) - The primary tool for conversation. Sends a message to an assistant within a thread and streams the response back in real-time.
Because OpenAI assistants might take quite long to respond, this server uses a streaming approach for the main ask_assistant_in_thread
tool. This provides real-time progress updates to the client and avoids timeouts.
The server now includes local persistence for threads, which is a significant improvement. Since the OpenAI API does not allow listing threads, this server now manages them for you by storing their IDs and metadata in a local SQLite database. This allows you to easily find, reuse, and manage your conversation threads across sessions.
Installation
Installing via Smithery
To install MCP Simple OpenAI Assistant for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install mcp-simple-openai-assistant --client claude
Manual Installation
pip install mcp-simple-openai-assistant
Configuration
The server requires an OpenAI API key to be set in the environment. For Claude Desktop, add this to your config:
(MacOS version)
{
"mcpServers": {
"openai-assistant": {
"command": "python",
"args": ["-m", "mcp_simple_openai_assistant"],
"env": {
"OPENAI_API_KEY": "your-api-key-here"
}
}
}
}
(Windows version)
"mcpServers": {
"openai-assistant": {
"command": "C:\\Users\\YOUR_USERNAME\\AppData\\Local\\Programs\\Python\\Python311\\python.exe",
"args": ["-m", "mcp_simple_openai_assistant"],
"env": {
"OPENAI_API_KEY": "your-api-key-here"
}
}
MS Windows installation is slightly more complex, because you need to check the actual path to your Python executable. Path provided above is usually correct, but might differ in your setup. Sometimes just python.exe
without any path will do the trick. Check with cmd
what works for you (using where python
might help). Also, on Windows you might need to explicitly tell Claude Desktop where the site packages are using PYTHONPATH environmment variable.
Usage
Once configured, you can use the tools listed above to manage your assistants and conversations. The primary workflow is to:
- Use
create_new_assistant_thread
to start a new, named conversation. - Use
list_threads
to find the ID of a thread you want to continue. - Use
ask_assistant_in_thread
to interact with your chosen assistant in that thread.
TODO
- Add Thread Management: Introduce a way to name and persist thread IDs locally, allowing for easier reuse of conversations.
- Add Models Listing: Introduce a way for the AI user to see what OpenAI models are available for use with the assistants
- Add Assistants Fine Tuning: Enable the AI user to set detailed parameters for assistants like temperature, top_p etc. (indicated by Claude as needed)
- Full Thread History: Ability to read past threads without having to send a new message (indicated by Claude as needed)
- Explore Resource Support: Add the ability to upload files and use them with assistants.
Development
To install for development:
git clone https://github.com/andybrandt/mcp-simple-openai-assistant
cd mcp-simple-openai-assistant
pip install -e '.[dev]'
伺服器配置
{
"mcpServers": {
"mcp-simple-openai-assistant": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/metorial/mcp-container--andybrandt--mcp-simple-openai-assistant--mcp-simple-openai-assistant",
"mcp-simple-openai-assistant"
],
"env": {
"OPENAI_API_KEY": "openai-api-key"
}
}
}
}