一个实现MCP协议的示例服务器
Project description
MCP示例服务器 (v0.1.0)
这是一个实现MCP协议的示例服务器,提供时间查询、数学计算和信息获取等功能。 通过MCP协议,大语言模型可以使用这个服务器来获取各种实用功能。
##功能特性
###工具 (Tools)
get_current_time: 获取当前系统的精确时间format_date:按照指定格式格式化当前日期和时间add_numbers:计算两个数字的和multiply_numbers:计算两个数字的乘积generate_random_number: 生成指定范围内的随机整数calculate_statistics:计算数字列表的统计信息(平均值、最大值、最小值)
###资 (Resources)
info://server: 提供服务器基本信息time://current_iso: 提供ISO格式的当前时间math://constants: 提供常用的数学常数(π、e等)
安装
pip install mcp-example-server1
在阿里云百炼中使用
在阿里云百炼平台的MCP服务配置中,使用以下JSON:
{
"mcpServers": {
"example-mcp-server": {
"command": "uvx",
"args": ["mcp-example-server1"]
}
}
}
本地运行
安装后,您可以在本地通过以下方式运行:
# 使用uvx (模拟平台行为)
uvx mcp-example-server1
# 使用包提供的命令 (通过entry_points)
mcp-example-server1
# 使用Python -m
python -m mcp_example_server1
按 Ctrl+C停止服务器。
开发说明
本项目使用 MCP Python SDK构建,采用 FastMCP实现。
##许证
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_example_server1-0.1.0.tar.gz.
File metadata
- Download URL: mcp_example_server1-0.1.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4deb919a686181d6a2cbbe36f838d94aca936f3c4fb8683456a3facbe2a06232
|
|
| MD5 |
88d0aba3a71caab5216b6701fd700e9f
|
|
| BLAKE2b-256 |
e50769b0711628818da89f1d5a3cd8682ea3bae1d44cec6eb06f8bd11971d54e
|
File details
Details for the file mcp_example_server1-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_example_server1-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f343d91495ed16594c6d96d127c402a193bbff600da858bbe04e5d0b1e446d0e
|
|
| MD5 |
ee62da7833a59f0ddc00a9716a4bf6a3
|
|
| BLAKE2b-256 |
a6a1def41ae41dda0b67fbe4415eee9deb85e49a7eb9febb5f31fb6ea6dde150
|