Food Delivery MCP Server

Food Delivery MCP Server

Enables users to search restaurants, view menus, place orders, and check order status via a local MCP server using Firestore.

Category
访问服务器

README

Local Model Context Protocol Server for a Food Delivery Application

Python 3.12 <a href="https://github.com/kefranabg/readme-md-generator/blob/master/LICENSE"> Model Context Protocol Firebase

Demo

Are you hungry? Ask for the restaurant menu!


Asking for food.

Let the agent order for you!

alt text

Check the status of your order!

alt text

Code structure

An effective directory layout for the food delivery MCP server is as follows:

food-delivery-mcp/
├──.venv/                   # The isolated Python virtual environment
├──.env                     # Secure storage for environment variables
├── data_models/
│   └── models.py           # The dataclasses provided for the application
├── db/
│   └── firestore_client.py # All database interaction logic
├── protocol/
│   ├── __init__.py         # Initializes the protocol package
│   ├── resources.py        # Defines the MCP Resources for the application
│   └── tools.py            # Defines the MCP Tools for the application
├── server.py               # The main FastMCP server implementation
├── pyproject.toml          # Project metadata and dependencies
├── requirements.txt        # List of dependencies for the project
└── README.md               # Project documentation

This structure intentionally isolates distinct logical components. The database interaction logic is encapsulated within the db/ directory, completely separate from the MCP server definition in server.py. This architectural decision is pivotal. It allows the server to act as a clean orchestration layer, defining the Tools and Resources available to the AI agent and delegating the underlying data operations to the firestore_client module. This separation makes each component independently testable and easier to reason about, a significant advantage when time is of the essence.

Database client

For this project we use Firestore as the database. The db/firestore_client.py module encapsulates all interactions with Firestore, providing a clean interface for the server to use. This separation of concerns allows for easier testing and maintenance.

Mapping Application Logic to MCP Primitives: Thinking in AI Terms

The MCP specification defines two primary ways for a server to expose capabilities: Resources and Tools. The distinction between them is one of the most important architectural concepts in the protocol, and getting it right is key to building an effective server.

Resources are defined as application-controlled, read-only data sources. They are meant to provide context to the LLM. Think of them as analogous to

GET endpoints in a traditional REST API. They retrieve information without causing any side effects or state changes. The client application (the "host") typically decides when and how to fetch these resources to inform the model.

Tools are defined as model-controlled functions that the LLM can decide to execute to perform an action. They are analogous to

POST, PUT, or DELETE endpoints in a REST API. They are expected to perform computations and can have side effects, such as creating or modifying data in a database. The AI agent itself determines that a tool needs to be called based on the user's request, and for security, the user should always be prompted for confirmation before a sensitive tool is executed.

For the food delivery app, the features can be mapped to MCP primitives as follows:

Feature MCP Primitive Justification Example Natural Language Invocation
Search for restaurants Tool This is an active search operation that requires parameters (e.g., cuisine, rating) and performs a filtered query against the database. The LLM decides when to perform this action based on a user's request to find something specific. "Find me Italian restaurants with a rating above 4 stars"
View a restaurant's menu Resource This is a pure, read-only data retrieval for a specific entity (a restaurant). Once a restaurant is identified, the host application can fetch its menu as context for the LLM without the LLM needing to perform an "action". (After user selects a restaurant) The client fetches the resource at foodapp://restaurants/{id}/menu
Place an order Tool This is the quintessential action. It has significant side effects: it creates a new Order document in Firestore and initiates a real-world process. It requires explicit invocation and user confirmation. "Order a margherita pizza from Pizza Palace."
Check order status Tool While this is a read operation, it's an action taken to retrieve a specific, dynamic piece of information for the user based on a unique identifier (the order ID). It's a direct request for the server to do something. "What is the status of my last order?"
List all available cuisines Resource This involves retrieving a list of relatively static, descriptive data. It's useful context for the LLM to know the possible values it can use for the cuisine parameter in the search_restaurants tool. "What types of food can I order?"

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选