MCP Server Demo
@raycao871218
一个基于MCP框架的服务器演示项目,提供了简单的API接口实现,包括数字运算、时间查询、订单信息查询等功能。
概要
What is MCP Server Demo?
MCP Server Demo is a demonstration MCP framework server that provides simple API implementations for basic arithmetic, machine time queries, order information retrieval (with database configuration), and dynamic greeting generation. It is intended for developers exploring MCP framework capabilities.
How to use MCP Server Demo?
Install Python 3.10+, the MCP SDK (source at https://github.com/modelcontextprotocol/python-sdk), and optionally PyMySQL for database access. Configure database connection parameters in server.py if using order‑query features, then start the service with mcp dev server.py.
Key features of MCP Server Demo
- Basic arithmetic API (adds two integers plus 1000)
- Machine time query (returns current time delayed 30 minutes)
- Order information query (requires database connection)
- Dynamic greeting generation via
greeting://{name}resource
Use cases of MCP Server Demo
- Demonstrate how to build a simple MCP server with multiple tools
- Test MCP SDK setup and tool invocation patterns
- Experiment with database‑backed resource queries in MCP
- Create a prototype for time‑stamped or order‑lookup services
FAQ from MCP Server Demo
What Python version is required?
Python 3.10 or higher is required.
How do I configure the order query feature?
Edit server.py and set the database connection parameters: host='localhost', user, password, and database to your own MySQL credentials.
What dependencies does it need?
The MCP SDK and optionally PyMySQL (for database connectivity) are required.
What does the “add” tool do?
It takes two integers a and b, sums them, and adds 1000 to the result, returning an integer.
How do I start the server?
Run the command mcp dev server.py in your terminal after installing all dependencies.