Skip to content

sairam356/MCP-POC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 MCP-POC — GPT + Model Context Protocol (MCP) in Action

This is a proof-of-concept implementation demonstrating how to use Model Context Protocol (MCP) with OpenAI function calling to build real-time LLM-native workflows.


🔥 What It Does

  • Connects GPT-4 to backend tools via the MCP protocol
  • Lets GPT choose the right tool dynamically
  • Extracts required arguments automatically
  • Calls backend logic securely using StdioClientTransport

💳 Example Use Case: Block a Credit Card

With just a natural language prompt:

“Please block my card 1234567890123456 because it was stolen.”

✅ GPT:

  • Selects the blockCreditCard tool
  • Extracts cardNumber and reason
  • Calls the backend tool via MCP
  • Returns a real-time response

🛠 Tech Stack

  • 🔗 Model Context Protocol (MCP)
  • 🧠 OpenAI function calling (tool_choice: "auto")
  • ⚙️ TypeScript + Node.js
  • 📦 Zod schema for input validation
  • 🔄 Stdio transport for client/server connection
  • 🌱 Lightweight and easy to extend

📁 Project Structure

src/
├── client/         # Smart OpenAI-powered client
│   └── client.ts
├── server/         # MCP server exposing tools
│   └── index.ts
.env                # Your OpenAI API key
package.json
tsconfig.json

🧪 Getting Started

  1. Install dependencies
npm install
  1. Set your OpenAI key

Create a .env file:

OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  1. Run the project

In one terminal:

npm run start:server

In another terminal:

npm run start:client
  1. Try a natural prompt
Please block my credit card 1234567890123456 due to fraud

📌 Highlights

  • ✅ No hardcoded logic or prompts
  • ✅ Tool selection + argument extraction are automatic
  • ✅ Works with .ts, .js, or .py server tools
  • ✅ Protocol-driven, agent-ready foundation

📎 Related


🙌 Author

Built by Venkata Sairam Gollamudi
📬 vsairamtech@gmail.com

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors