MCP Orders Server

MCP Orders Server

A practice project that enables users to create and list orders within an in-memory system using MCP tools. It is designed to demonstrate how to integrate the Model Context Protocol with clients like Cursor using the FastMCP framework.

Category
Visit Server

README

MCP Orders Server — Practice Project

A small practice project to learn how the Model Context Protocol (MCP) works. It exposes an in-memory “orders” API as MCP tools so an MCP client (e.g. Cursor) can create and list orders via the protocol.

What’s in this repo

  • app/ — Core domain: Pydantic models (Order, CreateOrderRequest) and service functions (create_order, list_orders) that keep orders in memory.
  • mcp_server/ — MCP server built with FastMCP: exposes two tools that call into app.
  • mcp.json — Example MCP config for Cursor (or copy into .cursor/mcp.json or ~/.cursor/mcp.json).

How MCP fits in

  1. MCP server = process that exposes tools (and optionally resources, prompts). Here it’s mcp_server/server.py, which runs over stdio and talks JSON-RPC.
  2. MCP client = app that discovers and calls those tools. Cursor is an MCP client; when you add this server in Cursor’s MCP settings, Cursor spawns the server and sends tool calls to it.
  3. Tools = named functions with typed arguments. This server exposes:
    • create_order_tool(product_id, quantity) — creates an order and returns it.
    • list_orders_tool() — returns all orders.

So “how MCP works” here: Cursor sends a tool call (e.g. create order with product_id 1, quantity 255) → MCP server receives it → server calls create_order → returns the new order as the tool result → Cursor shows it to you.

Setup

cd /path/to/MCP
python -m venv venv
source venv/bin/activate   # or `venv\Scripts\activate` on Windows
pip install -r requirements.txt

Run the MCP server locally (stdio)

From the project root:

python mcp_server/server.py

The server runs over stdio and waits for JSON-RPC messages. It will exit quickly if nothing is connected; that’s expected. To use it, run it via an MCP client (e.g. Cursor).

Use with Cursor

  1. Config — Cursor reads MCP config from:

    • Project: .cursor/mcp.json
    • User: ~/.cursor/mcp.json
  2. Example config (adjust paths if needed):

    {
      "mcpServers": {
        "orders-server": {
          "command": "/path/to/MCP/venv/bin/python",
          "args": ["mcp_server/server.py"],
          "cwd": "/path/to/MCP"
        }
      }
    }
    

    cwd must be the project root so the app package can be imported.

  3. Restart Cursor (or reload MCP) so it picks up the config and starts the server.

  4. In Cursor you can then call the create order and list orders tools (e.g. from the MCP / Composer tools UI).

Project layout

MCP/
├── app/
│   ├── schema.py      # Order, CreateOrderRequest (Pydantic)
│   ├── service.py     # create_order(), list_orders() — in-memory store
│   └── main.py        # optional FastAPI app (not required for MCP)
├── mcp_server/
│   └── server.py      # FastMCP server, create_order_tool, list_orders_tool
├── mcp.json           # example MCP config for Cursor
├── requirements.txt
└── README.md

Tech used

  • Python 3
  • MCP — Model Context Protocol SDK
  • FastMCP — from the MCP package, for defining tools and running the stdio server
  • Pydantic — request/response models

This repo is for learning: minimal persistence (in-memory only), no database, no auth — just enough to see how an MCP server exposes tools and how a client calls them.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured