🔗 MCP Server (Model Context Protocol) එක – A-Z Guide 🎓🤖
🧩 MCP (Model Context Protocol) Server කියන්නේ lightweight software එකක්. 🤖 ඒක AI models (GPT, Mistral, Ollama, etc.) සහ external tools/data sources 🌐 අතර bridge එකක් වගේ role එකක් play කරනවා.
🧠 MCP Server කියන්නේ මොකද්ද? 💡🛠️
Model Context Protocol (MCP) කියන්නේ AI model එකට 📡 live context provide කරන්න specially design කරපු middleware එකක්.
🔥 With MCP, your AI model can:
- 🔌 Connect with APIs
- 📂 Read/write filesystems
- 📊 Access live databases
- 🛎️ Trigger CLI commands
- 🧰 Use custom plugins/tools
📦 CLI Example:
mcp-server --port 3000 --config ./tools.json
🏗️ Architecture Overview 🧱📐
MCP server architecture එක simple but powerful:
🧑💻 User Prompt ➝ 🧠 LLM ➝ 🔄 MCP Server ➝ ⚙️ Tool/API ➝ 🧠 LLM Response
🛤️ AI model එක MCP server එකට query එකක් දානවා ➝ MCP එක tool එක trigger කරනවා ➝ result එක model එකට යවලා user එකට reply එකක් එනවා.
🛠️ MCP Tools Format 🧾
MCP Server එකට connect කරන tools describe කරනවා JSON format එකෙන් 🧊
🧪 Example Tool Config:
- 🔧 Tool Name: weather_tool
- 📝 Description: Get live weather info ☁️🌡️
- 🌍 Endpoint: https://api.weather.com/location
- 🔁 Method: GET
🧠 MCP Server එක මේ info එක base කරගෙන model එකට tool access කරන හැකියාව දෙයි.
🌦️ Weather Tool Example (Sri Lanka 🇱🇰)
Imagine doing this with a local weather API:
- 🆔 Name:
weather_lk
- 🌤️ Description: Check 🇱🇰 Sri Lanka weather
- 📡 Endpoint:
https://weatherapi.com/lk
- 🔁 Method: GET
🤖 AI model එකට prompt එකක් "What's the weather in Colombo?" කියලා ආවම, MCP එක මේ tool එක trigger කරලා result එක model එකට දෙනවා!
💡 What Can You Do With MCP? 🌍✨
- 🔍 Integrate Google/Bing search
- 📂 Read PDFs & summarize
- 🖥️ Trigger Python scripts
- 🗂️ Custom tool execution
- 🤖 Build personal AI assistant
⚙️ MCP Setup Guide 🧰
📦 Install MCP Server:
npm install mcp-server
🚀 Run it with tools:
mcp-server --tools tools.json
🤖 Now your AI model can talk to the real world!
✅ Supported Models 📚
🤖 Model Name | 🧩 Compatible |
---|---|
GPT-4 | ✅ |
Mistral + LangChain | ✅ |
Ollama Models | ✅ |
LlamaIndex | ✅ |
📦 Why You Should Use MCP? 🧠⚡
- 🪶 Lightweight
- 🧩 Modular & Flexible
- 🛠️ Easy to customize
- 💻 Local & Cloud support
- 🧵 Middleware logic support
🔒 Security Tips 🛡️
- 🔑 Protect API keys
- 🚧 Use role-based tool control
- 📜 Log access and responses
- 🚫 Avoid unrestricted shell commands
🏁 Conclusion 🧠🧱
🔥 MCP Server කියන්නේ AI model එකකට real-world power දෙන middleware එකක්.
🤖 MCP එක connect වෙන model එකක් තියෙනවා නම්, ඔබේ assistant එකට:
- 📡 APIs
- 📂 Files
- 🧪 Custom logic
එවගෙම ✨ real-time dynamic knowledge add කරන්න පුළුවන්.
📌 Next Blog Idea: "🛠️ MCP Tools Dev – Build Your Own Tools Like a Pro! 🚀"