
mcp server demo
一个基于MCP框架的服务器演示项目,提供了简单的API接口实现,包括数字运算、时间查询、订单信息查询等功能。
Repository Info
About This Server
一个基于MCP框架的服务器演示项目,提供了简单的API接口实现,包括数字运算、时间查询、订单信息查询等功能。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
MCP Server Demo
一个基于MCP框架的服务器演示项目,提供了简单的API接口实现,包括数字运算、时间查询、订单信息查询等功能。
功能特性
- 基础数字运算API
- 机器时间查询
- 订单信息查询(需配置数据库)
- 动态问候语生成
环境要求
- Python >= 3.10
- MCP框架
- PyMySQL(用于数据库连接)
安装说明
-
安装MCP SDK MCP SDK的源码可在 https://github.com/modelcontextprotocol/python-sdk 获取
-
配置数据库连接(如需使用订单查询功能)
- 在
server.py中修改数据库连接参数:
host='localhost' user='DATABASE_USERNAME_HERE' password='YOUR_PASSWORD_HERE' database='YOUR_DATABASE_HERE' - 在
启动服务
使用以下命令启动服务:
mcp dev server.py
API文档
1. 数字相加
- 功能:将两个数字相加并加上1000
- 参数:
- a: 整数
- b: 整数
- 返回:计算结果(整数)
2. 获取机器时间
- 功能:获取当前机器时间(延后30分钟)
- 返回:JSON格式的时间信息
3. 订单信息查询
- 功能:根据订单ID查询订单信息
- 参数:
- orderid: 订单编号
- 返回:JSON格式的订单信息
4. 问候语生成
- 端点:
greeting://{name} - 功能:生成个性化问候语
- 参数:
- name: 用户名
- 返回:问候语字符串
许可证
MIT
Quick Start
Clone the repository
git clone https://github.com/raycao871218/mcp-server-demoInstall dependencies
cd mcp-server-demo
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.