Example of integrating MCP with openai chat completions to use tools from MCP server.
Config is the same across clients — only the file and path differ.
{
"mcpServers": {
"utilities": {
"env": {},
"args": [
"server.py"
],
"command": "python3"
}
}
}Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
A learning project demonstrating how to integrate the Model Context Protocol (MCP) into chat applications. This repository shows practical patterns for connecting OpenAI's LLM with MCP servers to enable dynamic tool discovery and execution.
No automated test available for this server. Check the GitHub README for setup instructions.
Five weighted categories — click any category to see the underlying evidence.
No known CVEs.
No package registry to scan.
Be the first to review
Have you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Others in ai-ml / education
Persistent memory using a knowledge graph
Dynamic problem-solving through sequential thought chains
Workspace template + MCP server for Claude Code, Codex CLI, Cursor & Windsurf. Multi-agent knowledge engine (ag-refresh / ag-ask) that turns any codebase into a queryable AI assistant.
Privacy-first. MCP is the protocol for tool access. We're the virtualization layer for context.
MCP Security Weekly
Get CVE alerts and security updates for Mcp Chatwithtools and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
A learning project demonstrating how to integrate the Model Context Protocol (MCP) into chat applications. This repository shows practical patterns for connecting OpenAI's LLM with MCP servers to enable dynamic tool discovery and execution.
This project demonstrates how to integrate MCP servers so they can be called as tools in an application using OpenAI-compatible API calls that take an array of tool definitions.
The architecture shows how to cleanly separate concerns when integrating MCP into LLM applications, making it easy to add new tools without modifying application code.
uv package manager (recommended) or pip# Install dependencies
uv sync
The main example demonstrating the "tools with chat" pattern:
# Set your OpenAI API key (also supports .env)
export OPENAI_API_KEY="your-api-key-here"
# Optional set alternative API base URL
export OPENAI_BASE_URL="your-alt-url/v1 here"
# Run with default model (gpt-4o-mini)
python chatwithtools.py mcp.json
# Or specify a different model
python chatwithtools.py mcp.json gpt-4o

chatwithtools.py demonstrates how to integrate MCP (Model Context Protocol) into a "tools with chat" application. It shows a clean architectural pattern with two key components:
get_tools() function to format MCP tools for OpenAI's function calling APIThis pattern enables an OpenAI LLM to dynamically discover and call tools hosted on any MCP server without hardcoding tool definitions. The system consists of four main participants:
The ChatSession class implements the "tools with chat" pattern, orchestrating the complete conversation flow with OpenAI:
Responsibilities:
MCPToolExecutor.initialize_tools() to get MCP tools formatted for OpenAItool_calls arrayKey Methods:
initialize() - Loads MCP tools via tool_executor.initialize_tools() for the tools arraysend_message(user_message) - Orchestrates the full chat completion cycle including tool callsrun() - Interactive command-line loopKey Pattern:
# Phase 1: Chat with tools array
response = openai.chat.completions.create(
model=self.model,
messages=self.messages,
tools=self.tools, # Formatted by MCPToolExecutor
tool_choice="auto"
)
# Phase 2: Execute tools if requested
if response.tool_calls:
... [View full README on GitHub](https://github.com/oshea00/mcp-chatwithtools#readme)