bbarrington0099
MCP Serverbbarrington0099public

openai_mcp

提供与 OpenAI 模型交互的本地接口,支持工具增强推理。

Repository Info

0
Stars
0
Forks
0
Watchers
0
Issues
Python
Language
-
License

About This Server

提供与 OpenAI 模型交互的本地接口,支持工具增强推理。

Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.

Documentation

OpenAI MCP

This tool provides a local interface for interacting with OpenAI models that can call tools hosted on a Model Context Protocol (MCP) server. It enables tool-augmented reasoning through a modular and extensible architecture.

How it works

  1. The client passes your query to the OpenAI API.
  2. The OpenAI API determines whether a tool is required to fulfill the request.
  3. If needed, it responds with a tool call request.
  4. The client then runs the requested tool using the local MCP server.
  5. The result is sent back to the OpenAI API for processing.
  6. The OpenAI API determines if the query has been fullfilled or if further tools calls are needed in which case steps 3-5 are repeated until the task is complete.
  7. The API returns the fully formatted response, which is displayed to the user.

Set-up

Built with Python 3.12.6 Ensure you are in the project directory openai_mcp

Virtual Environment with Automatic Setup (Optional)

Change source to the projects virtual environment and automatically install requirements:

# Windows
setup_env.bat

# Linux
chmod +x setup_env.sh
source setup_env.sh

Install Requirements

Thess steps should be complete already if you ran the setup_env

  1. Install required Python Packages:
    pip install -r requirements.txt
    
  2. Clone MCP Servers
    git clone https://github.com/modelcontextprotocol/servers.git
    
  3. Install required Node Packages and Build the Servers:
    cd servers
    npm install
    npm run build
    

Environment Variables

Create a .env file in the openai_mcp directory with:

OPENAI_API_KEY=your_openai_api_key

Note: Obtain your API key from the OpenAI dashboard

Using the Agent with MCP Tools Available

Configure MCP Servers

Servers can be configured in config.py based on each ones documentation at https://github.com/modelcontextprotocol/servers/tree/main/src

Already Configured Servers

Servers can be disabled by setting their load_tools_to_client to False

  1. Filesystem - This MCP Server provides tools cabable of interacting with the file system based on the configured allowed directories
    • Add any paths that the tools should be able to access to the accessible_dirs list, paths to the User's local(not OneDrive) Desktop and Documents directory are already included
  2. Puppeteer - This MCP Server provides tools cabable of performing tasks within a Web Browser
    • Adjust if the browser is run in headless mode and what dimensions to set the window to
  3. Memory - This MCP Server provides persistent memory capabilities using a local knowledge graph, allowing the system to remember user-specific information across interactions
    • Adjusting the MEMORY_BEHAVIOR will allow for specifiying Memory behavior

      Example Follow these steps for each interaction:
      1. User Identification:

        • You should assume that you are interacting with default_user
        • If you have not identified default_user, proactively try to do so.
      2. Memory Retrieval:

        • Always begin your chat by saying only "Remembering..." and retrieve all relevant information from your knowledge graph
        • Always refer to your knowledge graph as your "memory"
      3. Memory

        • While conversing with the user, be attentive to any new information that falls into these categories: a) Basic Identity (age, gender, location, job title, education level, etc.) b) Behaviors (interests, habits, etc.) c) Preferences (communication style, preferred language, etc.) d) Goals (goals, targets, aspirations, etc.) e) Relationships (personal and professional relationships up to 3 degrees of separation)
      4. Memory Update:

        • If any new information was gathered during the interaction, update your memory as follows: a) Create entities for recurring organizations, people, and significant events b) Connect them to the current entities using relations b) Store facts about them as observations
  4. Fetch - This MCP Server enables the retrieval and processing of web content, converting HTML to markdown, and allowing models to fetch and read data in chunks from web pages
  5. Git - This MCP Server allows for basic Git interaction
    • Updating the ACCESSIBLE_REPO will let the MCP Server work within that path
  6. Sequential_Thinking - This MCP Server specifies that the LLM should use a structured thinking path to solve promplems in a dynamic and reflective way
  7. Time - This MCP Server allows for knowing the current time and performing Timezone Conversion
    • Updating the configured TIMEZONE will change what TZ the server uses to answer (Setting it to None will result in using UTC)

Run the MCP Client

If verbose logging is needed, set VERBOSE_CHAT_LOG in config.py to True

  1. Set the desired OPENAI_MODEL in config.py, o3-mini recommended Note: The model must be listed in modules.openai_utils.MODEL_PRICING or one will be selected for you.
  2. Adjust MAX_CALLS_PER_QUERY as needed in config.py
  3. Run python main.py in the terminal
  4. Interact with the Client as desired
  5. Send quit as a query to close the Client and connections

Cleanup

Removing venv and servers Repo

Remove the servers repository and venv, making branch cleanup easier

# Windows
cleanup_env.bat

# Linux
chmod +x cleanup_env.sh
./cleanup_env.sh

Quick Start

1

Clone the repository

git clone https://github.com/bbarrington0099/openai_mcp
2

Install dependencies

cd openai_mcp
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

Ownerbbarrington0099
Repoopenai_mcp
LanguagePython
License-
Last fetched8/10/2025

Recommended MCP Servers

💬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
🔗

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
🕷️

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation