nareshtank001
MCP Servernareshtank001public

openai tools and mcp examples

Examples of OpenAI tool calls and Model Context Protocol (MCP)

Repository Info

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

About This Server

Examples of OpenAI tool calls and Model Context Protocol (MCP)

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 Tool Calls and MCP (Model Context Protocol) Examples

A TypeScript project demonstrating both OpenAI function calling capabilities and Model Context Protocol (MCP) implementation.

Setup

  1. Clone the repository
  2. Install dependencies:
npm install
  1. Configure your OpenAI API key in the .env file:
OPENAI_API_KEY=your_api_key_here

Running the Examples

OpenAI Tool Calls Example

npm run dev

MCP Server Example

ts-node src/mcp-server.ts

MCP Client Example

ts-node src/mcp-client.ts

How It Works

This project demonstrates:

OpenAI Tool Calls

  1. Setting up a simple calculator tool (function)
  2. Sending a request to OpenAI with the tool definition
  3. Handling the tool call response
  4. Sending a follow-up request with the tool result

Model Context Protocol (MCP)

  1. Implementing an MCP server that exposes calculator tools
  2. Creating an MCP client that connects to the server
  3. Calling tools through the MCP protocol
  4. Handling responses between client and server

The code is heavily commented to explain each step of the process.

Learning Resources

  • OpenAI Tools Documentation
  • Model Context Protocol (MCP) Documentation

Quick Start

1

Clone the repository

git clone https://github.com/nareshtank001/openai-tools-and-mcp-examples
2

Install dependencies

cd openai-tools-and-mcp-examples
npm install
3

Follow the documentation

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

Repository Details

Ownernareshtank001
Repoopenai-tools-and-mcp-examples
LanguageTypeScript
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