MCP-Client-Server-with-LLM-Command-Execution

MCP-Client-Server-with-LLM-Command-Execution

3.1

Machine Command Processor (MCP) is a client-server system that uses LLMs to convert natural language queries into shell commands.

The Machine Command Processor (MCP) is designed to bridge the gap between natural language processing and command-line operations. It leverages Groq's LLM API to interpret user queries and convert them into executable shell commands. The system is composed of a client that processes user input, a server that executes the commands, and a shared protocol for communication. The client uses WebSocket to communicate with the server, ensuring real-time interaction. The server is responsible for executing commands safely, with built-in checks to prevent the execution of potentially harmful commands. The entire system is asynchronous, utilizing Python's asyncio for efficient operation. Comprehensive logging is implemented to track both client and server activities, providing an audit trail for all operations.

Features

  • Natural language to shell command conversion using Groq's LLM API
  • WebSocket-based client-server communication
  • Command execution safety checks
  • Comprehensive logging system
  • Asynchronous operation using Python's asyncio

Usage with Different Platforms

Start the server

bash
python mcp_server.py

Start the client

bash
python mcp_client.py

Enter natural language queries


Enter your query: list all files in the current directory