Content
This project demonstrates a backend system that enables users to manage inventory using natural language. It consists of two services:
1. Inventory Service --> (`Inventory_services/application.py`)
A RESTful Flask API to add, sell, and check item stock.
2. Model Control Plane (MCP) --> (`MCPServer/mcp.py`)
Converts natural language queries into structured API calls using OpenRouter’s LLMs.
My Approach:
I have cratead a Flask for an invetory and the exposed the contents to the endpoint /inventory.
For my idea of the MCP, I decided to parse the NLP query to a LLM (OpenRouter in my project) and set instruction for the LLM to convert the query to a post or a get call based on query,
for the propmt template I added support queries as mentiond in the OpenAI docs to make my prompt a bit more strict, I have also added the format for the curl commands in the LLM so that tLLM understand that the query need to be converted to a curl command and reutrn method_for_query, item, change.
once the LLM returns the Query in the form of {item,change,method} based on the method I will perform POST or GET call on the appropriate items and Update the inventory.
**** Important ****
Not all models generate support the code, the few I used and are working are :
1. "moonshotai/kimi-k2:free" (currently using)
2. nvidia/llama-3.3-nemotron-super-49b-v1:free (used for 1 day and the free version was removed)
Steps to Execute the project (I have used powershell, if using linux, please change the terminal commands)
Step 1: Clone the Git Repo
Step 2: Activate the Virtual Environment
$ . .\venv\Scripts\Activate.ps1
Step 3: Install requirements
$ pip install -r requirements.txt
Step 4: Set OpenRouter API Key:
$ OPENROUTER_API_KEY=openrouter_key_here
Step 5: Start the Inventory_services
$ cd Inventory_services
$ python application.py
Step 6: Start the MPC server
$ cd MCPServer
$ python mcp.py
Step 7: Open a new shell and runn the following command :
Example commands to test the project:
for linux:
$ curl -X POST http://localhost:6000/query \
-H "Content-Type: application/json" \
-d '{"query": "Add 20 iPhones"}'
for powershell (without NLP):
$ Invoke-RestMethod -Uri "http://localhost:5000/inventory" `
-Method POST `
-Headers @{ "Content-Type" = "application/json" } `
-Body '{"item": "tshirts", "change": -3}'
with NLP:
Invoke-RestMethod -Uri "http://localhost:6000/query" -Method POST -Headers @{ "Content-Type" = "application/json" } -Body '{"query": "remove 2 tshirts"}'
Sandesh Gowda Shirgavara Ganesha
sgsandeshgowda22@gmail.com
https://www.linkedin.com/in/sandesh-gowda/
Connection Info
You Might Also Like
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
markitdown
Python tool for converting files and office documents to Markdown.
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.
TrendRadar
TrendRadar: Your hotspot assistant for real news in just 30 seconds.
mempalace
The highest-scoring AI memory system ever benchmarked. And it's free.
mempalace
The highest-scoring AI memory system ever benchmarked. And it's free.