A simple MCP server for interacting with OpenAI assistants
Project description
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
- Create new OpenAI assistants and manipulate existing ones
- Start conversation threads
- Send messages and receive responses - talk to assistants
Because OpenAI assistants might take quite long to respond and then the processing is cut short with the client (Claude desktop) timeout the MCP server code has no control over we are implementing a two-stage approach. In the first call Claude sends a message to the assistant to start the processing, in the second call - possibly several minutes later - Claude can retrieve the response. This is a kind of workaround until MCP protocol and clients would implement some keep-alive mechanism for longer processing.
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).
Usage
Once configured, the server provides tools to:
- Create new assistants with specific instructions
- List existing assistants
- Modify assistants
- Start new conversation threads
- Send messages and receive responses
The server handles all OpenAI API communication, including managing assistants, threads, and message handling.
TODO
- Add a way to handle threads - store threads IDs for potential re-use
- Add a way to better handle long OpenAI responses which now seem to sometimes trigger timeouts
Development
To install for development:
git clone https://github.com/andybrandt/mcp-simple-openai-assistant
cd mcp-simple-openai-assistant
pip install -e .
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_simple_openai_assistant-0.2.6.tar.gz.
File metadata
- Download URL: mcp_simple_openai_assistant-0.2.6.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dc6f66fe7f344c9991bad999fb99b2472a025a1600ac4c6cd1517dc307837e1
|
|
| MD5 |
8e242d3b036c9f52a57b778463632656
|
|
| BLAKE2b-256 |
d3d01a55549e46b137ff3dc4c9aad9f92278b5a8506e284eaf8000c38511a33d
|
File details
Details for the file mcp_simple_openai_assistant-0.2.6-py3-none-any.whl.
File metadata
- Download URL: mcp_simple_openai_assistant-0.2.6-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78e2238bbac8c0774b352c782456ffb73fe2bbf08c6646c4c30d19e3169ca9ae
|
|
| MD5 |
7f3018fd6a883fdea90766aac3e2eee9
|
|
| BLAKE2b-256 |
6571a961391d754a4287f6d06d4c233924f3e336ccc6b386a45c63e9312cfad0
|