අද අපේ topic එක offline automation ගැන. Internet නැති වෙලාවටත් ඔයාගේ scripts run වෙන system එකක් තියෙන්න ඕනේනෙ? ඒකට තමයි MCP (Minimal Command Processing) Server + Local Scripts combo එක.
🔍 MCP Server කියන්නෙ මොකද්ද?
MCP Server කියන්නෙ lightweight offline command-processing server එකක්. ඔයාට CLI commands, Python/Bash scripts run කරන්න පුළුවන් – without needing the internet!
MCP = "Minimal Command Processor"
ඔයාගේ system එකට offline brain එකක් වගේ!
🛠️ MCP Setup එක – Local Machine එකේ
-
Install Python (මොකද්ද MCP backend එක mostly Python)
-
Create a project folder:
mkdir my-mcp-server && cd my-mcp-server
- Add MCP base script:
mcp.py
import os
import subprocess
def run_command(cmd):
try:
output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
return output.decode()
except subprocess.CalledProcessError as e:
return e.output.decode()
while True:
command = input("MCP> ")
if command.lower() in ['exit', 'quit']:
break
print(run_command(command))
- Run it:
python mcp.py
🧠 දැන් ඔයාට local scripts, system tasks, custom tools CLI එකෙන් run කරන්න පුළුවන්!
🧪 Connect MCP to Your Local Scripts
උදාහරණයක්: Let's say you have a custom script called generate_report.py
.
🔗 Add a command shortcut in commands.txt
or map manually in mcp.py
like:
if command == "report":
os.system("python generate_report.py")
➡️ දැන් report
කියලා MCP> CLI එකේ ලියන්න පුළුවන්.
🚀 Use Cases (Offline Power! 💪)
- 🧠 Local AI tools (Eg: Ollama models)
- 📝 Auto backups
- 🎮 Game scripts run offline
- 📊 Data report generators
- 🔐 Security tools for offline audits
🔐 Bonus Tip – Secure Your MCP
- Use
getpass
to add a password prompt. - Use folders like
/scripts/
and limit command access. - Disable
rm
,shutdown
, etc. in production use!
🧠 Final Thoughts
Offline tools are underrated. MCP + your own scripts කියන්නේ pure freedom. Internet නැති වෙලාවටත් smart automation, powerful utilities, and offline AI workflows run කරන්න පුළුවන්.
🔥 ඔබට මේ system එකට GUI එකක් හදන හැටි දැනගන්න ඕනෙද? නැත්තං Discord CLI MCP bot එකක්?
Stay Offline, Stay Powerful. 💻🧠