loading…
Search for a command to run...
loading…
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 M
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.
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.
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).mcp_server/server.py, which runs over stdio and talks JSON-RPC.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.
cd /path/to/MCP
python -m venv venv
source venv/bin/activate # or `venv\Scripts\activate` on Windows
pip install -r requirements.txt
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).
Config — Cursor reads MCP config from:
.cursor/mcp.json~/.cursor/mcp.jsonExample 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.
Restart Cursor (or reload MCP) so it picks up the config and starts the server.
In Cursor you can then call the create order and list orders tools (e.g. from the MCP / Composer tools UI).
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
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.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"mcp-orders-server": {
"command": "npx",
"args": []
}
}
}PRs, issues, code search, CI status
Database, auth and storage
Reference / test server with prompts, resources, and tools.
Secure file operations with configurable access controls.