home / mcp / product mcp server
This project implements a simple Model Context Protocol (MCP) server using FastMCP, Pydantic, and Uvicorn.
Configuration
View docs{
"mcpServers": {
"fedilahbib-mcp-server-using-fastmcp": {
"url": "http://localhost:8000"
}
}
}You run a lightweight MCP server that exposes three practical tools for managing products: add a product, search products, and get a product by its ID. It’s built to be lightweight and easy to integrate with MCP clients for demos, prototyping, or AI agent workflows.
You interact with the server through an MCP-compatible client. Start by launching the server locally and then connect your client to the HTTP endpoint to call the available tools. Use the three tools to manage an in-memory catalog of products: add new items, search by name or category, and fetch details for a specific product by ID. Each tool corresponds to a distinct operation you can perform from your client.
Prerequisites: you need Python 3.8+ and a shell environment.
python3 -V
```
```
python3 -m venv venv
source venv/bin/activate
```
```
pip install -r requirements.txt
```
```
python main.pyThe server runs over HTTP and listens on http://localhost:8000. Use a MCP client to call the following tools: add_product, search_product, and get_product. The storage is in-memory, which makes it ideal for quick demonstrations and live-testing with an MCP-enabled agent.
Adds a new product to the in-memory catalog. You provide details such as name, category, price, stock, and description to create a new entry.
Searches the catalog by name or category and returns matching products.
Retrieves the details of a product by its unique ID.