home / mcp / product mcp server

Product MCP Server

This project implements a simple Model Context Protocol (MCP) server using FastMCP, Pydantic, and Uvicorn.

Installation
Add the following to your MCP client configuration file.

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.

How to use

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.

How to install

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.py

Additional notes

The 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.

Available tools

add_product

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.

search_product

Searches the catalog by name or category and returns matching products.

get_product

Retrieves the details of a product by its unique ID.